Hamiltonian Path
Learned in MATH239 - Introduction to Combinatorics used in CS341.
For clarification, is a Hamiltonian path a path that visits every vertex of graph only once?
Yes, where each vertex in the path is visited only once.
Checking the existence of a Hamiltonian path is NP-Hard problem, and no efficient algorithm is known for solving the problem.
Hamiltonian Cycle
A Hamiltonian cycle, is a special case of a Hamiltonian path, where the starting and ending vertices are the same, forming a cycle.
The hamiltonian cycle problem is NP-Complete.
Hamiltonian Cycle
A cycle that is a spanning subgraph (i.e., visits all vertices) is called a Hamiltonian cycle.
Determining if a graph has a Hamiltonian cycle or not is in general very difficult - NP-Complete.
Hamiltonian Path in a DAG: Given a directed acyclic graph G, give an algorithm that checks if G has a Hamiltonian path.
Solution: Perform a topological sort on G, and check if is an edge for every . This is the only possible hamiltonian path, since there can be no edges going backwards in this order.
Another question:
Apparently is always a DAG. Start with a graph , next compute the SCCs of . We construct a graph , whose vertex set is the SCCs of , and we add a directed edge from an SCC to an SCC if and only if there exist vertices such that is an edge in . The claim is that is a DAG.