N
- Node parameter type@Beta public interface MutableGraph<N> extends Graph<N>
Graph
which adds mutation methods. When mutation is not required, users
should prefer the Graph
interface.Modifier and Type | Method and Description |
---|---|
boolean |
addNode(N node)
Adds
node if it is not already present. |
boolean |
putEdge(N nodeU,
N nodeV)
Adds an edge connecting
nodeU to nodeV if one is not already present. |
boolean |
removeEdge(Object nodeU,
Object nodeV)
Removes the edge connecting
nodeU to nodeV , if it is present. |
boolean |
removeNode(Object node)
Removes
node if it is present; all edges incident to node will also be removed. |
adjacentNodes, allowsSelfLoops, degree, edges, equals, hashCode, inDegree, isDirected, nodeOrder, nodes, outDegree, predecessors, successors
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 callboolean putEdge(N nodeU, N nodeV)
nodeU
to nodeV
if one is not already present. In an
undirected graph, the edge will also connect nodeV
to nodeU
.
Behavior if nodeU
and nodeV
are not already present in this graph is
implementation-dependent. Suggested behaviors include (a) silently adding
nodeU
and nodeV
to the graph (this is the behavior of the default
implementations) or (b) throwing IllegalArgumentException
.
true
if the graph was modified as a result of this callIllegalArgumentException
- if the introduction of the edge would violate Graph.allowsSelfLoops()
boolean removeNode(@CompatibleWith(value="N") Object 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 callboolean removeEdge(@CompatibleWith(value="N") Object nodeU, @CompatibleWith(value="N") Object nodeV)
nodeU
to nodeV
, if it is present.true
if the graph was modified as a result of this callCopyright © 2010-2017. All Rights Reserved.