V
- the graph vertex typeE
- the graph edge typepublic class AsUnweightedGraph<V,E> extends GraphDelegator<V,E> implements Serializable, Graph<V,E>
Graph.DEFAULT_EDGE_WEIGHT
for each edge weight. The underlying weighted graph is provided at the constructor.
Modifying operations (adding/removing vertexes/edges) are also passed through to the underlying
weighted graph. As edge weight, Graph.DEFAULT_EDGE_WEIGHT is used. Setting an edge weight is not
supported. The edges are not modified. So, if an edge is asked for, the one from the underlying
weighted graph is returned. In case the underlying graph is serializable, this one is
serializable, too.DEFAULT_EDGE_WEIGHT
Constructor and Description |
---|
AsUnweightedGraph(Graph<V,E> g)
Constructor for AsUnweightedGraph.
|
Modifier and Type | Method and Description |
---|---|
double |
getEdgeWeight(E e)
Returns the weight assigned to a given edge.
|
GraphType |
getType()
Get the graph type.
|
void |
setEdgeWeight(E e,
double weight)
Assigns a weight to an edge.
|
addEdge, addEdge, addVertex, addVertex, containsEdge, containsVertex, degreeOf, edgeSet, edgesOf, getAllEdges, getDelegate, getEdge, getEdgeSource, getEdgeSupplier, getEdgeTarget, getVertexSupplier, 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, addVertex, containsEdge, containsEdge, containsVertex, degreeOf, edgeSet, edgesOf, getAllEdges, getEdge, getEdgeSource, getEdgeSupplier, getEdgeTarget, getVertexSupplier, incomingEdgesOf, inDegreeOf, outDegreeOf, outgoingEdgesOf, removeAllEdges, removeAllEdges, removeAllVertices, removeEdge, removeEdge, removeVertex, setEdgeWeight, vertexSet
public AsUnweightedGraph(Graph<V,E> g)
g
- the backing directed graph over which an undirected view is to be created.NullPointerException
- if the graph is nullpublic double getEdgeWeight(E e)
GraphDelegator
Graph.DEFAULT_EDGE_WEIGHT
), allowing weighted-graph algorithms to apply to them when
meaningful.getEdgeWeight
in interface Graph<V,E>
getEdgeWeight
in class GraphDelegator<V,E>
e
- edge of interestpublic void setEdgeWeight(E e, double weight)
GraphDelegator
setEdgeWeight
in interface Graph<V,E>
setEdgeWeight
in class GraphDelegator<V,E>
e
- edge on which to set weightweight
- new weight for edgepublic GraphType getType()
GraphDelegator
Copyright © 2018. All rights reserved.