Unique Topological sorting implies hamiltonian path exists

4.1k views Asked by At

In a DAG ,to find a hamiltonian path ,first topologocal sorting is found out and then hamiltonian path is found from the topological sort.

Hamiltonian path in a DAG exists if and only if there is unique topological sorting.

How do we justify this statement?

1

There are 1 answers

0
user3553836 On

Suppose there is a dag,We first topologically sort it.For this dag to have a hamiltonian path every vertex must be connected to next vertex in topological order,because if it is not connected that way it won't have a hamiltonian path(we can't visit every vertex starting from anywhere). and if every vertex is connected to next vertex in topological order than there can't exist any other topological ordering.I hope it helps.