how is a breadth first search performed on a graph?
Go to solution
Solved by DavidTheWin,
(Imagine there are lines below)
A
B C D
D E F G H I
Breadth first means you first look at all the child nodes of the parent node before looking at any child nodes of the child nodes. If A is the parent node then breadth first means examining B C and D first then DE FGH and I in that order.
Depth first search would be exhausting all child nodes of one node before continuing to the others, e.g. here it would look at D first (A->B->D) then E then B then C F G H D I A
Basically, at a high level, it expands out like a pool of water and it stops whenever it gets to its target, it just moves one step outward, dumbly.
Visualized: https://qiao.github.io/PathFinding.js/visual/
This is a very particular type of graph. The case I listed is a more general form.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now