15,946,342 members
1.00/5 (1 vote)
See more:
I have looked at a few Youtube tutorials on how a breath and depth first search work on a graph but I'm still a little confused.Does anyone have a very simple explanation of the searches possibly a useful video on them or any tips on how to understand it?
Posted

## Solution 1

The first place to start is Google, which lead me straight to Wiki:
http://en.wikipedia.org/wiki/Depth-first_search[^]

The depth first is easier than breadth first, but that is to be expected - it's a lot simpler an algorithm.

## Solution 2

The way I try to look at Breadth First Search is that you try the immediate possibilities first. Depth First you stick to one path until you hit a dead end and then try a different path. Say you are in a room with two doors that's inside another room with two door and you need to find an exit.

Breadth First you would first open the two doors that are in the immediate room and then the two doors in the surrounding room.

Depth First you would open the immediate door and then open the surrounding door. If that fails you would open the second immediate door and then the second surrounding door.

http://www.cs.sunysb.edu/~skiena/combinatorica/animations/search.html[^]

v2