Class DefaultEdgeDirectory
java.lang.Object
org.apache.xmlgraphics.util.dijkstra.DefaultEdgeDirectory
- All Implemented Interfaces:
EdgeDirectory
Default implementation of an edge directory for the
DijkstraAlgorithm
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a new edge between two vertices.getBestEdge
(Vertex start, Vertex end) Returns the best edge (the edge with the lowest penalty) between two given vertices.getDestinations
(Vertex origin) Returns an iterator over all valid destinations for a given vertex.Returns an iterator over all edges with the given origin.int
getPenalty
(Vertex start, Vertex end) Returns the penalty between two vertices.
-
Constructor Details
-
DefaultEdgeDirectory
public DefaultEdgeDirectory()
-
-
Method Details
-
addEdge
Adds a new edge between two vertices.- Parameters:
edge
- the new edge
-
getPenalty
Returns the penalty between two vertices.- Specified by:
getPenalty
in interfaceEdgeDirectory
- Parameters:
start
- the start vertexend
- the end vertex- Returns:
- the penalty between two vertices, or 0 if no single edge between the two vertices exists.
-
getDestinations
Returns an iterator over all valid destinations for a given vertex.- Specified by:
getDestinations
in interfaceEdgeDirectory
- Parameters:
origin
- the origin from which to search for destinations- Returns:
- the iterator over all valid destinations for a given vertex
-
getEdges
Returns an iterator over all edges with the given origin.- Parameters:
origin
- the origin- Returns:
- an iterator over Edge instances
-
getBestEdge
Returns the best edge (the edge with the lowest penalty) between two given vertices.- Parameters:
start
- the start vertexend
- the end vertex- Returns:
- the best vertex or null if none is found
-