Package pascal.taie.util.graph
Class TopoSorter<N>
java.lang.Object
pascal.taie.util.graph.TopoSorter<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
ConstructorDescriptionTopoSorter
(Graph<N> graph) TopoSorter
(Graph<N> graph, boolean reverse) TopoSorter
(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
-
TopoSorter
-
TopoSorter
-
TopoSorter
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.
-