图——深度优先搜索(Graph - Depth First Search)
简介(Introduction)
Depth-first search(DFS) is an algorithm for traversing or searching tree or graph data structure. One starts at the root(selecting some arbitrary node as the root in the case of a graph) and explores as far as possible along each branch before backtracking.
示例(Example)
DFS order: a, b, d, e, c, f, g.
检索栈(The Traversal Stack)
We can use a traversal stack to track where we are in overall process.