com.ch.odi.common.graphs
Class Pathfinder
java.lang.Object
|
+--com.ch.odi.common.graphs.Pathfinder
- public class Pathfinder
- extends Object
Title: Finds the shortest path between two nodes in a graph.
Description:
Copyright: Copyright (c) 2002 Ortwin Glück
Company:
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Pathfinder
public Pathfinder(Graph g)
findShortestPath
public Stack findShortestPath(Object start,
Object end)
- Finds the shortest path between two nodes.
- Parameters:
start - The node to start withend - The end node
findShortestPath
public Stack findShortestPath(Object start,
Collection ends)
- Finds the shortest path from a start node to the closest of end nodes.
- Parameters:
start - The node to start withend - A list of alternative end nodes. Using a HashSet is recommended
as performance is best.
setHopLimit
public void setHopLimit(int limit)
- Sets the maximum number of hops.
A value of 0 disables the hop limit.