1

Having a graph and all of it's strongly connected components, I was wondering what the most efficient way to find arcs that connect two SCC. All the solutions I found involve running through all the nodes, and I was wondering if there was a way to do it without having done that, in particular, during the Tarjan algorithm I used to find SCC's in the graph. ANyway to do it in a linear fashion?

Thank you very much!

1 Answers1

0

Just make connections between different vertices a pointer and change the value of each vertice of a given SCC to the same value.

That way you don't have to "search" anything.

Ex: 1->2->3->4->1

That way u get an SCC that contains 1234

then 4->5
and 5->6->7->5

If you store the connections as pointers u just need to change the value 5 in the vertice 5 to a 6 and then go to the pointer from 4 to 5 u get a 6. I am not being very clear hope u get the idea.

Raghu Ariga
  • 1,059
  • 1
  • 19
  • 28