1

While solving questions regarding DFS I have noticed something with I couldn't formally prove or find a contradict example.

let's consider a directed graph g

u, v are in the same SCC (strong connect component) iff u, v are in the same DFS tree in every run of DFS.

is my claim correct?

  • what do you mean by ring true? let's suppose we have a third vertex such that it's not connected to anything then this won't change my claim at all (you can delete it and it has no impact) @paddy –  May 07 '21 at 11:32

1 Answers1

0

Yes, it's true.

If u and v are in the same strongly connected component, then there's paths from u to v, and from v to u. Consider any DFS in which u appears, and consider (for contradiction) the first vertex on the path from u to v that doesn't appear in this run of a DFS. But then there's a vertex on the path just before this one that does appear, and an edge from that vertex to the one that doesn't appear. But that's a contradiction because of how DFS works, so every vertex on the path from u to v appears in the DFS, and so v appears in the DFS. (We can make the same argument with u and v swapped).

Conversely, suppose in every DFS that u appears v (and vice versa). But then the DFS that starts from u includes v, which means there's a path from u to v. (And again, we can apply symmetry to get the same with u and v swapped).

Paul Hankin
  • 54,811
  • 11
  • 92
  • 118
  • "and an edge from that vertex to the one that doesn't appear" why is that? can you add more details –  May 07 '21 at 12:31
  • Adjacent vertices on a path are connected by an edge - that's the definition of a path. – Paul Hankin May 07 '21 at 14:13
  • I missed that, accepted answer, please take a look at: https://stackoverflow.com/questions/67434161/minimum-spanning-trees-of-sub-graphs no need for detailed answer but a small guide if it's true or not –  May 07 '21 at 14:20