summaryrefslogtreecommitdiff
path: root/networkx/relabel.py
diff options
context:
space:
mode:
authorAric Hagberg <aric.hagberg@gmail.com>2011-03-26 17:45:08 -0600
committerAric Hagberg <aric.hagberg@gmail.com>2011-03-26 17:45:08 -0600
commit0ae2c8a6803fa67c04ff1adc2d779064b7c1f488 (patch)
treeafa759fa103c7a460ef54a81305559816c8b8735 /networkx/relabel.py
parent5a198764840741c3e38aa7e485b53ec0bcebb7ff (diff)
downloadnetworkx-0ae2c8a6803fa67c04ff1adc2d779064b7c1f488.tar.gz
Fix for relabel toposort to work with Python3.
Addresses #525
Diffstat (limited to 'networkx/relabel.py')
-rw-r--r--networkx/relabel.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/networkx/relabel.py b/networkx/relabel.py
index c7eb8d01..c3c5ee7e 100644
--- a/networkx/relabel.py
+++ b/networkx/relabel.py
@@ -86,7 +86,8 @@ def _relabel_inplace(G, mapping):
if len(old_labels & new_labels) > 0:
# labels sets overlap
# can we topological sort and still do the relabeling?
- D=nx.DiGraph(mapping.items())
+ D=nx.DiGraph(list(mapping.items()))
+
D.remove_edges_from(D.selfloop_edges())
try:
nodes=nx.topological_sort(D)