public class TopologicalSort
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
TopologicalSort.DirectedGraph<T> |
Constructor and Description |
---|
TopologicalSort() |
Modifier and Type | Method and Description |
---|---|
static <T> void |
explore(T node,
TopologicalSort.DirectedGraph<T> graph,
java.util.List<T> sortedResult,
java.util.Set<T> visitedNodes,
java.util.Set<T> expandedNodes) |
static <T> TopologicalSort.DirectedGraph<T> |
reverse(TopologicalSort.DirectedGraph<T> graph) |
static <T> java.util.List<T> |
topologicalSort(TopologicalSort.DirectedGraph<T> graph)
Sort the input graph into a topologically sorted list
Uses the reverse depth first search as outlined in ...
|
public static <T> java.util.List<T> topologicalSort(TopologicalSort.DirectedGraph<T> graph)
graph
- public static <T> TopologicalSort.DirectedGraph<T> reverse(TopologicalSort.DirectedGraph<T> graph)
public static <T> void explore(T node, TopologicalSort.DirectedGraph<T> graph, java.util.List<T> sortedResult, java.util.Set<T> visitedNodes, java.util.Set<T> expandedNodes)