astar_shortest_path

compas.topology.astar_shortest_path(graph, root, goal)[source]

Find the shortest path between two vertices of a graph or mesh using the A* search algorithm.

Parameters:
graphcompas.datastructures.Network | compas.datastructures.Mesh

A network or mesh data structure.

roothashable

The identifier of the starting node.

goalhashable

The identifier of the ending node.

Returns:
list[hashable] | 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