V - the graph vertex typeE - the graph edge typepublic class ImmutableNetworkAdapter<V,E> extends BaseNetworkAdapter<V,E,com.google.common.graph.ImmutableNetwork<V,E>> implements Graph<V,E>, java.lang.Cloneable, java.io.Serializable
ImmutableNetwork.
Since the underlying network is immutable, the resulting graph is unmodifiable.
Example usage:
MutableNetwork<String, DefaultEdge> mutableNetwork =
NetworkBuilder.directed().allowsParallelEdges(true).allowsSelfLoops(true).build();
mutableNetwork.addNode("v1");
ImmutableNetworkGraph<String, DefaultEdge> immutableNetwork =
ImmutableNetwork.copyOf(mutableNetwork);
Graph<String, DefaultEdge> graph = new ImmutableNetworkAdapter<>(immutableNetwork);
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
GRAPH_IS_IMMUTABLE |
edgeSupplier, LOOPS_NOT_ALLOWED, network, unmodifiableEdgeSet, unmodifiableVertexSet, vertexOrder, vertexOrderMethod, vertexSupplierDEFAULT_EDGE_WEIGHT| Constructor and Description |
|---|
ImmutableNetworkAdapter(com.google.common.graph.ImmutableNetwork<V,E> network)
Create a new network adapter.
|
| Modifier and Type | Method and Description |
|---|---|
E |
addEdge(V sourceVertex,
V targetVertex) |
boolean |
addEdge(V sourceVertex,
V targetVertex,
E e) |
V |
addVertex() |
boolean |
addVertex(V v) |
java.lang.Object |
clone()
Returns a shallow copy of this graph instance.
|
double |
getEdgeWeight(E e) |
GraphType |
getType() |
boolean |
removeEdge(E e) |
E |
removeEdge(V sourceVertex,
V targetVertex) |
boolean |
removeVertex(V v) |
void |
setEdgeWeight(E e,
double weight) |
containsEdge, containsVertex, createVertexOrder, degreeOf, edgeSet, edgesOf, getAllEdges, getEdge, getEdgeSource, getEdgeSupplier, getEdgeTarget, getVertexSupplier, incomingEdgesOf, inDegreeOf, outDegreeOf, outgoingEdgesOf, setEdgeSupplier, setVertexSupplier, vertexSetassertVertexExist, containsEdge, equals, hashCode, removeAllEdges, removeAllEdges, removeAllEdges, removeAllVertices, toString, toStringFromSetsfinalize, getClass, notify, notifyAll, wait, wait, waitcontainsEdge, containsEdge, containsVertex, degreeOf, edgeSet, edgesOf, getAllEdges, getEdge, getEdgeSource, getEdgeSupplier, getEdgeTarget, getVertexSupplier, incomingEdgesOf, inDegreeOf, iterables, outDegreeOf, outgoingEdgesOf, removeAllEdges, removeAllEdges, removeAllVertices, setEdgeWeight, vertexSetprotected static final java.lang.String GRAPH_IS_IMMUTABLE
public E removeEdge(V sourceVertex, V targetVertex)
removeEdge in interface Graph<V,E>public boolean removeEdge(E e)
removeEdge in interface Graph<V,E>public boolean removeVertex(V v)
removeVertex in interface Graph<V,E>public double getEdgeWeight(E e)
getEdgeWeight in interface Graph<V,E>getEdgeWeight in class BaseNetworkAdapter<V,E,com.google.common.graph.ImmutableNetwork<V,E>>public void setEdgeWeight(E e, double weight)
setEdgeWeight in interface Graph<V,E>public GraphType getType()
public java.lang.Object clone()
clone in class java.lang.Objectjava.lang.RuntimeException - in case the clone is not supportedObject.clone()Copyright © 2021. All rights reserved.