The documentation for retworkx has migrated to:
These docs will no longer be updated.
- digraph_astar_shortest_path(graph, node, goal_fn, edge_cost, estimate_cost, /)¶
Compute the A* shortest path for a PyDiGraph
graph (PyDiGraph) – The input graph to use
node (int) – The node index to compute the path from
goal_fn – A python callable that will take in 1 parameter, a node’s data object and will return a boolean which will be True if it is the finish node.
edge_cost_fn – A python callable that will take in 1 parameter, an edge’s data object and will return a float that represents the cost of that edge. It must be non-negative.
estimate_cost_fn – A python callable that will take in 1 parameter, a node’s data object and will return a float which represents the estimated cost for the next node. The return must be non-negative. For the algorithm to find the actual shortest path, it should be admissible, meaning that it should never overestimate the actual cost to get to the nearest goal node.
The computed shortest path between node and finish as a list of node indices.
- Return type