Graphs and traversal
1.[2p] An undirected graph has 24 million vertices. How many entries would its adjacency matrix hold, in units of ?
An undirected graph has 24 million vertices. How many entries would its adjacency matrix hold, in units of ?
2.[3p] For a road network with average degree 3, the adjacency list beats the matrix because
For a road network with average degree 3, the adjacency list beats the matrix because
3.[2p] An adjacency matrix is the better choice when a graph is dense, with approaching .
An adjacency matrix is the better choice when a graph is dense, with approaching .
4.[3p] Why does breadth-first search compute fewest-edge distances while depth-first search does not?
Why does breadth-first search compute fewest-edge distances while depth-first search does not?
5.[3p] In the undirected graph with edges AB, AC, BD, CD, CE, DF, EF, FG, GH, EH, how many edges lie on the shortest path from A to G?
In the undirected graph with edges AB, AC, BD, CD, CE, DF, EF, FG, GH, EH, how many edges lie on the shortest path from A to G?
6.[3p] What does a depth-first search edge leading to a grey vertex mean?
What does a depth-first search edge leading to a grey vertex mean?
7.[3p] A must precede B and C, B must precede D, C must precede D and F, D must precede E, F must precede E. Put the vertices in the topological order Kahn's algorithm gives with alphabetical tie-breaking.
A must precede B and C, B must precede D, C must precede D and F, D must precede E, F must precede E. Put the vertices in the topological order Kahn's algorithm gives with alphabetical tie-breaking.
A
B
C
D
E
F
Show the answer
a, b, c, d, f, e
8.[3p] Which of these does a single depth-first search answer in ?
Which of these does a single depth-first search answer in ?
Select all that apply
9.[3p] Match each term to its meaning.
Match each term to its meaning.
DAG
Strongly connected
Sparse graph
Degree
the number of edges at a vertex
the edge count is close to the vertex count
a directed path joins every pair
a directed graph with no cycles
Show the answer
DAG: a directed graph with no cycles Strongly connected: a directed path joins every pair Sparse graph: the edge count is close to the vertex count Degree: the number of edges at a vertex