[Solved] Determine if there is a path between all vertex pairs on an directed graph
The following algorithm can me implemented with O(N+M) complexity. Take any vertex u. Use flood fill algorithm to reach other vertices. If any vertex is not reachable, return NOK. Now do the same, but go to the opposite direction. If any vertex is not reachable, return NOK. Return OK. (Here we know that there is … Read more