Algorithms and Data Structures · Junior · Question 58 of 75
What does this adjacency list describe?
const graph = {
A: ["B", "C"],
B: ["C"],
C: [],
};- 1A tree with root C
- ✓Correct answer: A directed graph with edges A → B, A → C and B → C
- 3An undirected graph where every vertex is connected to every other
Explanation
Each key lists the vertices it has edges to. C has no outgoing edges, and nothing points to A. In an undirected graph each edge would appear in both lists.