summaryrefslogtreecommitdiff
path: root/networkx/classes/multigraph.py
diff options
context:
space:
mode:
authorDan Schult <dschult@colgate.edu>2010-11-29 14:23:25 -0500
committerDan Schult <dschult@colgate.edu>2010-11-29 14:23:25 -0500
commit9a4cfddf9ad23b32bc6c0b8a87635e51fb1ecd4a (patch)
tree4f152bb95e7364703ade3ee37cd67820a8d0f26b /networkx/classes/multigraph.py
parent756520299fced68d9582ad9b3a5d205a1638b947 (diff)
downloadnetworkx-9a4cfddf9ad23b32bc6c0b8a87635e51fb1ecd4a.tar.gz
Start edge key search at len(keydict) instead of 0 to save time with many multiedges.
--HG-- extra : rebase_source : 67b261bf1d622af0e14f6e9787acbc5b052db253
Diffstat (limited to 'networkx/classes/multigraph.py')
-rw-r--r--networkx/classes/multigraph.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/networkx/classes/multigraph.py b/networkx/classes/multigraph.py
index 236ea458..2a1e6593 100644
--- a/networkx/classes/multigraph.py
+++ b/networkx/classes/multigraph.py
@@ -253,7 +253,7 @@ class MultiGraph(Graph):
if key is None:
# find a unique integer key
# other methods might be better here?
- key=0
+ key=len(keydict)
while key in keydict:
key+=1
datadict=keydict.get(key,{})
@@ -344,7 +344,7 @@ class MultiGraph(Graph):
if key is None:
# find a unique integer key
# other methods might be better here?
- key=0
+ key=len(keydict)
while key in keydict:
key+=1
datadict=keydict.get(key,{})