# Depth- and Breadth-First Search

DevFeed: [Depth- and Breadth-First Search](<https://devfeed.tech/articles/depth-and-breadth-first-search-40300.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2013/01/22/depth-and-breadth-first-search/>)

Published: 2013-01-22T11:44:27Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [Graphs](<https://devfeed.tech/topics/graphs.md>), [Algorithms](<https://devfeed.tech/topics/algorithms.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>), [graph theory](<https://devfeed.tech/topics/graph-theory.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Python](<https://devfeed.tech/topics/python.md>)

Tags: [algorithms](<https://devfeed.tech/tags/algorithms.md>), [breadth-first-search](<https://devfeed.tech/tags/breadth-first-search.md>), [computer](<https://devfeed.tech/tags/computer.md>), [computer-science](<https://devfeed.tech/tags/computer-science.md>), [data-structures](<https://devfeed.tech/tags/data-structures.md>), [depth-first-search](<https://devfeed.tech/tags/depth-first-search.md>), [graph-theory](<https://devfeed.tech/tags/graph-theory.md>), [graphs](<https://devfeed.tech/tags/graphs.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [programming](<https://devfeed.tech/tags/programming.md>), [python](<https://devfeed.tech/tags/python.md>), [queue](<https://devfeed.tech/tags/queue.md>), [stack](<https://devfeed.tech/tags/stack.md>)

## AI overview

This tutorial introduces graph search through depth-first search and breadth-first search. It reviews directed graphs, vertices, edges, adjacency functions, and implementations of the basic graph data structure in mathematical terms and Python.

## Source excerpt

The graph is among the most common data structures in computer science, and it's unsurprising that a staggeringly large amount of time has been dedicated to developing algorithms on graphs. Indeed, many problems in areas ranging from sociology, linguistics, to chemistry and artificial intelligence can be translated into questions about graphs. It's no stretch to say that graphs are truly ubiquitous. Even more, common problems often concern the existence and optimality of paths from one vertex to another with certain properties.