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
0 answers

Longest path algorithm with "can" have loop and negative edge in certain amount step

I've done my own research ,However I couldn't find a proper solution for my demand. The problem is , I have a truck which needs to spend it's load(let's say garbage). There are cities(node) and edges(way) which can be positive edge or negative .…
Ozan
  • 41
  • 2
  • 7
0
votes
1 answer

Problem in finding Hamiltonian circuit for TSP problem

Hi there Im working on a project which needs to solve the TSP problem. The thing i need here is that how i can find the Hamiltonian circuits in the graph. In fact I know how to do this in the real world. But in the implementation and on the source…
user435245
  • 859
  • 4
  • 16
  • 28
0
votes
1 answer

Finding path that visits all vertices of a directed graph exactly once

Given a directed graph, what is an algorithm that visits each and every vertex of the graph, only once. This is different from Hamiltonian cycle, in that, I don't require the path to start and end at the same vertex. Backtracking Algorithm One…
0
votes
1 answer

JGrapht: Hamiltonian Cycle Program returns getEdgeWeightException

I've been working on this piece of code where i'll need to create a dynamic complete graph and try to find the shortest path from the start vertex to the end by visiting each vertex once. After some research I've found the code for the Hamiltonian…
0
votes
0 answers

Hamiltonian Path + Topological Sort

I know that if a topological sort has the property that all pairs of consecutive vertices in the sorted order are connected by edges, then the topological sort order is unique. My problem is that I can't implement it in C++, especially in the…
0
votes
1 answer

Is there an algorithm for computing permutation of distances?

This is related to travelling salesman problem. First all permutations need to be generated and then the destination (same as origin) attached. I.e.: 1) abcd abdc .... 2) abcda abdca ....a I have all the distances and only need an algorithm to sum…
0
votes
2 answers

Show a complete graph with n vertices, the weight of a MST is less than or equal to the min weight of cycle that passes through all vertices

I am really struggling with this proof and would really appreciate a detailed explanation: Show a complete graph with n vertices, the weight of a MST is less than or equal to the min weight of cycle that passes through all vertices (also called a…
Chad
  • 185
  • 1
  • 11
0
votes
0 answers

Polynomial reduction of Hamiltonian path to cycle and cycle to path

I need to show that given undirected graph G, Hamiltonian path and Hamiltonian cycle are polynomial time reducible to each other. Here is my reduction, is this correct? For Cycle to Path For a vertex v belonging to V, add a vertex v’ and for all…
Saik
  • 993
  • 1
  • 16
  • 40
0
votes
0 answers

Let G be a simple graph that is not a forest and has girth ≥5. Prove that the complement of G is Hamiltonian

Let G be a simple graph that is not a forest and has girth ≥5. Prove that the complement of G is Hamiltonian . girth is the shortest cycle in the graph . and forest is a graph which does not have any cycles. so G has at least one cycle with the…
Moniba
  • 789
  • 10
  • 17
0
votes
1 answer

travelling salesman local search heuristic

I am trying to create a local search heuristic to solve the TSP, and this process seems to be failing. I have generated a random Hamiltonian cycle and stored it in outgoing[] with outgoing[i] denoting the vertex which one of the edges originating at…
0
votes
0 answers

hamiltonian cycle in a group

The group elements are generated by (g, 1, 1, ...), (1, g, 1, ... ), (1, 1, g, ...) ... that is have a form (g^i1, g^i2, ... ) where g^p = 1 for some p. There is an edge between elements in the group where elements at some index have powers of g…
iggy
  • 1,613
  • 1
  • 18
  • 35
0
votes
1 answer

prove connected graph with degree = 2 has hamiltonian cycle

excuse me if my question is repeated but i couldn't find a complete answer to prove that a connected graph which all vertices has degree = 2 is a hamiltonian graph. I have read this and this
user3070752
  • 694
  • 4
  • 23
0
votes
0 answers

Time complexity for hamiltonian path

below is the code to find if a Hamiltonian path exist in a graph using backtracking. And as per the code below time complexity comes out to be O(V^2), where V is total number to vertices. But Hamiltonian problem is NP-Complete. which as per my…
0
votes
0 answers

Travelling salesman (with predefined edges) heuristics?

I'm looking for an algorithm that is faster than exponential which will find ANY cycle in a traveling salesman problem. It doesn't matter how bad the cycle is, it just needs to be a cycle. What I'm really looking for, then, is an algorithm for a…
user1472747
  • 529
  • 3
  • 10
  • 25
0
votes
1 answer

Hamiltonian cycles in graphs of order n = 1 mod 4, (n-1)/2-regular?

Consider a graph of order n where n is 1 mod 4 (I.E. pentagons, nonagons, etc.), and suppose it is a (n-1)/2-regular graph. Also (potentially optionally) suppose that both it and its complement are connected. Can this type of graph be verified to be…
user3537932
  • 153
  • 1
  • 11