Refactored topsort_component() to avoid duplicate stacking of seen nodes...

....

Currently the topsort_component pushes all successors to the stack
irrespective of it that node is already on the stack. This leads to
node having multiple incoming edges to be on stack only to be popped
later. The change also align this method with post-traverse since both
methods almost perform the same function, except for the check on
'explored' nodes to detect cycles.