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