all the index & lowlink values of the nodes are set to -1 in the beginning. global index value is set to 0. My problem is, the algorithm starts running on Vertex X-4. It runs the instruction X-4.index=0 & X-4.lowlink=0 then it calls itself with the paramater of node X-1. it sets X-1's index & lowlink values to 1. then it calls itself for X2. then it checks whether node X-4 has the index value <0 or not. Even though we set the value of X-4 to 0 in the first run, it still sees X-4.index as -1. Does anybody have any idea how to solve this issue? Thanks!
As a blind guess, you are storing a copy of the nodes in the neighbour list. The X-4 that's a neighbour of X-2 is not the same node that you've started the algorithm.
Given that you have all the vertex in a vector, store the index of the node in the vector Vertex &w = G[ v.adjList.at(i) ];