tarjan.py with bug fix

Tarjan.py with bug fix commit