Package graphs

Class DijkstraSolver<V>

    • Constructor Detail

      • DijkstraSolver

        public DijkstraSolver​(Graph<V> graph,
                              V start)
        Constructs a new instance by executing Dijkstra's algorithm on the graph from the start.
        Parameters:
        graph - the input graph.
        start - the start vertex.
    • Method Detail

      • solution

        public List<V> solution​(V goal)
        Description copied from interface: ShortestPathSolver
        Returns the single-pair shortest path from a start defined in Constructor#run(Graph, V) to the goal.
        Specified by:
        solution in interface ShortestPathSolver<V>
        Parameters:
        goal - the goal vertex.
        Returns:
        a list of vertices representing the shortest path.