networkx astar_path define the heuristic code example
Example: networkx astar_path define the heuristic
def distance(a,b):
return ( nx.dijkstra_path_length(G,a,b, 'day') + len(nx.dijkstra_path(G, a, b)) )
nx.astar_path_length(G, 'A', 'F', heuristic=distance, weight='day')