Commit f8bcaa5d by Dmitrijs Milajevs

Fixing DependencyGraph.left_children() and .right_children().

parent 7216fb5a
...@@ -161,7 +161,7 @@ class DependencyGraph(object): ...@@ -161,7 +161,7 @@ class DependencyGraph(object):
Returns the number of left children under the node specified Returns the number of left children under the node specified
by the given address. by the given address.
""" """
children = self.nodes[node_index]['deps'] children = chain.from_iterable(self.nodes[node_index]['deps'].values())
index = self.nodes[node_index]['address'] index = self.nodes[node_index]['address']
return sum(1 for c in children if c < index) return sum(1 for c in children if c < index)
...@@ -170,7 +170,7 @@ class DependencyGraph(object): ...@@ -170,7 +170,7 @@ class DependencyGraph(object):
Returns the number of right children under the node specified Returns the number of right children under the node specified
by the given address. by the given address.
""" """
children = self.nodes[node_index]['deps'] children = chain.from_iterable(self.nodes[node_index]['deps'].values())
index = self.nodes[node_index]['address'] index = self.nodes[node_index]['address']
return sum(1 for c in children if c > index) return sum(1 for c in children if c > index)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment