Method TopologicalSort
TopologicalSort<TNodeValue, TEdgeLabel>(DirectedGraph<TNodeValue, TEdgeLabel>)
Traverses through all the directed graph nodes in such a way as to guarantee that for every node in the sequence, all its predecessors have been visited first.
public static IEnumerable<Node<TNodeValue, TEdgeLabel>> TopologicalSort<TNodeValue, TEdgeLabel>(this DirectedGraph<TNodeValue, TEdgeLabel> source)
Parameters
source
DirectedGraph<TNodeValue, TEdgeLabel>The source directed graph that will be traversed.
Returns
- IEnumerable<Node<TNodeValue, TEdgeLabel>>
A sequence containing the set of all graph nodes in topological sort order.
Type Parameters
TNodeValue
The type of the labels associated with graph nodes.
TEdgeLabel
The type of the labels associated with graph edges.