NodeNameType
- public interface DirectedNodeEdgeGraph<NodeNameType>
Modifier and Type | Method and Description |
---|---|
void |
addEdge(NodeNameType left,
NodeNameType right)
Adds a directed edge from left to right.
|
void |
addNode(NodeNameType node)
Adds the input node to the graph.
|
void |
clear()
Clears the graph back to the original, empty state
|
boolean |
containsNode(NodeNameType node)
Returns whether or not the graph contains the specified vertex.
|
Pair<java.lang.Integer,java.lang.Integer> |
getEdgeEndpointIds(int id)
Return the edge endpoints (by node id) for edge id (where id [0 ...
|
NodeNameType |
getNode(int id)
Returns the node label for the input id.
|
int |
getNodeId(NodeNameType node)
Returns the integer ID of the input node.
|
java.util.Collection<NodeNameType> |
getNodes()
Returns all of the nodes contained in the graph.
|
int |
getNumEdges()
Return the number of edges.
|
int |
getNumNodes()
Return the number of nodes
|
java.util.Collection<NodeNameType> |
getSuccessors(NodeNameType node)
Returns all the nodes this node connects to (outgoing edges only).
|
java.util.Collection<NodeNameType> getNodes()
int getNumNodes()
int getNumEdges()
void addEdge(NodeNameType left, NodeNameType right)
left
- The source of the edgeright
- The destination of the edgevoid addNode(NodeNameType node)
addEdge(Object, Object)
, it handles adding new nodes.node
- The node to add to the graphboolean containsNode(NodeNameType node)
node
- The node to check forjava.util.Collection<NodeNameType> getSuccessors(NodeNameType node)
node
- The node whose successors are requestedPair<java.lang.Integer,java.lang.Integer> getEdgeEndpointIds(int id)
id
- The edge idgetNode(int)
to determine which nodes these are (if you care)).NodeNameType getNode(int id)
getEdgeEndpointIds(int)
. If you pass in a bad id, an exception
will be thrown.id
- The node idint getNodeId(NodeNameType node)
getEdgeEndpointIds(int)
.node
- The node valuevoid clear()