public class Graph<T> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Graph.Node<T> |
Modifier and Type | Field and Description |
---|---|
protected Map<T,Graph.Node<T>> |
nodes
Map from node payload to node containing it
|
Constructor and Description |
---|
Graph() |
Modifier and Type | Method and Description |
---|---|
void |
addEdge(T a,
T b) |
void |
DFS(Graph.Node<T> n,
Set<Graph.Node<T>> visited,
ArrayList<T> sorted) |
protected Graph.Node<T> |
getNode(T a) |
List<T> |
sort()
DFS-based topological sort.
|
protected Map<T,Graph.Node<T>> nodes
protected Graph.Node<T> getNode(T a)
public List<T> sort()
public void DFS(Graph.Node<T> n, Set<Graph.Node<T>> visited, ArrayList<T> sorted)
Copyright © 1992–2020 ANTLR. All rights reserved.