Package com.google.common.graph
Class AbstractDirectedNetworkConnections<N,E>
- java.lang.Object
-
- com.google.common.graph.AbstractDirectedNetworkConnections<N,E>
-
- Type Parameters:
N- Node parameter typeE- Edge parameter type
- All Implemented Interfaces:
NetworkConnections<N,E>
- Direct Known Subclasses:
DirectedMultiNetworkConnections,DirectedNetworkConnections
abstract class AbstractDirectedNetworkConnections<N,E> extends java.lang.Object implements NetworkConnections<N,E>
A base implementation ofNetworkConnectionsfor directed networks.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<E,N>inEdgeMapKeys are edges incoming to the origin node, values are the source node.protected java.util.Map<E,N>outEdgeMapKeys are edges outgoing from the origin node, values are the target node.private intselfLoopCount
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractDirectedNetworkConnections(java.util.Map<E,N> inEdgeMap, java.util.Map<E,N> outEdgeMap, int selfLoopCount)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInEdge(E edge, N node, boolean isSelfLoop)Addedgeto the set of incoming edges.voidaddOutEdge(E edge, N node)Addedgeto the set of outgoing edges.NadjacentNode(E edge)Returns the node that is adjacent to the origin node alongedge.java.util.Set<N>adjacentNodes()java.util.Set<E>incidentEdges()java.util.Set<E>inEdges()java.util.Set<E>outEdges()NremoveInEdge(E edge, boolean isSelfLoop)Removeedgefrom the set of incoming edges.NremoveOutEdge(E edge)Removeedgefrom the set of outgoing edges.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.common.graph.NetworkConnections
edgesConnecting, predecessors, successors
-
-
-
-
Field Detail
-
inEdgeMap
protected final java.util.Map<E,N> inEdgeMap
Keys are edges incoming to the origin node, values are the source node.
-
outEdgeMap
protected final java.util.Map<E,N> outEdgeMap
Keys are edges outgoing from the origin node, values are the target node.
-
selfLoopCount
private int selfLoopCount
-
-
Method Detail
-
adjacentNodes
public java.util.Set<N> adjacentNodes()
- Specified by:
adjacentNodesin interfaceNetworkConnections<N,E>
-
incidentEdges
public java.util.Set<E> incidentEdges()
- Specified by:
incidentEdgesin interfaceNetworkConnections<N,E>
-
inEdges
public java.util.Set<E> inEdges()
- Specified by:
inEdgesin interfaceNetworkConnections<N,E>
-
outEdges
public java.util.Set<E> outEdges()
- Specified by:
outEdgesin interfaceNetworkConnections<N,E>
-
adjacentNode
public N adjacentNode(E edge)
Description copied from interface:NetworkConnectionsReturns the node that is adjacent to the origin node alongedge.In the directed case,
edgeis assumed to be an outgoing edge.- Specified by:
adjacentNodein interfaceNetworkConnections<N,E>
-
removeInEdge
public N removeInEdge(E edge, boolean isSelfLoop)
Description copied from interface:NetworkConnectionsRemoveedgefrom the set of incoming edges. Returns the former predecessor node.In the undirected case, returns
nullifisSelfLoopis true.- Specified by:
removeInEdgein interfaceNetworkConnections<N,E>
-
removeOutEdge
public N removeOutEdge(E edge)
Description copied from interface:NetworkConnectionsRemoveedgefrom the set of outgoing edges. Returns the former successor node.- Specified by:
removeOutEdgein interfaceNetworkConnections<N,E>
-
addInEdge
public void addInEdge(E edge, N node, boolean isSelfLoop)
Description copied from interface:NetworkConnectionsAddedgeto the set of incoming edges. Implicitly addsnodeas a predecessor.- Specified by:
addInEdgein interfaceNetworkConnections<N,E>
-
addOutEdge
public void addOutEdge(E edge, N node)
Description copied from interface:NetworkConnectionsAddedgeto the set of outgoing edges. Implicitly addsnodeas a successor.- Specified by:
addOutEdgein interfaceNetworkConnections<N,E>
-
-