You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Andrey Vernigora edited this page Feb 2, 2019
·
3 revisions
Topological Sort
This algorithm creates an linear ordering of the vertices (or edges) in a Directed Acyclic Graph such that each vertex comes before its outbound vertices. A typical example of the topological sort is the build dependencies ordering.
The topological sort is simply computed using the TopologicalSortAlgorithm class, which uses the DepthFirstSearchVertexAlgorithm internally.
TopologicalSort is an extension method of AlgorithmExtensions to simplify this task:
IVertexListGraph<Vertex,Edge>g;// iterating over the sorted verticesforeach(Vertexving.TopologicalSort()){…}
QuickGraph contains a second topological sort algorithm that sorts vertices by increasing in-degree such that source vertices are taken first. It is implemented by SourceFirstTopologicalSortAlgorithm and wrapped by the extension method AlgoExtensions.SourceFirstTopologicalSort.