GATE Computer ScienceVery hardGATE CS (PYQ pattern)
The directed graph on vertices 0–7 has edges 0→1, 1→2, 2→0, 2→3, 4→3, 4→5, 5→4, 6→5, 3→7, 7→3. For how many ordered pairs (u, v) with u ≠ v is v reachable from u?
- A. 22
- B. 24
- C. 26
- D. 28
Correct answer: B. 24
Reach sets: {0,1,2} reach 3 each other vertex in {0,1,2} plus 3 and 7 → 4 targets each (12 total); 3 and 7 reach each other (2); 4 reaches 5, 3, 7 (3), 5 reaches 4, 3, 7 (3); 6 reaches 5, 4, 3, 7 (4): total 12 + 2 + 3 + 3 + 4 = 24.
More Algorithms questions
- A transformation is applied to a connected undirected graph with positive edge weights, and the result is compared with the original…
- Which of the following statements about minimum spanning trees of a connected weighted undirected graph is/are correct? I. If all edge…
- A graph has V = 1000 vertices and E = 250000 edges. Two Dijkstra implementations are compared by counting basic steps (ignoring…
- What is the smallest m such that every simple undirected graph with 12 vertices and m edges is 2-connected (connected, and stays connected…
- Bellman–Ford is run from S on a directed graph with edges S→A 2, A→B 3, B→C −4, C→A 0, C→D 5, D→E 1, E→H 2, S→F 7, F→G −2, S→I 4, I→F 1…
- What is the smallest possible value of the largest edge weight on a path from E to D in the graph with edges AB 6, AC 1, AD 5, BC 5, BE 3…