Package com.google.common.graph
Class UndirectedGraphConnections<N,V>
- java.lang.Object
-
- com.google.common.graph.UndirectedGraphConnections<N,V>
-
- Type Parameters:
N- Node parameter typeV- Value parameter type
- All Implemented Interfaces:
GraphConnections<N,V>
final class UndirectedGraphConnections<N,V> extends java.lang.Object implements GraphConnections<N,V>
An implementation ofGraphConnectionsfor undirected graphs.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<N,V>adjacentNodeValues
-
Constructor Summary
Constructors Modifier Constructor Description privateUndirectedGraphConnections(java.util.Map<N,V> adjacentNodeValues)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPredecessor(N node, V value)Addnodeas a predecessor to the origin node.VaddSuccessor(N node, V value)Addnodeas a successor to the origin node.java.util.Set<N>adjacentNodes()(package private) static <N,V>
UndirectedGraphConnections<N,V>of()(package private) static <N,V>
UndirectedGraphConnections<N,V>ofImmutable(java.util.Map<N,V> adjacentNodeValues)java.util.Set<N>predecessors()voidremovePredecessor(N node)Removenodefrom the set of predecessors.VremoveSuccessor(N node)Removenodefrom the set of successors.java.util.Set<N>successors()Vvalue(N node)Returns the value associated with the edge connecting the origin node tonode, or null if there is no such edge.
-
-
-
Method Detail
-
of
static <N,V> UndirectedGraphConnections<N,V> of()
-
ofImmutable
static <N,V> UndirectedGraphConnections<N,V> ofImmutable(java.util.Map<N,V> adjacentNodeValues)
-
adjacentNodes
public java.util.Set<N> adjacentNodes()
- Specified by:
adjacentNodesin interfaceGraphConnections<N,V>
-
predecessors
public java.util.Set<N> predecessors()
- Specified by:
predecessorsin interfaceGraphConnections<N,V>
-
successors
public java.util.Set<N> successors()
- Specified by:
successorsin interfaceGraphConnections<N,V>
-
value
public V value(N node)
Description copied from interface:GraphConnectionsReturns the value associated with the edge connecting the origin node tonode, or null if there is no such edge.- Specified by:
valuein interfaceGraphConnections<N,V>
-
removePredecessor
public void removePredecessor(N node)
Description copied from interface:GraphConnectionsRemovenodefrom the set of predecessors.- Specified by:
removePredecessorin interfaceGraphConnections<N,V>
-
removeSuccessor
public V removeSuccessor(N node)
Description copied from interface:GraphConnectionsRemovenodefrom the set of successors. Returns the value previously associated with the edge connecting the two nodes.- Specified by:
removeSuccessorin interfaceGraphConnections<N,V>
-
addPredecessor
public void addPredecessor(N node, V value)
Description copied from interface:GraphConnectionsAddnodeas a predecessor to the origin node. In the case of an undirected graph, it also becomes a successor. Associatesvaluewith the edge connecting the two nodes.- Specified by:
addPredecessorin interfaceGraphConnections<N,V>
-
addSuccessor
public V addSuccessor(N node, V value)
Description copied from interface:GraphConnectionsAddnodeas a successor to the origin node. In the case of an undirected graph, it also becomes a predecessor. Associatesvaluewith the edge connecting the two nodes. Returns the value previously associated with the edge connecting the two nodes.- Specified by:
addSuccessorin interfaceGraphConnections<N,V>
-
-