Can I make assumptions in BFS and DFS?

Sunday, May 4, 2014

I'm reviewing the concepts of Depth-first search (DFS) and Breath-first search (BFS), but I always forget if I can assume some rules.

I know that in a DFS I will start with the root and go as far as I can, before come back, (...) and in a BFS I will start visiting the root and all its neighbors, (...)

My question is, in case that I have more than one option, can I make assumptions or "rules"?


  • DSF in a graph that my nodes are letters - I decided that from the root I will start search in the alphabetical order.

  • BFS in a tree - I decided that I will always start from the neighbor from the left.

Is okay define this things or there is a major rule (besides the purpose of the search)?