add tarjan algorithm