Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. Convert to the DAG by merging together nodes in the same strongly connected component in a supernode.
- 2. If there are two or more leaf supernodes, output any one node from two different leaf supernodes.
- 3. Otherwise, remove the leaf supernode from the graph and repeat (2)
- 4. Otherwise, there is no such pair.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement