DataT - the type of the data stored in the graph's nodesNodeT - the type of the nodes in the graphpublic class Graph<DataT,NodeT extends Node<DataT,NodeT>> extends Object
Each node in a graph is represented by Node
| Modifier and Type | Class and Description |
|---|---|
protected static class |
Graph.EdgeType
The edge types in a graph.
|
protected static interface |
Graph.Visitor<U>
Represents a visitor to be implemented by the consumer who want to visit the
graph's nodes in DFS order by calling visit method.
|
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,NodeT> |
nodeTable
the nodes in the graph.
|
| Constructor and Description |
|---|
Graph()
Creates a directed graph.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNode(NodeT node)
Adds a node to this graph.
|
protected String |
findPath(String start,
String end)
Find the path.
|
Collection<NodeT> |
getNodes() |
void |
visit(Graph.Visitor<Node<DataT,NodeT>> visitor)
Perform DFS visit in this graph.
|
public Collection<NodeT> getNodes()
public void addNode(NodeT node)
node - the nodepublic void visit(Graph.Visitor<Node<DataT,NodeT>> visitor)
The directed graph will be traversed in DFS order and the visitor will be notified as search explores each node and edge.
visitor - the graph visitorCopyright © 2021 Microsoft Corporation. All rights reserved.