Anonymous user
Tarjan: Difference between revisions
→{{header|Python}}: don't use a list as the default argument
(+python) |
(→{{header|Python}}: don't use a list as the default argument) |
||
Line 514:
def trajan(V):
def strongconnect(v, S
v.root = pos = len(S)
S.append(v)
Line 520:
for w in v.succ:
if w.root is None: # not yet visited
yield from strongconnect(w, S)
if w.root >= 0: # still on stack
Line 533:
for v in V:
if v.root is None:
yield from strongconnect(v, [])
|