N
- Node parameter typeE
- Edge parameter type@Beta public interface MutableNetwork<N,E> extends Network<N,E>
Network
which adds mutation methods. When mutation is not required,
users should prefer the Network
interface.Modifier and Type | Method and Description |
---|---|
boolean |
addEdge(N nodeU,
N nodeV,
E edge)
Adds
edge connecting nodeU to nodeV . |
boolean |
addNode(N node)
Adds
node if it is not already present. |
boolean |
removeEdge(Object edge)
Removes
edge from this network, if it is present. |
boolean |
removeNode(Object node)
Removes
node if it is present; all edges incident to node will also be removed. |
adjacentEdges, adjacentNodes, allowsParallelEdges, allowsSelfLoops, asGraph, degree, edgeOrder, edges, edgesConnecting, equals, hashCode, incidentEdges, incidentNodes, inDegree, inEdges, isDirected, nodeOrder, nodes, outDegree, outEdges, 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 network was modified as a result of this callboolean addEdge(N nodeU, N nodeV, E edge)
edge
connecting nodeU
to nodeV
. In an undirected network, the edge
will also connect nodeV
to nodeU
.
Edges must be unique, just as Map
keys must be. They must also be non-null.
Behavior if nodeU
and nodeV
are not already present in this network is
implementation-dependent. Suggested behaviors include (a) silently adding
nodeU
and nodeV
to the network (this is the behavior of the default
implementations) or (b) throwing IllegalArgumentException
.
If edge
already connects nodeU
to nodeV
(in the specified order if
this network Network.isDirected()
, else in any order), then this method will have no effect.
true
if the network was modified as a result of this callIllegalArgumentException
- if edge
already exists and does not connect nodeU
to nodeV
, or if the introduction of the edge would violate Network.allowsParallelEdges()
or Network.allowsSelfLoops()
boolean removeNode(Object node)
node
if it is present; all edges incident to node
will also be removed.true
if the network was modified as a result of this callboolean removeEdge(Object edge)
edge
from this network, if it is present.true
if the network was modified as a result of this callCopyright © 2010-2016. All Rights Reserved.