The running times of the depth-first-search and breadth-first-search
algorithms are somewhat overstated by the Theorems 12.3 and
12.4. Define
as the number of vertices,
,
of
, for which there exists a path from
to
. Define
as the number of edges that have these vertices as their sources.
Then the following theorem is a more precise statement of the running
times of the breadth-first-search and depth-first-search algorithms.
(This more refined statement of the running time is useful in some of
the applications of these algorithms outlined in the exercises.)
Breadth-first search seems to have been discovered independently by Moore [43] and Lee [42] in the contexts of maze exploration and circuit routing, respectively.
Adjacency-list representations of graphs were first popularized by
Hopcroft and Tarjan [34] as an alternative to the (then more
common) adjacency-matrix representation. This representation, and
depth-first-search, played a major part in the celebrated Hopcroft-Tarjan
planarity testing algorithm that can determine, in
time, if
a graph can be drawn, in the plane, and in such a way that no pair of
edges cross each other [35].
In the following exercises, an undirected graph is one in which, for
every
and
, the edge
is present if and only if the
edge
is present.
opendatastructures.org