N - Node parameter typeV - Value parameter typefinal class UndirectedGraphConnections<N,V> extends java.lang.Object implements GraphConnections<N,V>
GraphConnections for undirected graphs.| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<N,V> |
adjacentNodeValues |
| Modifier | Constructor and Description |
|---|---|
private |
UndirectedGraphConnections(java.util.Map<N,V> adjacentNodeValues) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPredecessor(N node,
V value)
Add
node as a predecessor to the origin node. |
V |
addSuccessor(N node,
V value)
Add
node as a successor to the origin node. |
java.util.Set<N> |
adjacentNodes() |
java.util.Iterator<EndpointPair<N>> |
incidentEdgeIterator(N thisNode)
Returns an iterator over the incident edges.
|
(package private) static <N,V> UndirectedGraphConnections<N,V> |
of(ElementOrder<N> incidentEdgeOrder) |
(package private) static <N,V> UndirectedGraphConnections<N,V> |
ofImmutable(java.util.Map<N,V> adjacentNodeValues) |
java.util.Set<N> |
predecessors() |
void |
removePredecessor(N node)
Remove
node from the set of predecessors. |
V |
removeSuccessor(N node)
Remove
node from the set of successors. |
java.util.Set<N> |
successors() |
V |
value(N node)
Returns the value associated with the edge connecting the origin node to
node, or null
if there is no such edge. |
static <N,V> UndirectedGraphConnections<N,V> of(ElementOrder<N> incidentEdgeOrder)
static <N,V> UndirectedGraphConnections<N,V> ofImmutable(java.util.Map<N,V> adjacentNodeValues)
public java.util.Set<N> adjacentNodes()
adjacentNodes in interface GraphConnections<N,V>public java.util.Set<N> predecessors()
predecessors in interface GraphConnections<N,V>public java.util.Set<N> successors()
successors in interface GraphConnections<N,V>public java.util.Iterator<EndpointPair<N>> incidentEdgeIterator(N thisNode)
GraphConnectionsincidentEdgeIterator in interface GraphConnections<N,V>thisNode - The node that this all of the connections in this class are connected to.@CheckForNull public V value(N node)
GraphConnectionsnode, or null
if there is no such edge.value in interface GraphConnections<N,V>public void removePredecessor(N node)
GraphConnectionsnode from the set of predecessors.removePredecessor in interface GraphConnections<N,V>@CheckForNull public V removeSuccessor(N node)
GraphConnectionsnode from the set of successors. Returns the value previously associated with
the edge connecting the two nodes.removeSuccessor in interface GraphConnections<N,V>public void addPredecessor(N node, V value)
GraphConnectionsnode as a predecessor to the origin node. In the case of an undirected graph, it
also becomes a successor. Associates value with the edge connecting the two nodes.addPredecessor in interface GraphConnections<N,V>@CheckForNull public V addSuccessor(N node, V value)
GraphConnectionsnode as a successor to the origin node. In the case of an undirected graph, it also
becomes a predecessor. Associates value with the edge connecting the two nodes. Returns
the value previously associated with the edge connecting the two nodes.addSuccessor in interface GraphConnections<N,V>