Explore key concepts of strongly connected components in directed graphs with a focus on Kosaraju’s and Tarjan’s algorithms. This quiz is designed to reinforce understanding of SCC definitions, algorithm steps, and practical examples in graph theory.
What best describes a strongly connected component (SCC) in a directed graph?
Explanation: A strongly connected component is defined as a maximal set of vertices in a directed graph such that every vertex is reachable from every other vertex in this set. Option B incorrectly describes a sink, not an SCC. Option C refers to a source set, not to SCCs. Option D only requires a cycle but misses the maximal reachability property needed for SCCs.
What is the first major step in Kosaraju’s algorithm for finding SCCs in a directed graph?
Explanation: Kosaraju’s algorithm begins with a full DFS on the original graph, noting the finishing order of vertices. Reversing edges comes after this initial step. Finding vertices with no incoming edges and sorting by degree are not required in Kosaraju’s method.
In Tarjan’s algorithm, what does the 'low-link' value of a node represent?
Explanation: Tarjan’s low-link value for each node indicates the earliest visited node reachable from the subtree rooted at that node, including itself, via DFS. Option B is the in-degree, not low-link. Option C defines an unrelated count. Option D references total degree but low-link is based on traversal, not connectivity degree.
What is the purpose of the second pass in Kosaraju's algorithm after reversing the graph’s edges?
Explanation: The second pass runs DFS in the order determined by the finishing times, revealing distinct SCCs. Detecting cycles, finding minimum spanning trees, and shortest path calculations are not objectives of this step in Kosaraju’s algorithm.
Why does Tarjan’s algorithm use a stack to keep track of nodes during traversal?
Explanation: Tarjan’s algorithm uses a stack to keep track of active nodes as it traverses the graph using DFS; this ensures it correctly groups nodes into SCCs when low-link values match. Storing for topological sorting or for final representatives are not the purposes in Tarjan’s context. Keeping leaf nodes alone does not track SCC paths.
Given a directed graph with edges: 1→2, 2→3, 3→1, 4→5, which of the following is one of its SCCs?
Explanation: Vertices 1, 2, and 3 form a cycle where each node is reachable from the others, creating an SCC. Option B contains disconnected nodes. Options C and D combine nodes with no mutual reachability, so they are not valid SCCs.
What is the time complexity of both Kosaraju's and Tarjan's algorithms for finding all SCCs in a directed graph with V vertices and E edges?
Explanation: Both Kosaraju's and Tarjan's algorithms operate in linear time relative to the size of the graph, O(V+E). The complexities O(V*E), O(E^2), and O(V^2) represent much slower algorithms, not suitable for SCC finding in practical cases.
In Kosaraju’s algorithm, why is it necessary to reset all nodes to 'unvisited' after the first DFS before starting the second DFS on the reversed graph?
Explanation: Resetting the visited state allows the second DFS to freshly explore each SCC as a separate entity. Memory corruption is unrelated, and topological sorting is not a focus here. Keeping the original order is also not achieved by resetting visited flags.
What can you say about the strongly connected components of a directed acyclic graph (DAG) with five vertices?
Explanation: In a DAG, no cycles exist, so each vertex is only strongly connected to itself, forming single-vertex SCCs. Option B is incorrect since all nodes cannot reach each other. Cycles are absent in DAGs, so option C fails. Option D is incorrect because each vertex still forms an SCC, even if alone.
Why might someone choose Tarjan’s algorithm over Kosaraju’s algorithm for finding SCCs in large graphs?
Explanation: Tarjan achieves the SCC decomposition in a single DFS traversal, minimizing passes and often using less memory. It does not compute minimum spanning trees, and Kosaraju can handle self-loops. Both algorithms are designed for directed graphs, not strictly undirected as mislabeled in option D.