Graph<DataT,NodeT> Class
- java.
lang. Object - com.
azure. resourcemanager. resources. fluentcore. dag. Graph<DataT,NodeT>
- com.
Type Parameters
- DataT
the type of the data stored in the graph's nodes
- NodeT
the type of the nodes in the graph
public class Graph<DataT,NodeT>
Type representing a directed graph data structure.
Each node in a graph is represented by Node<DataT,NodeT>
Field Summary
| Modifier and Type | Field and Description |
|---|---|
| protected Map<String,NodeT> |
nodeTable
the nodes in the graph. |
Constructor Summary
| Constructor | Description |
|---|---|
| Graph() |
Creates a directed graph. |
Method Summary
| 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()
Gets all nodes in the graph. |
| void |
visit(Graph.Visitor<Node<DataT,NodeT>> visitor)
Perform DFS visit in this graph. |
Methods inherited from java.lang.Object
Field Details
nodeTable
protected Map<String,NodeT> nodeTable
the nodes in the graph.
Constructor Details
Graph
public Graph()
Creates a directed graph.
Method Details
addNode
public void addNode(NodeT node)
Adds a node to this graph.
Parameters:
findPath
protected String findPath(String start, String end)
Find the path.
Parameters:
Returns:
getNodes
public Collection<NodeT> getNodes()
Gets all nodes in the graph.
Returns:
visit
public void visit(Graph.Visitor<Node<DataT,NodeT>> visitor)
Perform DFS visit in this graph.
The directed graph will be traversed in DFS order and the visitor will be notified as search explores each node and edge.
Parameters: