diff options
author | Mridul Seth <seth.mridul@gmail.com> | 2015-06-16 20:17:04 +0530 |
---|---|---|
committer | Mridul Seth <seth.mridul@gmail.com> | 2015-06-17 15:50:09 +0530 |
commit | 7e15a9c8cfc7583fc23b560439425e75da622146 (patch) | |
tree | f7cf4eb4952ca565fc31992bfa21b25c036455b0 | |
parent | fdc906e462ac8d14c5140b5639a655bee112d3c5 (diff) | |
download | networkx-7e15a9c8cfc7583fc23b560439425e75da622146.tar.gz |
Update changes to G.edges()
-rw-r--r-- | networkx/algorithms/connectivity/cuts.py | 2 | ||||
-rw-r--r-- | networkx/algorithms/hybrid.py | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/networkx/algorithms/connectivity/cuts.py b/networkx/algorithms/connectivity/cuts.py index d8c16d4a..3ebb02aa 100644 --- a/networkx/algorithms/connectivity/cuts.py +++ b/networkx/algorithms/connectivity/cuts.py @@ -581,7 +581,7 @@ def minimum_edge_cut(G, s=None, t=None, flow_func=None): # Initial cutset is all edges of a node with minimum degree node = min(G, key=G.degree) - min_cut = list(G.edges(node)) + min_cut = set(G.edges(node)) # A dominating set is \lambda-covering # We need a dominating set with at least two nodes for node in G: diff --git a/networkx/algorithms/hybrid.py b/networkx/algorithms/hybrid.py index c871c411..5824557d 100644 --- a/networkx/algorithms/hybrid.py +++ b/networkx/algorithms/hybrid.py @@ -74,6 +74,10 @@ def kl_connected_subgraph(G, k, l, low_memory=False, same_as_graph=False): deleted_some=True # hack to start off the while loop while deleted_some: deleted_some=False + # We use `for edge in list(H.edges()):` instead of + # `for edge in H.edges():` because we edit the graph `H` in + # the loop. Hence using an iterator will result in + # `RuntimeError: dictionary changed size during iteration` for edge in list(H.edges()): (u,v)=edge ### Get copy of graph needed for this search |