38
35
best = distances[ancestor] + 1
42
39
def node_distances(graph, ancestors, start, root_descendants=None):
43
40
"""Produce a list of nodes, sorted by distance from a start node.
44
41
This is an algorithm devised by Aaron Bentley, because applying Dijkstra