public class DijkstraAlgorithm
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
INFINITE
Infinity value for distances.
|
| Constructor and Description |
|---|
DijkstraAlgorithm(EdgeDirectory edgeDirectory)
Main Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
execute(Vertex start,
Vertex destination)
Run Dijkstra's shortest path algorithm.
|
protected java.util.Iterator |
getDestinations(Vertex origin)
Returns an iterator over all valid destinations for a given vertex.
|
int |
getLowestPenalty(Vertex vertex)
Returns the lowest penalty from the start point to a given vertex.
|
protected int |
getPenalty(Vertex start,
Vertex end)
Returns the penalty between two vertices.
|
Vertex |
getPredecessor(Vertex vertex)
Returns the vertex's predecessor on the shortest path.
|
public static final int INFINITE
public DijkstraAlgorithm(EdgeDirectory edgeDirectory)
edgeDirectory - the edge directory this instance should work onprotected int getPenalty(Vertex start, Vertex end)
start - the start vertexend - the end vertexprotected java.util.Iterator getDestinations(Vertex origin)
origin - the origin from which to search for destinationspublic void execute(Vertex start, Vertex destination)
getPredecessor(Vertex) to reconstruct the best/shortest path starting from the
destination backwards.start - the starting vertexdestination - the destination vertex.public int getLowestPenalty(Vertex vertex)
vertex - the vertexINFINITE if there is no route to
the destination.Copyright 1999-2025 The Apache Software Foundation. All Rights Reserved.