Package com.google.common.graph
Interface MutableValueGraph<N,V>
-
- Type Parameters:
N
- Node parameter typeV
- Value parameter type
- All Superinterfaces:
BaseGraph<N>
,PredecessorsFunction<N>
,SuccessorsFunction<N>
,ValueGraph<N,V>
- All Known Implementing Classes:
ConfigurableMutableValueGraph
@Beta public interface MutableValueGraph<N,V> extends ValueGraph<N,V>
A subinterface ofValueGraph
which adds mutation methods. When mutation is not required, users should prefer theValueGraph
interface.- Since:
- 20.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
addNode(N node)
Addsnode
if it is not already present.V
putEdgeValue(N nodeU, N nodeV, V value)
Adds an edge connectingnodeU
tonodeV
if one is not already present; associate that edge withvalue
.V
removeEdge(N nodeU, N nodeV)
Removes the edge connectingnodeU
tonodeV
, if it is present.boolean
removeNode(N node)
Removesnode
if it is present; all edges incident tonode
will also be removed.-
Methods inherited from interface com.google.common.graph.ValueGraph
adjacentNodes, allowsSelfLoops, asGraph, degree, edges, edgeValue, edgeValueOrDefault, equals, hasEdgeConnecting, hashCode, incidentEdges, inDegree, isDirected, nodeOrder, nodes, outDegree, predecessors, successors
-
-
-
-
Method Detail
-
addNode
boolean addNode(N node)
Addsnode
if it is not already present.Nodes must be unique, just as
Map
keys must be. They must also be non-null.- Returns:
true
if the graph was modified as a result of this call
-
putEdgeValue
V putEdgeValue(N nodeU, N nodeV, V value)
Adds an edge connectingnodeU
tonodeV
if one is not already present; associate that edge withvalue
. In an undirected graph, the edge will also connectnodeV
tonodeU
.Values do not have to be unique. However, values must be non-null.
If
nodeU
andnodeV
are not already present in this graph, this method will silentlyadd
nodeU
andnodeV
to the graph.- Returns:
- the value previously associated with the edge connecting
nodeU
tonodeV
, or null if there was no such edge. - Throws:
java.lang.IllegalArgumentException
- if the introduction of the edge would violateValueGraph.allowsSelfLoops()
-
removeNode
boolean removeNode(N node)
Removesnode
if it is present; all edges incident tonode
will also be removed.- Returns:
true
if the graph was modified as a result of this call
-
-