1. SyntaxError: Missing parentheses in call to 'print’
所有“print X” 更改为“print(X)”
2. 报错:TypeError: ‘dict_keys’ object is not subscriptable
解决:self._G.node.keys()[:] 改为 list(self._G.node.keys())
3. 报错:AttributeError: ‘collections.defaultdict’ object has no attribute 'itervalues’
解决:m.itervalues() 改为 m.values()
4. 报错:AttributeError: module ‘string’ has no attribute 'atoi’
解决:v_i = string.atoi(s) 改为 v_i = int(s)
5. 报错:TypeError: ‘dict_keys’ object does not support indexing
解决:将dict_keys()类型转化为list
visit_sequence = self._G.keys(); random.shuffle(visit_sequence) 改为 visit_sequence = list(self._G.keys()); random.shuffle(visit_sequence)