trying to fix some large time complexity for recursive call in SCC