T - the type of node elements.
public class Graph<T> extends Object
| Constructor and Description |
|---|
Graph()
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEdge(T a, T b)
Add this edge to the graph.
|
void |
addNode(T node)
Add a node to the graph.
|
void |
addNodes(Set
Add all these nodes to the graph.
|
int |
degreeIn(T node)
Get the number of incoming edges.
|
int |
degreeOut(T node)
Get the number of outgoing edges.
|
Set |
getEdgesIn(T node)
Get all incoming edges (the nodes that can be reached via these edges).
|
Set |
getEdgesOut(T node)
Get all outgoing edges (the nodes that can be reached via these edges).
|
Collection |
getNodes()
Return the nodes of this graph.
|
Set |
getPartition()
Get a partition of the graph.
|
void |
removeAllNodes(Collection
Remove a collection of nodes from the graph.
|
void |
removeEdge(T a, T b)
Remove this edge from graph.
|
void |
removeNode(T node)
Remove a node from the graph.
|
public void addNode(T node)
node - the node to add.
public void removeNode(T node)
node - the node to remove.
public void removeAllNodes(Collection<T> toRemove)
toRemove - the nodes to remove.
public void addNodes(Set<T> nodesToAdd)
nodesToAdd - a set of nodes to add.
public void addEdge(T a, T b)
a - a node.
b - another node.
public void removeEdge(T a, T b)
a - a node.
b - another node.
public Collection<T> getNodes()
public Set<T> getEdgesOut(T node)
node - the node whose edges to get.
public Set<T> getEdgesIn(T node)
node - the node whose incoming edges to get.
public int degreeIn(T node)
node - the node.
public int degreeOut(T node)
node - the node.