V
- the graph vertex typeE
- the graph edge typeAsWeightedGraph
.@Deprecated public class AsWeightedDirectedGraph<V,E> extends AsWeightedGraph<V,E> implements DirectedGraph<V,E>
A weighted view of the backing graph specified in the constructor. This allows you to apply algorithms designed for weighted graphs to an unweighted graph by providing an explicit edge weight mapping. The implementation also allows for "masking" weights for a subset of the edges in an existing weighted graph.
Query operations on this graph "read through" to the backing graph. Vertex addition/removal and edge addition/removal are all supported (and immediately reflected in the backing graph). Setting an edge weight will pass the operation to the backing graph as well if the backing graph implements the WeightedGraph interface. Setting an edge weight will modify the weight map in order to maintain a consistent graph.
Note that edges returned by this graph's accessors are really just the edges of the underlying directed graph.
This graph does not pass the hashCode and equals operations through to the backing graph, but relies on Object's equals and hashCode methods. This graph will be serializable if the backing graph is serializable.
DEFAULT_EDGE_WEIGHT
Constructor and Description |
---|
AsWeightedDirectedGraph(DirectedGraph<V,E> g,
Map<E,Double> weightMap)
Deprecated.
Constructor
|
getEdgeWeight, getType, setEdgeWeight
addEdge, addEdge, addVertex, containsEdge, containsVertex, degreeOf, edgeSet, edgesOf, getAllEdges, getEdge, getEdgeFactory, getEdgeSource, getEdgeTarget, incomingEdgesOf, inDegreeOf, outDegreeOf, outgoingEdgesOf, removeEdge, removeEdge, removeVertex, toString, vertexSet
assertVertexExist, containsEdge, equals, hashCode, removeAllEdges, removeAllEdges, removeAllEdges, removeAllVertices, toStringFromSets
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addEdge, addEdge, addVertex, containsEdge, containsEdge, containsVertex, degreeOf, edgeSet, edgesOf, getAllEdges, getEdge, getEdgeFactory, getEdgeSource, getEdgeTarget, getEdgeWeight, getType, incomingEdgesOf, inDegreeOf, outDegreeOf, outgoingEdgesOf, removeAllEdges, removeAllEdges, removeAllVertices, removeEdge, removeEdge, removeVertex, setEdgeWeight, vertexSet
public AsWeightedDirectedGraph(DirectedGraph<V,E> g, Map<E,Double> weightMap)
g
- the backing graph over which a weighted view is to be created.weightMap
- A mapping of edges to weights. If an edge is not present in the weight map,
the edge weight for the underlying graph is returned. Note that a live reference to
this map is retained, so if the caller changes the map after construction, the changes
will affect the the AsWeightedDirectedGraph instance as well.Copyright © 2017. All rights reserved.