Package com.google.common.graph
Class DirectedMultiNetworkConnections<N,E>
- java.lang.Object
-
- com.google.common.graph.AbstractDirectedNetworkConnections<N,E>
-
- com.google.common.graph.DirectedMultiNetworkConnections<N,E>
-
- Type Parameters:
N
- Node parameter typeE
- Edge parameter type
- All Implemented Interfaces:
NetworkConnections<N,E>
final class DirectedMultiNetworkConnections<N,E> extends AbstractDirectedNetworkConnections<N,E>
An implementation ofNetworkConnections
for directed networks with parallel edges.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.ref.Reference<Multiset<N>>
predecessorsReference
private java.lang.ref.Reference<Multiset<N>>
successorsReference
-
Fields inherited from class com.google.common.graph.AbstractDirectedNetworkConnections
inEdgeMap, outEdgeMap
-
-
Constructor Summary
Constructors Modifier Constructor Description private
DirectedMultiNetworkConnections(java.util.Map<E,N> inEdges, java.util.Map<E,N> outEdges, int selfLoopCount)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addInEdge(E edge, N node, boolean isSelfLoop)
Addedge
to the set of incoming edges.void
addOutEdge(E edge, N node)
Addedge
to the set of outgoing edges.java.util.Set<E>
edgesConnecting(N node)
Returns the set of edges connecting the origin node tonode
.private static <T> T
getReference(java.lang.ref.Reference<T> reference)
(package private) static <N,E>
DirectedMultiNetworkConnections<N,E>of()
(package private) static <N,E>
DirectedMultiNetworkConnections<N,E>ofImmutable(java.util.Map<E,N> inEdges, java.util.Map<E,N> outEdges, int selfLoopCount)
java.util.Set<N>
predecessors()
private Multiset<N>
predecessorsMultiset()
N
removeInEdge(E edge, boolean isSelfLoop)
Removeedge
from the set of incoming edges.N
removeOutEdge(E edge)
Removeedge
from the set of outgoing edges.java.util.Set<N>
successors()
private Multiset<N>
successorsMultiset()
-
Methods inherited from class com.google.common.graph.AbstractDirectedNetworkConnections
adjacentNode, adjacentNodes, incidentEdges, inEdges, outEdges
-
-
-
-
Method Detail
-
of
static <N,E> DirectedMultiNetworkConnections<N,E> of()
-
ofImmutable
static <N,E> DirectedMultiNetworkConnections<N,E> ofImmutable(java.util.Map<E,N> inEdges, java.util.Map<E,N> outEdges, int selfLoopCount)
-
predecessors
public java.util.Set<N> predecessors()
-
successors
public java.util.Set<N> successors()
-
edgesConnecting
public java.util.Set<E> edgesConnecting(N node)
Description copied from interface:NetworkConnections
Returns the set of edges connecting the origin node tonode
. For networks without parallel edges, this set cannot be of size greater than one.
-
removeInEdge
public N removeInEdge(E edge, boolean isSelfLoop)
Description copied from interface:NetworkConnections
Removeedge
from the set of incoming edges. Returns the former predecessor node.In the undirected case, returns
null
ifisSelfLoop
is true.- Specified by:
removeInEdge
in interfaceNetworkConnections<N,E>
- Overrides:
removeInEdge
in classAbstractDirectedNetworkConnections<N,E>
-
removeOutEdge
public N removeOutEdge(E edge)
Description copied from interface:NetworkConnections
Removeedge
from the set of outgoing edges. Returns the former successor node.- Specified by:
removeOutEdge
in interfaceNetworkConnections<N,E>
- Overrides:
removeOutEdge
in classAbstractDirectedNetworkConnections<N,E>
-
addInEdge
public void addInEdge(E edge, N node, boolean isSelfLoop)
Description copied from interface:NetworkConnections
Addedge
to the set of incoming edges. Implicitly addsnode
as a predecessor.- Specified by:
addInEdge
in interfaceNetworkConnections<N,E>
- Overrides:
addInEdge
in classAbstractDirectedNetworkConnections<N,E>
-
addOutEdge
public void addOutEdge(E edge, N node)
Description copied from interface:NetworkConnections
Addedge
to the set of outgoing edges. Implicitly addsnode
as a successor.- Specified by:
addOutEdge
in interfaceNetworkConnections<N,E>
- Overrides:
addOutEdge
in classAbstractDirectedNetworkConnections<N,E>
-
getReference
private static <T> T getReference(java.lang.ref.Reference<T> reference)
-
-