public class WeightedGraphImpl extends GraphImpl implements WeightedGraph
| Constructor and Description |
|---|
WeightedGraphImpl()
Creates a new instance of WeightedGraphImpl.
|
| Modifier and Type | Method and Description |
|---|---|
WeightedEdge |
addEdge(Vertex v1,
Vertex v2,
double weight)
Convenience method to add a WeightedEdge with a specified weight
into the WeightedGraph.
|
Vertex |
getClosest(Vertex v)
Determines the Vertex that is 'closest' to the Vertex specified.
|
WeightedGraph |
minimumSpanningTree()
Determine a minimum spanning tree for the weighted graph.
|
void |
setMinimumSpanningTreeAlgorithm(MinimumSpanningTreeAlgorithm algo)
Sets the algorithm used to determine the minimum spanning tree.
|
void |
setShortestPathAlgorithm(ShortestPathAlgorithm algo)
Sets the algorithm used to determine the shortest path spanning tree.
|
WeightedGraph |
shortestPath(Vertex vertex)
Determine a shortest path spanning tree for the weighted graph.
|
add, addEdge, addEdge, addGraphAddEdgeListener, addGraphAddVertexListener, addGraphRemoveEdgeListener, addGraphRemoveVertexListener, addListener, cloneVertices, containsEdge, containsVertex, forgetConnectedSets, getAdjacentVertices, getAdjacentVertices, getConnectedSet, getConnectedSet, getDegree, getDegree, getEdges, getEdgesCount, getEdgeSet, getGraphFactory, getTraversal, getVertexSet, getVertices, getVerticesCount, getVerticesIterator, isConnected, remove, removeEdge, removeEdges, removeGraphAddEdgeListener, removeGraphAddVertexListener, removeGraphRemoveEdgeListener, removeGraphRemoveVertexListener, removeListener, setGraphFactory, setTraversal, toString, traverseclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitadd, addEdge, addEdge, addGraphAddEdgeListener, addGraphAddVertexListener, addGraphRemoveEdgeListener, addGraphRemoveVertexListener, addListener, cloneVertices, getAdjacentVertices, getAdjacentVertices, getConnectedSet, getConnectedSet, getDegree, getDegree, getEdges, getEdgesCount, getEdgeSet, getGraphFactory, getTraversal, getVertexSet, getVertices, getVerticesCount, getVerticesIterator, isConnected, remove, removeEdge, removeEdges, removeGraphAddEdgeListener, removeGraphAddVertexListener, removeGraphRemoveEdgeListener, removeGraphRemoveVertexListener, removeListener, setGraphFactory, setTraversal, traversepublic WeightedGraphImpl()
public WeightedEdge addEdge(Vertex v1, Vertex v2, double weight) throws Exception
addEdge in interface WeightedGraphExceptionpublic Vertex getClosest(Vertex v)
getClosest in interface WeightedGraphpublic WeightedGraph minimumSpanningTree()
minimumSpanningTree in interface WeightedGraphpublic WeightedGraph shortestPath(Vertex vertex)
Also note that the graph returned by this method is a new instance of WeightedGraph. However, its vertices and edges will be the same instance as those of this WeightedGraph. Therefore, do not modify the contents of the returned WeightedGraph such that any of its vertices or edges are removed.
shortestPath in interface WeightedGraphvertex - The Vertex in the weighted graph that we want to get
the shortest paths to all other vertices.public void setMinimumSpanningTreeAlgorithm(MinimumSpanningTreeAlgorithm algo)
public void setShortestPathAlgorithm(ShortestPathAlgorithm algo)
Copyright © 2019 JULIE Lab, Germany. All rights reserved.