Graph Search: Exercise

  • Identify reachable vertices in a graph from a source vertex.

Exercise Identify the set of vertices reachable from $s$ and from $x$, in the following graph:

Solution
  • The set of vertices reachable from $s$ is $\{s, u, v\}$.
  • The set of vertices reachable from $x$ is $\{x\}$.