Practice Problems Graphs I
Practice Problems Graphs I
12. How can we use DFS to figure out if there is a path from every vertex to every other
vertex?
13. Design an efficient algorithm to check if the number of the graph is a directed acyclic
graph (DAG). What will be the complexity?
14. Design an efficient algorithm to check if all vertices are part of a single cycle. What will
be the complexity?
15. Design an efficient algorithm to check if all vertices are part of some cycle of more than
2 vertices. What will be the complexity?
16. Design an efficient algorithm to check if there exists a pair of vertices (u, v) such that
there is a path from u to v and there is a path from v to u. Complexity?
17. Design an efficient algorithm to check if there exists a pair of vertices (u, v) such that
there is a path from u to v but there is no path from v to u. Complexity?
18. Design an efficient algorithm to check if there exists no such pair of vertices (u, v) such
that there is a path from u to v and a there is a path from v to u. Complexity?
19. Design an efficient algorithm to check if there exists no such pair of vertices (u, v) such
that there is a path from u to v but there is no path from v to u. Complexity?
20. Design an efficient algorithm to check if all vertices are part of a tree (there may be
more than one tree). Complexity?