Challenge 6: Check If Graph is Strongly Connected
Given a graph, check whether it is strongly connected or not.
We'll cover the following
Problem Statement
Implement a function that tells us whether a graph is strongly connected or not.
A directed graph is strongly connected if there is a path between any two pair of vertices.
Input
A directed graph and its source.
Output
true
if it’s a strongly connected graph, but false
otherwise.
Sample Input
graph = {
0 -> 1
1 -> 2
2 -> 3
3 -> 0
2 -> 4
4 -> 2
}
Sample Output
true
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.