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?