~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/deprecated_graph.py

  • Committer: John Arbash Meinel
  • Date: 2009-02-23 15:29:35 UTC
  • mfrom: (3943.7.7 bzr.code_style_cleanup)
  • mto: This revision was merged to the branch mainline in revision 4033.
  • Revision ID: john@arbash-meinel.com-20090223152935-oel9m92mwcc6nb4h
Merge the removal of all trailing whitespace, and resolve conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
 
18
18
def max_distance(node, ancestors, distances, root_descendants):
19
 
    """Calculate the max distance to an ancestor.  
 
19
    """Calculate the max distance to an ancestor.
20
20
    Return None if not all possible ancestors have known distances"""
21
21
    best = None
22
22
    if node in distances:
35
35
            best = distances[ancestor] + 1
36
36
    return best
37
37
 
38
 
    
 
38
 
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
128
128
        for parent in parent_ids:
129
129
            self._ensure_descendant(parent)
130
130
            self._graph_descendants[parent][node_id] = 1
131
 
        
 
131
 
132
132
    def _ensure_descendant(self, node_id):
133
133
        """Ensure that a descendant lookup for node_id will work."""
134
134
        if not node_id in self._graph_descendants: