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(EndpointPair<N> endpoints,
E edge)
Adds
edge connecting endpoints . |
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(E edge)
Removes
edge from this network, if it is present. |
boolean |
removeNode(N node)
Removes
node if it is present; all edges incident to node will also be removed. |
adjacentEdges, adjacentNodes, allowsParallelEdges, allowsSelfLoops, asGraph, degree, edgeConnecting, edgeConnecting, edgeConnectingOrNull, edgeConnectingOrNull, edgeOrder, edges, edgesConnecting, edgesConnecting, equals, hasEdgeConnecting, hasEdgeConnecting, hashCode, incidentEdges, incidentNodes, inDegree, inEdges, isDirected, nodeOrder, nodes, outDegree, outEdges, 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 network was modified as a result of this call@CanIgnoreReturnValue boolean addEdge(N nodeU, N nodeV, E edge)
edge
connecting nodeU
to nodeV
.
If the graph is directed, edge
will be directed in this graph; otherwise, it will be
undirected.
edge
must be unique to this graph, just as a Map
key must be. It must
also 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.
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 in the graph and does not
connect nodeU
to nodeV
IllegalArgumentException
- if the introduction of the edge would violate Network.allowsParallelEdges()
or Network.allowsSelfLoops()
@CanIgnoreReturnValue boolean addEdge(EndpointPair<N> endpoints, E edge)
edge
connecting endpoints
. In an undirected network, edge
will
also connect nodeV
to nodeU
.
If this graph is directed, edge
will be directed in this graph; if it is undirected,
edge
will be undirected in this graph.
If this graph is directed, endpoints
must be ordered.
edge
must be unique to this graph, just as a Map
key must be. It must
also 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.
If edge
already connects an endpoint pair equal to endpoints
, then this
method will have no effect.
true
if the network was modified as a result of this callIllegalArgumentException
- if edge
already exists in the graph and connects some
other endpoint pair that is not equal to endpoints
IllegalArgumentException
- if the introduction of the edge would violate Network.allowsParallelEdges()
or Network.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 network was modified as a result of this call@CanIgnoreReturnValue boolean removeEdge(E edge)
edge
from this network, if it is present.true
if the network was modified as a result of this callCopyright © 2010–2019. All rights reserved.