build stable sort for graph iteration, then we can get stable result and adatpe details for python 3~

This commit is contained in:
zhangcheng 2015-02-16 15:49:10 +08:00
parent 1152db7736
commit a6d1b2479e

View File

@ -20,10 +20,6 @@ class UndirectWeightedGraph:
self.graph[start].append((start, end, weight))
self.graph[end].append((end, start, weight))
def refactor(self):
for n, _ in self.graph.items():
self.graph[n].sort()
def rank(self):
ws = collections.defaultdict(float)
outSum = collections.defaultdict(float)