0

Question: Divide the set of vertices of the graph in Problem 1 into strongly connected components (SCC). Namely, specify which vertices are in the first strongly connected component, which in the second, and so on.

is any one able to confirm ive done this correctly? namely when i reach vertex 4 i have the option to make the first SCC either 1,7,2,4,3 (as shown) or 1,7,2,4,6,5 depending on which way i choose to travel. Is there a method to this, or can i simply just choose?

enter image description here

order:

1,2,7,3,4,5,8,6

SCC:

1,7,2,4,3

5

8

6

Dominique Fortin
  • 2,212
  • 15
  • 20
101ldaniels
  • 301
  • 1
  • 6
  • 15
  • Wrong. How can you get to 4 from 7 without passing through 3? {1,7,2,4,6,5} is simply not a SCC. I think the only SCC is {1,2,3,4,5,6,7} – shole Nov 03 '16 at 03:17
  • @shole yes sorry i didnt preform dfs on reversed graph first. so the strongly connected components are 8 and 1,2,3,4,5,6,7 – 101ldaniels Nov 03 '16 at 03:22

2 Answers2

0

The strongly connected component is {1,2,3,4,5,6,7}. If you don't get that, your algorithm (or your implementation) has a bug. There is a definition of Strongly Connected Component, and several well-known algorithms; both can be found easily in Wikipedia (and many other internet resources) and, most likely, in your textbook and/or course notes. (If you don't have course notes, you'll easily find some for similar courses.)

rici
  • 234,347
  • 28
  • 237
  • 341
0

you can add 5 and 6 to 1,7,2,4,3 since both are reachable from others via 4

In DFS you have to continue visting node and creating tree while the stack is not empty if so, then restsrt with the lowest id which is still white