113 questions
0 votes
1 answer
181 views
Determining Eulerian Cycle in Multigraph for Christofides Algorithm
I'm implementing the Christofides algorithm for solving the Traveling Salesman Problem and have reached the step where I need to find an Eulerian cycle in a multigraph. I'm unsure how to proceed when ...
3 votes
3 answers
219 views
How to find the Longest Snake in a Matrix
Imagine we have a snake contained in a matrix that is matrix[a][b]: it is a tall and b wide. Cells in the matrix can be considered neighbors if they are directly, above, below, or to the left or right ...
1 vote
0 answers
116 views
How do I find a Hamiltonian Cycle in a Graph in C# when some nodes branch to a connected loop of nodes?
I have this graph: The starting node is Hotel and I want the program to find paths for all valid Hamiltonian cycles. But I cannot seem to get the code to work despite following examples of the ...
0 votes
1 answer
70 views
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 ...
1 vote
1 answer
299 views
Solving Hamiltonian cycle in answer set programming
Hamiltonian cycle instantiation and encoding: % vertices: n=node n(1..4). % edges: e=edge e(1,(2;3)). e(2,(3;4)). e(3,(1;4)). e(4,1). % starting point s(1). # p=path, o=omit, op=on-path, r=reach, s=...
3 votes
3 answers
258 views
How can I plot a Hamiltonian graph in R?
I have the following undirected graph (picture) that contains a cycle or a Hamiltonian path of length |V|= 8. The cycle (path) with no repeated edges and vertices is the red line. The adjacency matrix ...
0 votes
0 answers
111 views
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 ...
0 votes
2 answers
1k views
Find the final path of Traveling Salesman Problem
I am trying to implement the Traveling Salesman Problem and I need to return the path that lead to the minimum cost. I have a distance matrix, and this is the code: static int TSP(int[][] distance, ...
0 votes
0 answers
229 views
Why cant we use algorithm to find all cycles to find an hamiltonian cycle?
I recently came across algorithms to find all cycles in an undirected graph, and was confused when i saw that they are running linear time (example), It seem easy to use one of these to find hamilton ...
0 votes
0 answers
136 views
How to calculate all possible cycles (all nodes must be visited once) on a graph? Hamilton circle
I am trying to write a program which outputs all possible cycles starting and ending with node 1 and visiting all other nodes exactly once. Given is a complete undirected unweighted graph with N nodes....
2 votes
0 answers
354 views
Can we find a Hamiltonian Cycle in a dense graph with better than O(n^2)?
Given a dense graph (according to ore's theorem, dense means the sum of degrees of any 2 non-adjacent nodes is at least N, where N is the total number of nodes), we can find a Hamiltonian cycle in ...
1 vote
1 answer
54 views
The vertices of an undirected graph are numbered 1,2,...4286. The edge (i,j) exists if |i-j| <= 3, where i!=j. Which statements are true?
The vertices of an undirected graph are numbered 1,2,...4286. The edge (i,j) exists if |i-j| <= 3, where i!=j. Which statements are true? the graph contains an Eulerian circle the graph contains a ...
0 votes
2 answers
2k views
What is the minimum degree of vertex required for each vertex to have a Hamiltonian cycle?
I googled it and found: If G = (V,E) has n ≥ 3 vertices and every vertex has degree ≥ n/2 then G has a Hamilton circuit. But my question is if the degree of each vertex is 2 or more, then the graph ...
0 votes
1 answer
212 views
Removing a1 field from chess board in Clingo knight path program
I need to do some symulations about knight path and Hamilton cycle on chesseboard, but i wondering what if i exclude some fields from chesseboard xchessboard(1..8). ychessboard(1..8). time(1..8*8+1). ...
0 votes
1 answer
915 views
An efficient Algorithm for Hamiltonian circuit
I recently discovered the Hamiltonian Path/Circuit in CodeBullet's Snake A.I. video and decided to give it a go myself. I wrote a basic Depth First Search algorithm to visit all the nodes in a graph ...