Package com.graphhopper.routing
Class DijkstraOneToMany
java.lang.Object
com.graphhopper.routing.AbstractRoutingAlgorithm
com.graphhopper.routing.DijkstraOneToMany
- All Implemented Interfaces:
RoutingAlgorithm
A simple dijkstra tuned to perform multiple one to many queries with the same source and different target nodes
more efficiently than
Dijkstra
. Old data structures are cached between requests and potentially reused and
the shortest path tree is stored in (large as the graph) arrays instead of hash maps.
- Author:
- Peter Karich
-
Field Summary
FieldsFields inherited from class com.graphhopper.routing.AbstractRoutingAlgorithm
edgeExplorer, graph, maxVisitedNodes, nodeAccess, timeoutMillis, traversalMode, weighting
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalcPath
(int from, int to) Calculates the best path between the specified nodes.clear()
Call clear if you have a different start node and need to clear the cache.void
close()
int
findEndNode
(int from, int to) List currently used memory in MB (approximately)getName()
int
Returns the visited nodes after searching.double
getWeight
(int endNode) protected boolean
void
setWeightLimit
(double weightLimit) Methods inherited from class com.graphhopper.routing.AbstractRoutingAlgorithm
accept, calcPaths, checkAlreadyRun, createEmptyPath, isMaxVisitedNodesExceeded, isTimeoutExceeded, setMaxVisitedNodes, setTimeoutMillis, setupFinishTime, toString
-
Field Details
-
weights
protected double[] weights
-
-
Constructor Details
-
DijkstraOneToMany
-
-
Method Details
-
calcPath
Description copied from interface:RoutingAlgorithm
Calculates the best path between the specified nodes.- Returns:
- the path. Call the method found() to make sure that the path is valid.
-
clear
Call clear if you have a different start node and need to clear the cache. -
getWeight
public double getWeight(int endNode) -
findEndNode
public int findEndNode(int from, int to) -
setWeightLimit
public void setWeightLimit(double weightLimit) -
isWeightLimitExceeded
protected boolean isWeightLimitExceeded() -
close
public void close() -
getVisitedNodes
public int getVisitedNodes()Description copied from interface:RoutingAlgorithm
Returns the visited nodes after searching. Useful for debugging. -
getName
- Specified by:
getName
in interfaceRoutingAlgorithm
- Overrides:
getName
in classAbstractRoutingAlgorithm
- Returns:
- name of this algorithm
-
getMemoryUsageAsString
List currently used memory in MB (approximately)
-