ISBN: | 978-5-5139-1868-4 |
High Quality Content by WIKIPEDIA articles! Depth-first search (DFS) is an algorithm for traversing or searching a tree, tree structure, or graph. One starts at the root (selecting some node as the root in the graph case) and explores as far as possible along each branch before backtracking.