[pypy-svn] r47722 - pypy/dist/pypy/tool/algo
fijal at codespeak.net
fijal at codespeak.net
Tue Oct 23 01:56:15 CEST 2007
Author: fijal
Date: Tue Oct 23 01:56:15 2007
New Revision: 47722
Modified:
pypy/dist/pypy/tool/algo/graphlib.py
Log:
Revert last checkin as I see inconsistent results around
Modified: pypy/dist/pypy/tool/algo/graphlib.py
==============================================================================
--- pypy/dist/pypy/tool/algo/graphlib.py (original)
+++ pypy/dist/pypy/tool/algo/graphlib.py Tue Oct 23 01:56:15 2007
@@ -111,10 +111,7 @@
for cycle in all_cycles(random_vertex, component, edges):
#print '\tcycle:', [e.source+e.target for e in cycle]
for edge in cycle:
- try:
- edge_weights[edge] += 1
- except KeyError:
- edge_weights[edge] = 1
+ edge_weights[edge] = edge_weights.get(edge, 0) + 1
if edge_weights:
max_weight = max(edge_weights.values())
for edge, weight in edge_weights.iteritems():
More information about the Pypy-commit
mailing list