Algorithms and Data Structures · Junior · Question 58 of 75

What does this adjacency list describe?

const graph = {
  A: ["B", "C"],
  B: ["C"],
  C: [],
};

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.

Further reading

Problem with a question

Algorithms and Data Structures · Junior · question 58

Test yourself

Take the Algorithms and Data Structures · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz