rag copy in threshold cut

This commit is contained in:
Vighnesh Birodkar
2014-08-06 02:46:29 +05:30
parent 452921d9f2
commit 69fec94326
+1
View File
@@ -47,6 +47,7 @@ def cut_threshold(labels, rag, thresh):
"""
# Because deleting edges while iterating through them produces an error.
rag = rag.copy()
to_remove = [(x, y) for x, y, d in rag.edges_iter(data=True)
if d['weight'] >= thresh]
rag.remove_edges_from(to_remove)