astar_lightest_path

compas.topology.astar_lightest_path(adjacency, weights, heuristic, root, goal)[source]

Find the path of least weight between two vertices of a graph using the A* search algorithm.

Parameters
  • adjacency (dict) – An adjacency dictionary. Each key represents a vertex and maps to a list of neighboring vertex keys.

  • weights (dict) – A dictionary of edge weights.

  • heuristic (dict) – A dictionary of guesses of weights of paths from a node to the goal.

  • root (hashable) – The start vertex.

  • goal (hashable) – The end vertex.

Returns

list, None – The path from root to goal, or None, if no path exists between the vertices.

References

https://en.wikipedia.org/wiki/A*_search_algorithm