<Li> p (v) ← u . </Li> <P> On a graph of n vertices and m edges, this algorithm takes Θ (n + m), i.e., linear, time . </P> <P> If a topological sort has the property that all pairs of consecutive vertices in the sorted order are connected by edges, then these edges form a directed Hamiltonian path in the DAG . If a Hamiltonian path exists, the topological sort order is unique; no other order respects the edges of the path . Conversely, if a topological sort does not form a Hamiltonian path, the DAG will have two or more valid topological orderings, for in this case it is always possible to form a second valid ordering by swapping two consecutive vertices that are not connected by an edge to each other . Therefore, it is possible to test in linear time whether a unique ordering exists, and whether a Hamiltonian path exists, despite the NP - hardness of the Hamiltonian path problem for more general directed graphs (Vernet & Markenzon 1997). </P> <P> Topological orderings are also closely related to the concept of a linear extension of a partial order in mathematics . </P>

When does a directed graph have a unique topological ordering
find me the text answering this question