SlideShare a Scribd company logo
HAMILTONIAN
CIRCUIT
- William Rowan Hamilton
Content :
1. Hamiltonian Cycles Brief History ,definition.
2. Diference between path and cycle.
3. Few Interesting condition.
4. Naive Algorithm and its time complexity .
Hamiltonian Cycles History :
● Icosian game invented by Sir. William Rowan Hamilton (1805–1865) in
1857 and sold to a London game dealer in 1859 for 25 pounds.
● Game Description: The corners of a regular dodecahedron are labeled
with the names of cities; the task is to find a circular tour along the edges
of the dodecahedron visiting each city exactly once.
.
● Solution Model: Hamiltonian cycle; i.e. look for a cycle in the
corresponding dodecahedral graph which contains each vertex exactly
once. The Platonic Solid used in Icosiangame; the corresponding
Hamiltonian cycle is designated by darkened edges.
Dodecahedron - 3 dimensional Dodecahedron-2
dimensional
THIS IS HAMILTONIAN
CYCLE .
A GRAPH CONTAINS A
CYCLE WHICH HAS
ALL VERTICES OF
GRAPH VISITING
EACH VERTEX ONLY
ONCE .
Basic Definition :
● Hamiltonian Cycle: If G = (V, E) is a graph or multi-graph with |V|>=3, we
say that G has a Hamiltonian cycle if there is a cycle in G that contains
every vertex in V exactly once .
● Necessary and Sufficient Conditions: Condition for Hamiltonian based
on Linear Diophantine Equation Systems with Cycle Vector, 2009 3rd Intl.
Conf. on Genetic and Evolutionary Computing .
● Hamiltonian Path: A Hamiltonian path is a path (and not a cycle) in G that
contains each vertex. It is possible, however, for a graph to have a
Hamiltonian path without having a Hamiltonian cycle. Hamiltonian path
having a cycle Hamiltonian cycle .
Graph contains Hamiltonian path but not cycle.Exampl
e
Some Interesting Facts about Hamiltonian cycle :
● Every complete graph with more then two vertices is hamiltonian graph
.
Definition of complete graph: In a undirected simple graph every pair
of a graph is connected with a unique pair.
● If G=(V,E) has a hamiltonian cycle then for all v ∈ V , deg(v)>=2.
● If a ∈ V and deg(a)=2 then two edge incident with vertex a must appear
in every hamiltonian cycle.
● There is no know particular condition which are both necessary and
sufficient.
● So we can define the hamiltonian-cycle problem, “Does a graph G have
a hamiltonian cycle?” as a formal language:
“A graph contains hamiltonian cycle if it is hamiltonian graph .”
● So how might an algorithm decide the language HAM-CYCLE?
Naive - Solution :
one possible decision algorithm lists all permutations of the vertices
of G and then checks each permutation to see if it is a hamiltonian path.
What is the running time of this algorithm? If we use the “reasonable”
encoding of a graph as its adjacency matrix, the number m of vertices in
the graph is Ω√ n , where n= length of the encoding of G. There are m!
possible permutations of vertices ,and therefore the running time is
Ωm! =Ω(√ n !)=Ω(2√ n),
which is not O(nk )for any constant k. Thus, this naive algorithm does not run
in polynomial time. In fact, the hamiltonian-cycle problem is NP-complete,
Verification
Algorithms
Anshika Pandey
205119018
Verification Algorithms
● What is verification of Algorithms?
● Verification algorithm: two argument algorithm A where x is ordinary string and y
is a binary string called certificate.
Hamiltonian Algorithm
Given: Vertices in order. And a graph G such that G is a hamiltonian.
Proof: Check whether it is a permutation of vertices of V, and whether each of the edge
exists in the graph. We can do this in O(n^2) time where n is length of encoding of G.
Thus, a proof that a hamiltonian cycle exists in a graph can be verified in
polynomial time.
Complexity Class NP
● What is NP complexity class
Class of language that can be verified in a polynomial time algorithm.
● What is P class?
Problems that are solvable in polynomial time, i.e. these problems can be
solved in time O(n^k) in worst-case, where k is constant.
● Hamiltonian Cycle is a NP complete problem.
● If L belongs to P then L belongs to NP. P is a subset of NP.
● Areas of Research
It is not known whether P=NP.
It is also unknown that whether NP is closed under complement i.e if L belongs to
NP does it imply complement(L) belongs to NP?
These are four possibilities for relationship among complexity classes.
PSEUDO CODE
Arjun Singh
205119020
Algorithm Hamiltonian(k)
{
do
{
NextVertex(R);
if(x[k]==0)
return ;
if(k==n)
print(x[1:n]);
else
Hamiltonian(k+1);
}
while(true);
}
Algorithm NextVertex(k)
{
do
{
x[k]=(x[k]+1)mod(n+1);
if(x[k]==0)
return ;
if(G[k[k-1],x[k] !=0)
{
for j=1 to k-1 do
if(x[j] == x[k])
break;
if(j==k)
if(k<n or (k==n)
&& G[x[n],x[1]] !=0
return ;
}
while(ture);
}
Traversing
Saurav Kr Gupta
205119092
Graph has Hamiltonian Cycles:
1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 1
1 -> 2 -> 6 -> 5 -> 4 -> 3 -> 1
1 -> 6 -> 2 -> 5 -> 4 -> 3 -> 1
…
2 -> 3 -> 4 -> 5 -> 6 -> 1 -> 2
Pendant Vertices
Articulation Point
0 1 1 0 1
1 0 1 1 1
1 1 0 1 0
0 1 1 0 1
1 1 0 1 0
Adjacency Matrix
X
1 2 3 4 5

More Related Content

What's hot

NP completeness
NP completenessNP completeness
NP completeness
Amrinder Arora
 
Daa unit 4
Daa unit 4Daa unit 4
Daa unit 4
Abhimanyu Mishra
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
Amit Kumar Rathi
 
Approximation Algorithms
Approximation AlgorithmsApproximation Algorithms
Approximation Algorithms
Nicolas Bettenburg
 
asymptotic notation
asymptotic notationasymptotic notation
asymptotic notation
SangeethaSasi1
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
Abhimanyu Mishra
 
trees-and-forest.pdf
trees-and-forest.pdftrees-and-forest.pdf
trees-and-forest.pdf
albertfernandez44
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
Dr Shashikant Athawale
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
Muhammad Amjad Rana
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
Ganesh Solanke
 
Algorithm Using Divide And Conquer
Algorithm Using Divide And ConquerAlgorithm Using Divide And Conquer
Algorithm Using Divide And Conquer
UrviBhalani2
 
N queen problem
N queen problemN queen problem
N queen problem
Ridhima Chowdhury
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
hodcsencet
 
Artificial Intelligence Notes Unit 2
Artificial Intelligence Notes Unit 2Artificial Intelligence Notes Unit 2
Artificial Intelligence Notes Unit 2
DigiGurukul
 
Tsp branch and-bound
Tsp branch and-boundTsp branch and-bound
Tsp branch and-bound
Saravanan Natarajan
 
Daa notes 1
Daa notes 1Daa notes 1
Daa notes 1
smruti sarangi
 
Counting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort AlgorithmsCounting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort Algorithms
Sarvesh Rawat
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
Nv Thejaswini
 
Backtracking
BacktrackingBacktracking
Backtracking
Dr. Jaydeep Patil
 
Closest pair problems (Divide and Conquer)
Closest pair problems (Divide and Conquer)Closest pair problems (Divide and Conquer)
Closest pair problems (Divide and Conquer)
Gem WeBlog
 

What's hot (20)

NP completeness
NP completenessNP completeness
NP completeness
 
Daa unit 4
Daa unit 4Daa unit 4
Daa unit 4
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
Approximation Algorithms
Approximation AlgorithmsApproximation Algorithms
Approximation Algorithms
 
asymptotic notation
asymptotic notationasymptotic notation
asymptotic notation
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
 
trees-and-forest.pdf
trees-and-forest.pdftrees-and-forest.pdf
trees-and-forest.pdf
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
 
Algorithm Using Divide And Conquer
Algorithm Using Divide And ConquerAlgorithm Using Divide And Conquer
Algorithm Using Divide And Conquer
 
N queen problem
N queen problemN queen problem
N queen problem
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
 
Artificial Intelligence Notes Unit 2
Artificial Intelligence Notes Unit 2Artificial Intelligence Notes Unit 2
Artificial Intelligence Notes Unit 2
 
Tsp branch and-bound
Tsp branch and-boundTsp branch and-bound
Tsp branch and-bound
 
Daa notes 1
Daa notes 1Daa notes 1
Daa notes 1
 
Counting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort AlgorithmsCounting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort Algorithms
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
Backtracking
BacktrackingBacktracking
Backtracking
 
Closest pair problems (Divide and Conquer)
Closest pair problems (Divide and Conquer)Closest pair problems (Divide and Conquer)
Closest pair problems (Divide and Conquer)
 

Similar to Hamiltonian Circuit

1500403828
15004038281500403828
1500403828
shaik subhani
 
Topological Strings Invariants
Topological Strings InvariantsTopological Strings Invariants
Topological Strings Invariants
Imran Parvez Khan
 
legendre transformatio.pptx
legendre transformatio.pptxlegendre transformatio.pptx
legendre transformatio.pptx
Mohsan10
 
Ppp1 Rubber Elasticity
Ppp1 Rubber ElasticityPpp1 Rubber Elasticity
Ppp1 Rubber Elasticity
guest824336
 
G is Hamiltonian graph.Hence a path exists which visits each verte.pdf
G is Hamiltonian graph.Hence a path exists which visits each verte.pdfG is Hamiltonian graph.Hence a path exists which visits each verte.pdf
G is Hamiltonian graph.Hence a path exists which visits each verte.pdf
ANANDSHOE
 
Theory of conformal optics
Theory of conformal opticsTheory of conformal optics
Theory of conformal optics
amin vahdat farimani
 
Internship
InternshipInternship
NP Complete Problems in Graph Theory
NP Complete Problems in Graph TheoryNP Complete Problems in Graph Theory
NP Complete Problems in Graph Theory
Seshagiri Rao Kornepati
 
Random walks on graphs - link prediction by Rouhollah Nabati
Random walks on graphs - link prediction by Rouhollah NabatiRandom walks on graphs - link prediction by Rouhollah Nabati
Random walks on graphs - link prediction by Rouhollah Nabati
nabati
 
no U-turn sampler, a discussion of Hoffman & Gelman NUTS algorithm
no U-turn sampler, a discussion of Hoffman & Gelman NUTS algorithmno U-turn sampler, a discussion of Hoffman & Gelman NUTS algorithm
no U-turn sampler, a discussion of Hoffman & Gelman NUTS algorithm
Christian Robert
 
The Traveling Salesman Problem
The Traveling Salesman ProblemThe Traveling Salesman Problem
The Traveling Salesman Problem
Maryam Alipour
 
Causality in special relativity
Causality in special relativityCausality in special relativity
Causality in special relativity
Muhammad Ishaq
 
N. Bilić: AdS Braneworld with Back-reaction
N. Bilić: AdS Braneworld with Back-reactionN. Bilić: AdS Braneworld with Back-reaction
N. Bilić: AdS Braneworld with Back-reaction
SEENET-MTP
 
Hydrogen Schrodinger Equation.pdf
Hydrogen Schrodinger Equation.pdfHydrogen Schrodinger Equation.pdf
Hydrogen Schrodinger Equation.pdf
ssuser0b5a9c1
 
Statistical approach to quantum field theory
Statistical approach to quantum field theoryStatistical approach to quantum field theory
Statistical approach to quantum field theory
Springer
 
Quantum gravitational corrections to particle creation by black holes
Quantum gravitational corrections to particle creation by black holesQuantum gravitational corrections to particle creation by black holes
Quantum gravitational corrections to particle creation by black holes
Sérgio Sacani
 
64 66
64 6664 66
A Route to Chaos for the Physical Double Pendulum by
A Route to Chaos for the Physical Double Pendulum by A Route to Chaos for the Physical Double Pendulum by
A Route to Chaos for the Physical Double Pendulum by
Daniel Berkowitz
 
Application of Pi
Application of PiApplication of Pi
Application of Pi
monil shah
 
great-150816134029-lva1-app6892.pdf
great-150816134029-lva1-app6892.pdfgreat-150816134029-lva1-app6892.pdf
great-150816134029-lva1-app6892.pdf
CAishwarya4
 

Similar to Hamiltonian Circuit (20)

1500403828
15004038281500403828
1500403828
 
Topological Strings Invariants
Topological Strings InvariantsTopological Strings Invariants
Topological Strings Invariants
 
legendre transformatio.pptx
legendre transformatio.pptxlegendre transformatio.pptx
legendre transformatio.pptx
 
Ppp1 Rubber Elasticity
Ppp1 Rubber ElasticityPpp1 Rubber Elasticity
Ppp1 Rubber Elasticity
 
G is Hamiltonian graph.Hence a path exists which visits each verte.pdf
G is Hamiltonian graph.Hence a path exists which visits each verte.pdfG is Hamiltonian graph.Hence a path exists which visits each verte.pdf
G is Hamiltonian graph.Hence a path exists which visits each verte.pdf
 
Theory of conformal optics
Theory of conformal opticsTheory of conformal optics
Theory of conformal optics
 
Internship
InternshipInternship
Internship
 
NP Complete Problems in Graph Theory
NP Complete Problems in Graph TheoryNP Complete Problems in Graph Theory
NP Complete Problems in Graph Theory
 
Random walks on graphs - link prediction by Rouhollah Nabati
Random walks on graphs - link prediction by Rouhollah NabatiRandom walks on graphs - link prediction by Rouhollah Nabati
Random walks on graphs - link prediction by Rouhollah Nabati
 
no U-turn sampler, a discussion of Hoffman & Gelman NUTS algorithm
no U-turn sampler, a discussion of Hoffman & Gelman NUTS algorithmno U-turn sampler, a discussion of Hoffman & Gelman NUTS algorithm
no U-turn sampler, a discussion of Hoffman & Gelman NUTS algorithm
 
The Traveling Salesman Problem
The Traveling Salesman ProblemThe Traveling Salesman Problem
The Traveling Salesman Problem
 
Causality in special relativity
Causality in special relativityCausality in special relativity
Causality in special relativity
 
N. Bilić: AdS Braneworld with Back-reaction
N. Bilić: AdS Braneworld with Back-reactionN. Bilić: AdS Braneworld with Back-reaction
N. Bilić: AdS Braneworld with Back-reaction
 
Hydrogen Schrodinger Equation.pdf
Hydrogen Schrodinger Equation.pdfHydrogen Schrodinger Equation.pdf
Hydrogen Schrodinger Equation.pdf
 
Statistical approach to quantum field theory
Statistical approach to quantum field theoryStatistical approach to quantum field theory
Statistical approach to quantum field theory
 
Quantum gravitational corrections to particle creation by black holes
Quantum gravitational corrections to particle creation by black holesQuantum gravitational corrections to particle creation by black holes
Quantum gravitational corrections to particle creation by black holes
 
64 66
64 6664 66
64 66
 
A Route to Chaos for the Physical Double Pendulum by
A Route to Chaos for the Physical Double Pendulum by A Route to Chaos for the Physical Double Pendulum by
A Route to Chaos for the Physical Double Pendulum by
 
Application of Pi
Application of PiApplication of Pi
Application of Pi
 
great-150816134029-lva1-app6892.pdf
great-150816134029-lva1-app6892.pdfgreat-150816134029-lva1-app6892.pdf
great-150816134029-lva1-app6892.pdf
 

Recently uploaded

Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 

Recently uploaded (20)

Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 

Hamiltonian Circuit

  • 2. Content : 1. Hamiltonian Cycles Brief History ,definition. 2. Diference between path and cycle. 3. Few Interesting condition. 4. Naive Algorithm and its time complexity .
  • 3. Hamiltonian Cycles History : ● Icosian game invented by Sir. William Rowan Hamilton (1805–1865) in 1857 and sold to a London game dealer in 1859 for 25 pounds. ● Game Description: The corners of a regular dodecahedron are labeled with the names of cities; the task is to find a circular tour along the edges of the dodecahedron visiting each city exactly once. . ● Solution Model: Hamiltonian cycle; i.e. look for a cycle in the corresponding dodecahedral graph which contains each vertex exactly once. The Platonic Solid used in Icosiangame; the corresponding Hamiltonian cycle is designated by darkened edges.
  • 4. Dodecahedron - 3 dimensional Dodecahedron-2 dimensional
  • 5. THIS IS HAMILTONIAN CYCLE . A GRAPH CONTAINS A CYCLE WHICH HAS ALL VERTICES OF GRAPH VISITING EACH VERTEX ONLY ONCE .
  • 6. Basic Definition : ● Hamiltonian Cycle: If G = (V, E) is a graph or multi-graph with |V|>=3, we say that G has a Hamiltonian cycle if there is a cycle in G that contains every vertex in V exactly once . ● Necessary and Sufficient Conditions: Condition for Hamiltonian based on Linear Diophantine Equation Systems with Cycle Vector, 2009 3rd Intl. Conf. on Genetic and Evolutionary Computing . ● Hamiltonian Path: A Hamiltonian path is a path (and not a cycle) in G that contains each vertex. It is possible, however, for a graph to have a Hamiltonian path without having a Hamiltonian cycle. Hamiltonian path having a cycle Hamiltonian cycle .
  • 7. Graph contains Hamiltonian path but not cycle.Exampl e
  • 8. Some Interesting Facts about Hamiltonian cycle : ● Every complete graph with more then two vertices is hamiltonian graph . Definition of complete graph: In a undirected simple graph every pair of a graph is connected with a unique pair. ● If G=(V,E) has a hamiltonian cycle then for all v ∈ V , deg(v)>=2. ● If a ∈ V and deg(a)=2 then two edge incident with vertex a must appear in every hamiltonian cycle. ● There is no know particular condition which are both necessary and sufficient.
  • 9. ● So we can define the hamiltonian-cycle problem, “Does a graph G have a hamiltonian cycle?” as a formal language: “A graph contains hamiltonian cycle if it is hamiltonian graph .” ● So how might an algorithm decide the language HAM-CYCLE? Naive - Solution : one possible decision algorithm lists all permutations of the vertices of G and then checks each permutation to see if it is a hamiltonian path. What is the running time of this algorithm? If we use the “reasonable” encoding of a graph as its adjacency matrix, the number m of vertices in the graph is Ω√ n , where n= length of the encoding of G. There are m! possible permutations of vertices ,and therefore the running time is
  • 10. Ωm! =Ω(√ n !)=Ω(2√ n), which is not O(nk )for any constant k. Thus, this naive algorithm does not run in polynomial time. In fact, the hamiltonian-cycle problem is NP-complete,
  • 12. Verification Algorithms ● What is verification of Algorithms? ● Verification algorithm: two argument algorithm A where x is ordinary string and y is a binary string called certificate. Hamiltonian Algorithm Given: Vertices in order. And a graph G such that G is a hamiltonian. Proof: Check whether it is a permutation of vertices of V, and whether each of the edge exists in the graph. We can do this in O(n^2) time where n is length of encoding of G. Thus, a proof that a hamiltonian cycle exists in a graph can be verified in polynomial time.
  • 13. Complexity Class NP ● What is NP complexity class Class of language that can be verified in a polynomial time algorithm. ● What is P class? Problems that are solvable in polynomial time, i.e. these problems can be solved in time O(n^k) in worst-case, where k is constant. ● Hamiltonian Cycle is a NP complete problem. ● If L belongs to P then L belongs to NP. P is a subset of NP. ● Areas of Research It is not known whether P=NP. It is also unknown that whether NP is closed under complement i.e if L belongs to NP does it imply complement(L) belongs to NP?
  • 14. These are four possibilities for relationship among complexity classes.
  • 17. Algorithm NextVertex(k) { do { x[k]=(x[k]+1)mod(n+1); if(x[k]==0) return ; if(G[k[k-1],x[k] !=0) { for j=1 to k-1 do if(x[j] == x[k]) break; if(j==k) if(k<n or (k==n) && G[x[n],x[1]] !=0 return ; } while(ture); }
  • 19. Graph has Hamiltonian Cycles: 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 1 1 -> 2 -> 6 -> 5 -> 4 -> 3 -> 1 1 -> 6 -> 2 -> 5 -> 4 -> 3 -> 1 … 2 -> 3 -> 4 -> 5 -> 6 -> 1 -> 2
  • 20.
  • 22. 0 1 1 0 1 1 0 1 1 1 1 1 0 1 0 0 1 1 0 1 1 1 0 1 0 Adjacency Matrix X 1 2 3 4 5

Editor's Notes

  1. Important points: Graph given may be directed or undirected but must be connected (if it not connected then cycle isn’t possible This is a NP Hard problem ie. exponential time taking problem so no easy way to find Hamiltonian cycle present or not. Show above example that we can have many hamiltonian cycles in a graph. So the problem is we’ve to find all possible cycles in a graph.
  2. If there’s articulation point then Hamiltonian Cycle isn’t possible. Also if there’s Pendant Vertices then Hamiltonian Cycle isn’t possible.