Merge "bugfix - dict item removed during iteration"

This commit is contained in:
Zuul 2018-01-17 14:15:36 +00:00 committed by Gerrit Code Review
commit 15e956848a

View File

@ -230,6 +230,8 @@ class NXAlgorithm(GraphAlgorithm):
@staticmethod @staticmethod
def _apply_edge_attr_filter(graph, edge_attr_filter): def _apply_edge_attr_filter(graph, edge_attr_filter):
for source, target, edge_data in graph._g.edges_iter(data=True): edges_iter = graph._g.edges_iter(data=True, keys=True)
if not check_filter(edge_data, edge_attr_filter): edges_to_remove = [(u, v, k) for (u, v, k, d) in edges_iter
graph._g.remove_edge(u=source, v=target) if not check_filter(d, edge_attr_filter)]
for source, target, key in edges_to_remove:
graph._g.remove_edge(u=source, v=target, key=key)