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