I\'ve been studying SCC and algorithms about them, and I\'ve seen that people almost always mention that Kosaraju\'s algorithm finds the SCC and also gives them ordered in a (re
Yes. As Tarjan is based on Depth First Search all you have to do is to add the vertexes to the top of a list when each vertex reach the "closed" state.(ie. its dfs/tarjan call ends for that vertex)
Here is a C/C++/Pseudo-Code example:
void tarjan(int u) {
visited[u] = true;
closed[u] = false;
//dfs + tarjan processing
for (vi v = G[u].begin(); v != G[u].end(); v++) {
if (!visited[*v]) {
dfs(*v);
} else if (!closed[*v]) {
// has Cycle
}
}
closed[u] = true;
//add u to the top of your list here
}