V - the graph vertex typepublic class ImmutableDoubleValueGraphAdapter<V> extends ImmutableValueGraphAdapter<V,Double>
ImmutableValueGraph specialized with double values.
The adapter uses class EndpointPair to represent edges. Since the underlying value graph
is immutable, the resulting graph is unmodifiable.
Each edge in ImmutableValueGraph is associated with a double value which is mapped to the
edge weight in the resulting Graph. Thus, the graph is weighted and calling method
Graph.getEdgeWeight(Object) will return the value of an edge.
See the example below on how to create such an adapter:
MutableValueGraph<String, Double> mutableValueGraph =
ValueGraphBuilder.directed().allowsSelfLoops(true).build();
mutableValueGraph.addNode("v1");
mutableValueGraph.addNode("v2");
mutableValueGraph.putEdgeValue("v1", "v2", 3.0);
ImmutableValueGraph<String, Double> immutableValueGraph = ImmutableValueGraph.copyOf(mutableValueGraph);
Graph<String, EndpointPair<String>> graph = new ImmutableDoubleValueGraphAdapter<>(immutableValueGraph);
System.out.println(graph.getEdgeWeight(EndpointPair.ordered("v1", "v2")); // outputs 3.0
GRAPH_IS_IMMUTABLEedgeSupplier, LOOPS_NOT_ALLOWED, unmodifiableEdgeSet, unmodifiableVertexSet, valueConverter, valueGraph, vertexSupplierDEFAULT_EDGE_WEIGHT| Constructor and Description |
|---|
ImmutableDoubleValueGraphAdapter(com.google.common.graph.ImmutableValueGraph<V,Double> valueGraph)
Create a new adapter.
|
addEdge, addEdge, addVertex, addVertex, clone, getType, removeEdge, removeEdge, removeVertex, setEdgeWeightcontainsEdge, containsVertex, degreeOf, edgeSet, edgesOf, getAllEdges, getEdge, getEdgeFactory, getEdgeSource, getEdgeSupplier, getEdgeTarget, getEdgeWeight, 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, getEdgeFactory, getEdgeSource, getEdgeSupplier, getEdgeTarget, getEdgeWeight, getVertexSupplier, incomingEdgesOf, inDegreeOf, outDegreeOf, outgoingEdgesOf, removeAllEdges, removeAllEdges, removeAllVertices, vertexSetCopyright © 2018. All rights reserved.