N - Node parameter typefinal class ConfigurableMutableGraph<N> extends ForwardingGraph<N> implements MutableGraph<N>
MutableGraph that supports both directed and undirected
graphs. Instances of this class should be constructed with GraphBuilder.
Time complexities for mutation methods are all O(1) except for removeNode(N node),
which is in O(d_node) where d_node is the degree of node.
| Modifier and Type | Field and Description |
|---|---|
private MutableValueGraph<N,GraphConstants.Presence> |
backingValueGraph |
| Constructor and Description |
|---|
ConfigurableMutableGraph(AbstractGraphBuilder<? super N> builder)
Constructs a
MutableGraph with the properties specified in builder. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addNode(N node)
Adds
node if it is not already present. |
protected BaseGraph<N> |
delegate() |
boolean |
putEdge(N nodeU,
N nodeV)
Adds an edge connecting
nodeU to nodeV if one is not already present. |
boolean |
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, degree, edgeCount, hasEdgeConnecting, inDegree, isDirected, nodeOrder, nodes, outDegree, predecessors, successorsequals, hashCode, toStringedges, incidentEdgesclone, finalize, getClass, notify, notifyAll, wait, wait, waitadjacentNodes, allowsSelfLoops, degree, edges, equals, hasEdgeConnecting, hashCode, incidentEdges, inDegree, isDirected, nodeOrder, nodes, outDegree, predecessors, successorsprivate final MutableValueGraph<N,GraphConstants.Presence> backingValueGraph
ConfigurableMutableGraph(AbstractGraphBuilder<? super N> builder)
MutableGraph with the properties specified in builder.protected BaseGraph<N> delegate()
delegate in class ForwardingGraph<N>public boolean addNode(N node)
MutableGraphnode if it is not already present.
Nodes must be unique, just as Map keys must be. They must also be non-null.
addNode in interface MutableGraph<N>true if the graph was modified as a result of this callpublic boolean putEdge(N nodeU, N nodeV)
MutableGraphnodeU to nodeV if one is not already present. In an
undirected graph, the edge will also connect nodeV to nodeU.
If nodeU and nodeV are not already present in this graph, this method will
silently add nodeU and nodeV to the graph.
putEdge in interface MutableGraph<N>true if the graph was modified as a result of this callpublic boolean removeNode(N node)
MutableGraphnode if it is present; all edges incident to node will also be removed.removeNode in interface MutableGraph<N>true if the graph was modified as a result of this callpublic boolean removeEdge(N nodeU, N nodeV)
MutableGraphnodeU to nodeV, if it is present.removeEdge in interface MutableGraph<N>true if the graph was modified as a result of this call