@@ -201,7 +201,7 @@ def bipartition_tree(
201
201
tree is not provided
202
202
:param choice: :func:`random.choice`. Can be substituted for testing.
203
203
"""
204
- populations = {node : graph .nodes [ node ][ pop_col ] for node in graph .node_indicies }
204
+ populations = {node : graph .lookup ( node , pop_col ) for node in graph .node_indicies }
205
205
206
206
possible_cuts = []
207
207
if spanning_tree is None :
@@ -231,7 +231,7 @@ def _bipartition_tree_random_all(
231
231
choice = random .choice ,
232
232
):
233
233
"""Randomly bipartitions a graph and returns all cuts."""
234
- populations = {node : graph .nodes [ node ][ pop_col ] for node in graph .node_indicies }
234
+ populations = {node : graph .lookup ( node , pop_col ) for node in graph .node_indicies }
235
235
236
236
possible_cuts = []
237
237
if spanning_tree is None :
@@ -342,7 +342,7 @@ def recursive_tree_part(
342
342
part_pop = 0
343
343
for node in nodes :
344
344
flips [node ] = part
345
- part_pop += graph .nodes [ node ][ pop_col ]
345
+ part_pop += graph .lookup ( node , pop_col )
346
346
debt += part_pop - pop_target
347
347
remaining_nodes -= nodes
348
348
@@ -385,7 +385,7 @@ def get_seed_chunks(
385
385
386
386
chunk_pop = 0
387
387
for node in graph .node_indicies :
388
- chunk_pop += graph .nodes [ node ][ pop_col ]
388
+ chunk_pop += graph .lookup ( node , pop_col )
389
389
390
390
while True :
391
391
epsilon = abs (epsilon )
@@ -425,7 +425,7 @@ def get_seed_chunks(
425
425
426
426
part_pop = 0
427
427
for node in remaining_nodes :
428
- part_pop += graph .nodes [ node ][ pop_col ]
428
+ part_pop += graph .lookup ( node , pop_col )
429
429
part_pop_as_dist = part_pop / num_chunks_left
430
430
fake_epsilon = epsilon
431
431
if num_chunks_left != 1 :
0 commit comments