|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.rollerjm.graph.Dijkstra
Title: graphs
Description: implementation of the Dijkstra's algorithm to search for the shortest distance in a weighted graph
Copyright: Copyright (c) 2002
Company:
Nested Class Summary | |
class |
Dijkstra.PriorityQueue
Title: graphs |
Field Summary | |
private java.util.HashSet |
determinedVerticesSet
the set of determines vertices V |
private IGraph |
graph
The graph on which we apply the algorithm |
private static int |
INFINITE
the INFINITE, the maximum weight should be < to this value |
private java.util.HashMap |
predecessorsMap
the result map of predecessors of the shortest path from a start vertex after running the algorithm |
private Dijkstra.PriorityQueue |
remainingVertices
the list of remaining vertices Q |
private java.util.HashMap |
shortestPathMap
the result map of the shortest path distances from a start vertex after running the algorithm |
Constructor Summary | |
Dijkstra(IGraph graph)
|
Method Summary | |
private Path |
buildShortestPath(java.lang.Object start,
java.lang.Object destination)
used the predecessorsMap to build the shortest path from a start vertex to a destination vertex |
private void |
checkVertexExist(java.lang.Object vertex)
|
Path |
getShortestPath(java.lang.Object start,
java.lang.Object destination)
|
private int |
getShortestPathFromStart(java.lang.Object vertex)
|
int |
getShortestWeightDistance(java.lang.Object start,
java.lang.Object destination)
|
private void |
relax(java.lang.Object u)
|
private void |
runAlgorihtm(java.lang.Object startVertex,
java.lang.Object destinationVertex)
Run the algorihtm see http://ciips.ee.uwa.edu.au/~morris/Year2/PLDS210/dijkstra.html for details |
private void |
setShortestPathFromStart(java.lang.Object vertex,
int path)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final int INFINITE
private IGraph graph
private java.util.HashSet determinedVerticesSet
private Dijkstra.PriorityQueue remainingVertices
private java.util.HashMap shortestPathMap
private java.util.HashMap predecessorsMap
Constructor Detail |
public Dijkstra(IGraph graph)
graph
- Method Detail |
private void runAlgorihtm(java.lang.Object startVertex, java.lang.Object destinationVertex)
startVertex
- destinationVertex
- private void relax(java.lang.Object u)
u
- vertex whose adjacents vertices should be relaxedprivate int getShortestPathFromStart(java.lang.Object vertex)
vertex
-
private void setShortestPathFromStart(java.lang.Object vertex, int path)
vertex
- path
- public int getShortestWeightDistance(java.lang.Object start, java.lang.Object destination)
start
- destination
-
public Path getShortestPath(java.lang.Object start, java.lang.Object destination)
start
- destination
-
private Path buildShortestPath(java.lang.Object start, java.lang.Object destination)
start
- destination
-
private void checkVertexExist(java.lang.Object vertex)
vertex
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |