A Hamiltonian cycle is a cycle in a directed or undirected graph that visits each node/vertex exactly once.
Questions tagged [hamiltonian-cycle]
115 questions
1
vote
1 answer
Draw a 7 vertex simple graph with exactly 1800 hamiltonian paths
I came across this question while preparing for an exam on my course in 'Introduction to Graph Theory'. I would greatly appreciate if someone gives the methodology to approach such a question (where you specify the number of vertices and Hamiltonian…

Chaitanya
- 147
- 1
- 11
1
vote
0 answers
Finding one Hamiltonian cycle in graph error
I have a program in C which reads definition of graph from file, search for Hamiltonian cycle (only one) and prints it on screen if found. Problem is that program is crashing when I'm trying to find cycle in graphs with 30 and more vertices (for 30…

LislaV
- 57
- 1
- 5
1
vote
1 answer
is there a hamiltonian circuit in the graph in the link below?
Like the question says in the image in the link.
Is there a hamilton circuit in the graph above ?
i found some hamilton path like :
c - b - a -j - i - h - f - e - d - g
But no hamilton circuit
I cant add the picture in here since stackoverflow…

nff21
- 45
- 7
1
vote
1 answer
hamiltonian Path of an Obstructed Grid and Python Recursion Limts
I am attempting to find any Hamiltonian paths in a given grid, which contains obstacles at various nodes. My issue is that my code has been running for days now and has yet to come to an end. While this problem is in the NP-Complete region, from…

user3412893
- 11
- 1
1
vote
2 answers
Knight's tour backtrack implementation choosing the step array
So I came up with this implementation for solving knights tour for a 8*8 chess board.
But seems like it is taking a long time running (so long that I have to stop it). But if I replace the dx, dy arrays with the one written in comments and the…

Jignesh
- 555
- 1
- 8
- 18
1
vote
2 answers
Hamilton path finding with the use of hamilton cycle function and the opposite task
The problem is testing whether a graph G contains a Hamiltonian path or not with the one use of hamiltonian cycle Hcycle(V,E) function which gives output true of false whether the G contains Hamiltonian cycle.
I must write a program with polynomial…

Serillan
- 227
- 2
- 8
1
vote
2 answers
what whould be suitable algorithm?
I am trying to do c++ program.I am trying to do problem in which i have numbers of points. Now i need to find the path that goes through all the points. This is not actually TSP because as per my knowledge in TSP it is possible to travel from all…

user1869698
- 21
- 1
1
vote
0 answers
hamiltonian cycle v^2 algorithm?
Is there a algorithm that will find as long as possible hamiltonian cycles in v^2 time. I am running a program that needs to find cycles on a sparse graph (4v edges at maximum), and according to my calculations, I need v^2 or better. I understand…

matts1
- 857
- 1
- 9
- 20
0
votes
2 answers
Given some words, find a sequence such that any adjacent words of the seq cannot have same characters
Given some words,
e.g.
banana , cat , dog, elephant, type, middle, lake
find a sequence such that
(1) every word is on the sequence
(2) any adjacent words cannot have same characters.
If the seq cannot be found, return false. otherwise, return…

user1002288
- 4,860
- 10
- 50
- 78
0
votes
1 answer
Couldn't get the required correct output
I'm trying to solve the Hamiltonial cycle and path problem using backtracking method whether a source vertex is given for the input graph. When all the vertex are visited in that input graph, then the path will be displayed. Using backtracking…
0
votes
0 answers
Hamiltonian Cycle using iterative approach (DFS?)
I am trying to implement backtracking algorithm of finding a Hamiltonian Cycle - using stack instead of recursion, like in DFS. However, I can't figure out how to implement backtracking properly. The problem with my code is that at some point when…

Alex Ruby
- 11
- 1
0
votes
0 answers
Cannot assign variables inside backtracking base condition
I want to implement a backtrack algorithm to find a minimum hamiltonian path, but I ran into a question: why I cannot assign a variable to a value inside the "if" in the code below?
cycle = [0]
start = 0
visited = set()
num_nodes =…

rnst
- 1
- 1
0
votes
0 answers
Find all Hamiltonian cycles
n person will go to a meeting. The meeting will be happen once a day and everybody will sit around a round table. The question is how many days have to arrange each day and how to arrange so that each person will have two people next to them who are…

Dekunotstupid
- 11
- 3
0
votes
0 answers
Is the complexity of the seating problem equal to a similar Hamiltonian circuit (cycle)?
You would have to convert an instance of the seating problem to an instance of Hamiltonian circuit (cycle). Does this mean in terms of complexity if one takes a certain complexity it cannot be guaranteed that the respective other could be completed…

Nathan
- 1
- 1
0
votes
0 answers
Travelling Salesman Problem, It takes so long to implement
I got Travelling Salesman Problem code from geeksforgeeks website ( https://www.geeksforgeeks.org/traveling-salesman-problem-tsp-implementation/ ) and try to implemented on 26 different city, but when I run the code it takes forever to show the…

Mr.ZeroX
- 1
- 2