Tarjan's strongly connected components algorithm in python not working
问题 I implemented the Tarjan's strongly connected components algorithm, according to wikipedia, in Python, but it isn't working. The algorithm is quite short and I cannot find any difference, so I cannot tell why it isn't working. I tried to check the original paper, but could not find it. Here is the code. def strongConnect(v): global E, idx, CCs, c, S idx[v] = (c, c) #idx[v][0] for v.index # idx[v][1] for v.lowlink c += 1 S.append(v) for w in [u for (v2, u) in E if v == v2]: if idx[w][0] < 0: