Reputation: 323
I have to design an algorithm as from BFS or DFS to do the following, given G=(V,E) a directed graph:
Check whether there is at most one simple path from s to any other vertex u in V. This algorithm has to be on O(|V|+|E|).
And from the previous algorithm, I have to design another one O(|V||E|) algorithm to check whether there is at most one simple path between any two vertices u and v.
I hope you can help me! Thanks a lot in advance!
Upvotes: 0
Views: 844