N
- Node parameter typeE
- Edge parameter typeabstract class AbstractDirectedNetworkConnections<N,E> extends java.lang.Object implements NetworkConnections<N,E>
NetworkConnections
for directed networks.Modifier and Type | Field and Description |
---|---|
protected java.util.Map<E,N> |
inEdgeMap
Keys are edges incoming to the origin node, values are the source node.
|
protected java.util.Map<E,N> |
outEdgeMap
Keys are edges outgoing from the origin node, values are the target node.
|
private int |
selfLoopCount |
Modifier | Constructor and Description |
---|---|
protected |
AbstractDirectedNetworkConnections(java.util.Map<E,N> inEdgeMap,
java.util.Map<E,N> outEdgeMap,
int selfLoopCount) |
Modifier and Type | Method and Description |
---|---|
void |
addInEdge(E edge,
N node,
boolean isSelfLoop)
Add
edge to the set of incoming edges. |
void |
addOutEdge(E edge,
N node)
Add
edge to the set of outgoing edges. |
java.util.Set<N> |
adjacentNodes() |
java.util.Set<E> |
incidentEdges() |
java.util.Set<E> |
inEdges() |
N |
oppositeNode(java.lang.Object edge)
Returns the node that is opposite the origin node along
edge . |
java.util.Set<E> |
outEdges() |
N |
removeInEdge(java.lang.Object edge,
boolean isSelfLoop)
Remove
edge from the set of incoming edges. |
N |
removeOutEdge(java.lang.Object edge)
Remove
edge from the set of outgoing edges. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
edgesConnecting, predecessors, successors
protected final java.util.Map<E,N> inEdgeMap
protected final java.util.Map<E,N> outEdgeMap
private int selfLoopCount
public java.util.Set<N> adjacentNodes()
adjacentNodes
in interface NetworkConnections<N,E>
public java.util.Set<E> incidentEdges()
incidentEdges
in interface NetworkConnections<N,E>
public java.util.Set<E> inEdges()
inEdges
in interface NetworkConnections<N,E>
public java.util.Set<E> outEdges()
outEdges
in interface NetworkConnections<N,E>
public N oppositeNode(java.lang.Object edge)
NetworkConnections
edge
.
In the directed case, edge
is assumed to be an outgoing edge.
oppositeNode
in interface NetworkConnections<N,E>
public N removeInEdge(java.lang.Object edge, boolean isSelfLoop)
NetworkConnections
edge
from the set of incoming edges. Returns the former predecessor node.
In the undirected case, returns null
if isSelfLoop
is true.
removeInEdge
in interface NetworkConnections<N,E>
public N removeOutEdge(java.lang.Object edge)
NetworkConnections
edge
from the set of outgoing edges. Returns the former successor node.removeOutEdge
in interface NetworkConnections<N,E>
public void addInEdge(E edge, N node, boolean isSelfLoop)
NetworkConnections
edge
to the set of incoming edges. Implicitly adds node
as a predecessor.addInEdge
in interface NetworkConnections<N,E>
public void addOutEdge(E edge, N node)
NetworkConnections
edge
to the set of outgoing edges. Implicitly adds node
as a successor.addOutEdge
in interface NetworkConnections<N,E>