Interface MutableNetwork<N,E>
- Type Parameters:
N- Node parameter typeE- Edge parameter type
- All Superinterfaces:
Network<N,E>
-
Method Summary
Modifier and TypeMethodDescriptionbooleanAddsedgeconnectingnodeUtonodeV.booleanAddsnodeif it is not already present.booleanremoveEdge(Object edge) Removesedgefrom this network, if it is present.booleanremoveNode(Object node) Removesnodeif it is present; all edges incident tonodewill also be removed.Methods inherited from interface Network
adjacentEdges, adjacentNodes, allowsParallelEdges, allowsSelfLoops, asGraph, degree, edgeOrder, edges, edgesConnecting, equals, hashCode, incidentEdges, incidentNodes, inDegree, inEdges, isDirected, nodeOrder, nodes, outDegree, outEdges, predecessors, successors
-
Method Details
-
addNode
Addsnodeif it is not already present.Nodes must be unique, just as
Mapkeys must be. They must also be non-null.- Returns:
trueif the network was modified as a result of this call
-
addEdge
AddsedgeconnectingnodeUtonodeV. In an undirected network, the edge will also connectnodeVtonodeU.Edges must be unique, just as
Mapkeys must be. They must also be non-null.Behavior if
nodeUandnodeVare not already present in this network is implementation-dependent. Suggested behaviors include (a) silentlyaddingnodeUandnodeVto the network (this is the behavior of the default implementations) or (b) throwingIllegalArgumentException.If
edgealready connectsnodeUtonodeV(in the specified order if this networkNetwork.isDirected(), else in any order), then this method will have no effect.- Returns:
trueif the network was modified as a result of this call- Throws:
IllegalArgumentException- ifedgealready exists and does not connectnodeUtonodeV, or if the introduction of the edge would violateNetwork.allowsParallelEdges()orNetwork.allowsSelfLoops()
-
removeNode
Removesnodeif it is present; all edges incident tonodewill also be removed.- Returns:
trueif the network was modified as a result of this call
-
removeEdge
Removesedgefrom this network, if it is present.- Returns:
trueif the network was modified as a result of this call
-