N
- Node parameter typeV
- Value parameter type@Beta public interface MutableValueGraph<N,V> extends ValueGraph<N,V>
ValueGraph
which adds mutation methods. When mutation is not required,
users should prefer the ValueGraph
interface.Modifier and Type | Method and Description |
---|---|
boolean |
addNode(N node)
Adds
node if it is not already present. |
V |
putEdgeValue(EndpointPair<N> endpoints,
V value)
Adds an edge connecting
endpoints if one is not already present, and sets a value for
that edge to value (overwriting the existing value, if any). |
V |
putEdgeValue(N nodeU,
N nodeV,
V value)
Adds an edge connecting
nodeU to nodeV if one is not already present, and sets
a value for that edge to value (overwriting the existing value, if any). |
V |
removeEdge(EndpointPair<N> endpoints)
Removes the edge connecting
endpoints , if it is present. |
V |
removeEdge(N nodeU,
N nodeV)
Removes the edge connecting
nodeU to nodeV , if it is present. |
boolean |
removeNode(N node)
Removes
node if it is present; all edges incident to node will also be removed. |
adjacentNodes, allowsSelfLoops, asGraph, degree, edges, edgeValue, edgeValue, edgeValueOrDefault, edgeValueOrDefault, equals, hasEdgeConnecting, hasEdgeConnecting, hashCode, incidentEdgeOrder, incidentEdges, inDegree, isDirected, nodeOrder, nodes, outDegree, predecessors, successors
@CanIgnoreReturnValue boolean addNode(N node)
node
if it is not already present.
Nodes must be unique, just as Map
keys must be. They must also be non-null.
true
if the graph was modified as a result of this call@CanIgnoreReturnValue V putEdgeValue(N nodeU, N nodeV, V value)
nodeU
to nodeV
if one is not already present, and sets
a value for that edge to value
(overwriting the existing value, if any).
If the graph is directed, the resultant edge will be directed; otherwise, it will be undirected.
Values do not have to be unique. However, values must be non-null.
If nodeU
and nodeV
are not already present in this graph, this method will
silently add
nodeU
and nodeV
to the graph.
nodeU
to nodeV
, or null if there was no such edge.IllegalArgumentException
- if the introduction of the edge would violate ValueGraph.allowsSelfLoops()
@CanIgnoreReturnValue V putEdgeValue(EndpointPair<N> endpoints, V value)
endpoints
if one is not already present, and sets a value for
that edge to value
(overwriting the existing value, if any).
If the graph is directed, the resultant edge will be directed; otherwise, it will be undirected.
If this graph is directed, endpoints
must be ordered.
Values do not have to be unique. However, values must be non-null.
If either or both endpoints are not already present in this graph, this method will silently
add
each missing endpoint to the graph.
nodeU
to nodeV
, or null if there was no such edge.IllegalArgumentException
- if the introduction of the edge would violate ValueGraph.allowsSelfLoops()
IllegalArgumentException
- if the endpoints are unordered and the graph is directed@CanIgnoreReturnValue boolean removeNode(N node)
node
if it is present; all edges incident to node
will also be removed.true
if the graph was modified as a result of this call@CanIgnoreReturnValue V removeEdge(N nodeU, N nodeV)
nodeU
to nodeV
, if it is present.nodeU
to nodeV
, or null if there was no such edge.@CanIgnoreReturnValue V removeEdge(EndpointPair<N> endpoints)
endpoints
, if it is present.
If this graph is directed, endpoints
must be ordered.
endpoints
, or null if
there was no such edge.Copyright © 2010–2020. All rights reserved.