Skip to content

Commit 0cdd92d

Browse files
karencbluemellophone
authored andcommitted
Fix selfloop_edges AttributeError in algo/graph/mixin_helpers.py
When running the test `wbia/algo/graph/mixin_dynamic.py::NonDynamicUpdate.apply_nondynamic_update:0`: ``` Traceback (most recent call last): File "/virtualenv/env3/lib/python3.6/site-packages/xdoctest/doctest_example.py", line 556, in run exec(code, test_globals) File "<doctest:/wbia/wildbook-ia/wbia/algo/graph/mixin_dynamic.py::NonDynamicUpdate.apply_nondynamic_update:0>", line rel: 9, abs: 1298, in <module> >>> infr.assert_neg_metagraph() File "/wbia/wildbook-ia/wbia/algo/graph/mixin_helpers.py", line 716, in assert_neg_metagraph [ne[0] for ne in list(infr.neg_metagraph.selfloop_edges())] AttributeError: 'NiceGraph' object has no attribute 'selfloop_edges' ``` This is because networkx has moved some methods from the base graph class into the main namespace. See https://networkx.github.io/documentation/stable/release/migration_guide_from_1.x_to_2.0.html. So need to change ``` infr.neg_metagraph.selfloop_edges() ``` to ``` nx.selfloop_edges(infr.neg_metagraph) ```
1 parent 114a4d3 commit 0cdd92d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

wbia/algo/graph/mixin_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ def assert_neg_metagraph(infr):
713713

714714
# Self loops should correspond to the number of inconsistent components
715715
neg_self_loop_nids = sorted(
716-
[ne[0] for ne in list(infr.neg_metagraph.selfloop_edges())]
716+
[ne[0] for ne in list(nx.selfloop_edges(infr.neg_metagraph))]
717717
)
718718
incon_nids = sorted(infr.nid_to_errors.keys())
719719
assert neg_self_loop_nids == incon_nids

0 commit comments

Comments
 (0)