Package com.google.common.graph
Class AbstractUndirectedNetworkConnections<N,E>
- java.lang.Object
-
- com.google.common.graph.AbstractUndirectedNetworkConnections<N,E>
-
- Type Parameters:
N
- Node parameter typeE
- Edge parameter type
- All Implemented Interfaces:
NetworkConnections<N,E>
- Direct Known Subclasses:
UndirectedMultiNetworkConnections
,UndirectedNetworkConnections
abstract class AbstractUndirectedNetworkConnections<N,E> extends java.lang.Object implements NetworkConnections<N,E>
A base implementation ofNetworkConnections
for undirected networks.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.Map<E,N>
incidentEdgeMap
Keys are edges incident to the origin node, values are the node at the other end.
-
Constructor Summary
Constructors Constructor Description AbstractUndirectedNetworkConnections(java.util.Map<E,N> incidentEdgeMap)
-
Method Summary
All 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.N
adjacentNode(E edge)
Returns the node that is adjacent to the origin node alongedge
.java.util.Set<E>
incidentEdges()
java.util.Set<E>
inEdges()
java.util.Set<E>
outEdges()
java.util.Set<N>
predecessors()
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()
-
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
adjacentNodes, edgesConnecting
-
-
-
-
Method Detail
-
predecessors
public java.util.Set<N> predecessors()
- Specified by:
predecessors
in interfaceNetworkConnections<N,E>
-
successors
public java.util.Set<N> successors()
- Specified by:
successors
in interfaceNetworkConnections<N,E>
-
incidentEdges
public java.util.Set<E> incidentEdges()
- Specified by:
incidentEdges
in interfaceNetworkConnections<N,E>
-
inEdges
public java.util.Set<E> inEdges()
- Specified by:
inEdges
in interfaceNetworkConnections<N,E>
-
outEdges
public java.util.Set<E> outEdges()
- Specified by:
outEdges
in interfaceNetworkConnections<N,E>
-
adjacentNode
public N adjacentNode(E edge)
Description copied from interface:NetworkConnections
Returns the node that is adjacent to the origin node alongedge
.In the directed case,
edge
is assumed to be an outgoing edge.- Specified by:
adjacentNode
in interfaceNetworkConnections<N,E>
-
removeInEdge
@CheckForNull 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>
-
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>
-
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>
-
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>
-
-