Package pascal.taie.util.graph
Class TopologicalSorter<N>
java.lang.Object
pascal.taie.util.graph.TopologicalSorter<N>
- Type Parameters:
N
- type of nodes
Topologically sorts a directed graph using DFS.
It is assumed that the given graph is a direct acyclic graph (DAG).
-
Constructor Summary
ConstructorDescriptionTopologicalSorter
(Graph<N> graph) TopologicalSorter
(Graph<N> graph, boolean reverse) TopologicalSorter
(Graph<N> graph, List<N> preservedOrder) Computes a topological soring of a graph, while the client code wishes to preserve some ordering in the sorting result. -
Method Summary
-
Constructor Details
-
TopologicalSorter
-
TopologicalSorter
-
TopologicalSorter
Computes a topological soring of a graph, while the client code wishes to preserve some ordering in the sorting result. If preserved order conflicts the topological order, the latter is respected.- Parameters:
graph
- the graphpreservedOrder
- the order of the nodes that the client code wishes to preserve
-
-
Method Details
-
get
- Returns:
- the topologically sorted list.
-