Challenge: Check If a Graph Is Strongly Connected

Solve the challenge to determine whether a graph is strongly connected or not.

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 pairs of vertices.

Input

A directed graph and its source.

Output

Return true if it’s a strongly connected graph, but false otherwise.

Sample input

Graph:

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.