Package graphs.shortestpaths
Class DijkstraSolver<V>
- java.lang.Object
-
- graphs.shortestpaths.DijkstraSolver<V>
-
- Type Parameters:
V
- the type of vertices.
- All Implemented Interfaces:
ShortestPathSolver<V>
public class DijkstraSolver<V> extends Object implements ShortestPathSolver<V>
Dijkstra's algorithm implementation of theShortestPathSolver
interface.- See Also:
ShortestPathSolver
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface graphs.shortestpaths.ShortestPathSolver
ShortestPathSolver.Constructor<V>
-
-
Constructor Summary
Constructors Constructor Description DijkstraSolver(Graph<V> graph, V start)
Constructs a new instance by executing Dijkstra's algorithm on the graph from the start.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<V>
solution(V goal)
Returns the single-pair shortest path from a start vertex to the goal.
-
-
-
Method Detail
-
solution
public List<V> solution(V goal)
Description copied from interface:ShortestPathSolver
Returns the single-pair shortest path from a start vertex to the goal.- Specified by:
solution
in interfaceShortestPathSolver<V>
- Parameters:
goal
- the goal vertex.- Returns:
- a list of vertices representing the shortest path.
-
-