Class AStarSolver<V>

  • Type Parameters:
    V - the type of vertices.

    public class AStarSolver<V>
    extends Object
    A* search implementation for single-pair shortest paths in an AStarGraph.
    See Also:
    AStarGraph
    • Field Detail

      • edgeTo

        private final Map<V,​Edge<V>> edgeTo
      • start

        private final V start
      • goal

        private final V goal
    • Constructor Detail

      • AStarSolver

        public AStarSolver​(AStarGraph<V> graph,
                           V start,
                           V goal)
        Constructs a new instance by executing A* search on the graph from the start to the goal.
        Parameters:
        graph - the input graph.
        start - the start vertex.
        goal - the goal vertex.
    • Method Detail

      • solution

        public List<V> solution()
        Returns the single-pair shortest path from the stored start to the stored goal.
        Returns:
        a list of vertices representing the shortest path.