Conceptio › Archive › Stack Exchange
Stack Exchange open access CC BY-SA

Graph searching: Breadth-first vs. depth-first

malexmave · 2012
Stack Exchange · Datasets · License: CC BY-SA · 2012
Open Source ↗
algorithmscsgraphs
When searching graphs, there are two easy algorithms: breadth-first and depth-first (Usually done by adding all adjactent graph nodes to a queue (breadth-first) or stack (depth-first)). Now, are there any advantages of one over another? The ones I could think of: If you expect your data to be pretty far down inside the graph, depth-first might find it earlier, as you are going down into the deeper parts of the graph very fast. Conversely, if you expect your data to be pretty far up in the graph, breadth-first might give the result earlier. Is there anything I have missed or does it mostly come down to personal preference?
Conceptio Open Archive

Analyze & explore related research in Conceptio

Connect this record directly into your research workflow or AI agent. Explore citations across open repositories, query full text, and export structured proof bundles.

This document is indexed with metadata only: full text is not available in the archive for this record. Open the official source ↗

Related documents

Record · ID 796549
Retrieved via Conceptio: every document is proof-bundled with source, license, and retrieval metadata.
Bring this data into your agent: Connect via MCP or API · 20 free credits to start · no card required
Read the Docs → · View CLI source on GitHub · Conceptio Open Knowledge Archive