Questions tagged [hamiltonian-cycle]

A Hamiltonian cycle is a cycle in a directed or undirected graph that visits each node/vertex exactly once.

115 questions
0
votes
1 answer

hamiltonian cycle python wrong answer

given n as number of nodes and edges as a list of edges can anyone tell me whats wrong with my code. It works on some instances but doesnt work for all of them for edgeindex in range(len(edges)): alltrue = [True]*(n) visited = [False]*(n) …
0
votes
1 answer

Hamiltonian path analysis

I was told that to figure out if a graph had a Hamiltonian path it would not be calculated in polynomial time. Let's assume that we CAN solve it in Polynomial time, how can I prove this? is it impossible since it is NP hard problem?
John Connor
  • 21
  • 1
  • 3
0
votes
2 answers

travelling sales man for an incomplete graph

i have a large weighted graph.i want to compute an approximate shortest hamiltonian path which goes through all nodes with the lowest cost. my graph is really big that it doesn't fit in my memory. so i decided to randomly ignore some edges and load…
0
votes
0 answers

Proof for hamiltonian cyclein grids having even no. of nodes

How can I go about proving that an undirected graph having even no. of nodes (at least one of the rows or columns are even - excluding line graphs of course) have a hamiltonian cycle? I have managed to come as far as to prove that it is a bipartite…
Zshn
  • 121
  • 1
  • 5
0
votes
1 answer

What is the complexity of the following algorithm?

This algorithm solves Hamiltonian path problem. G is a unoriented graph, v starting vertex, G.size() size of the graph, G.get(v).gV all the neighbor verices of the current vertex. static private void dfs(HashMap G, int v) { …
Justinas R.
  • 271
  • 1
  • 4
  • 17
-1
votes
1 answer

Finding Hamiltonian path and Hamiltonian cycle

I have a SimpleGraph in JGraphT and want to know if there is a Hamiltonian path a Hamiltonian cycle And if one exists I'd also like to get it. I only found TwoApproxMetricTSP and HamiltonianCycle. But both require complete graphs. One obvious…
Jens Schauder
  • 77,657
  • 34
  • 181
  • 348
-1
votes
1 answer

Algorithm for creating most efficient undirected Hamiltonian path

I am attempting to create an algorithm that creates a path that connects a graph of points together in the shortest/most efficient way, ensuring all points are connected and that each point has at most two connections. After doing some research, it…
Bill Peet
  • 477
  • 1
  • 8
  • 23
-2
votes
1 answer

On example where no Hamilton path is possible to make Hamilton cycle

https://www.youtube.com/watch?v=3xeYcRYccro&list=PLoJC20gNfC2gmT_5WgwYwGMvgCjYVsIQg&index=32 12:10 states that that example is a Hamilton path. This is an example to shew that a Hamilton path cannot make a Hamilton graph. Indeed all verteces are…
Versteher
  • 23
  • 5
-2
votes
1 answer

What is the total number of Hamiltonian circuits in a complete undirected graph when one or more edges must always be included?

For a complete undirected graph G where the vertices are indexed by [n] = {1,2,3,...,n} where n >= 4. I am aware that the total number of Hamiltonian Circuits in G is (n-1)! / 2 If we must traverse the edge {1,2}, how many Hamiltonian Circuits are…
-2
votes
2 answers

Hamiltonian Cycle algorithm

I was looking for some hamiltonian cycle algorithms, but I can't find any implementations, not even a single pseudo-code ! I don't even need to output the cycle, just check if the graph has one. The input is a graph with V vertices and E edges.…
user2943215
1 2 3 4 5 6 7
8