Give a graph:
Input:
0 -> 1
2 -> 1
3 -> 1
Representation:
0 -> 1 <- 2
^
|
3
This graph is not strongly connected because not every vertex u
can reach vertex v
and vice versa (path u to v and v to u)
The algorithm I am currently using for checking if the directed graph is strongly connected is applying DFS from each vertex O(n3), if I can find N-1 vertices from the N vertices, then the digraph is strongly connected.
Alternative algorithm is Tarjan's algorithgm.
But is this graph considered connected (not strongly) ? If yes, what would be a good algorithm to apply.
Thank you