Jim_Moriarty_'s blog

By Jim_Moriarty_, history, 5 years ago, In English
      • This is the code that I have studied for finding SCC and I have several doubts.
Spoiler

//code is from steven and felix book.

Can one node be contained in two SCCs?

5 6

1 4

1 3

2 4

3 4

4 5

5 1

consider this testcase ; 5 is number of nodes and 6 is the number of directed edges. 1 4 means there is an directed edge from 1 to 4.

if I assume that one node is contained in only one SCC then 1->4->5 will be considered or 1->3->4->5 for 1, 4 and 5.

And how we update dfs_low[u] in case of visited node as dfs_low[u]=min(dfs_low[u], dfs_low[v.first]) or as dfs_low[u]=min(dfs_low[u], dfs_num[v.first]). Which one is correct and why ?

Any help would be appreciated.

  • Vote: I like it
  • -11
  • Vote: I do not like it

| Write comment?
»
5 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it
Code

Please post code in code tag like above to read it clearly :)