Science Fair Projects Ideas - Breadth-first search

All Science Fair Projects

      

Science Fair Project Encyclopedia for Schools!

  Search    Browse    Forum  Coach    Links    Editor    Help    Tell-a-Friend    Encyclopedia    Dictionary     

Science Fair Project Encyclopedia

For information on any area of science that interests you,
enter a keyword (eg. scientific method, molecule, cloud, carbohydrate etc.).
Or else, you can start by choosing any of the categories below.

Breadth-first search

In computer science, breadth-first search (BFS) is a tree search algorithm used for traversing or searching a tree, tree structure, or graph. Intuitively, you start at the root node and explore all the neighboring nodes. Then for each of those nearest nodes, explore their unexplored neighbor nodes, and so on until it finds the goal.

Formally, BFS is an uninformed search method that aims to expand and examine all nodes of a tree systematically in search of a solution. In other words, it exhaustively searches the entire tree without considering the goal until it finds it. It does not use a heuristic.

From the standpoint of the algorithm, all child nodes obtained by expanding a node are added to a FIFO queue. In typical implementations, nodes that have not yet been examined for their neighbors are placed in some container (such as a queue or linked list) called "open" and then once examined are placed in the container "closed".

When searching in an unweighted cyclic graph (one that is not a tree) for a shortest path, BFS may be adapted by keeping a bit on each node to indicate that it has already been visited.

  • BFS is complete - it finds a goal-state if one exists. (That is, it reaches every node on the tree.)
  • BFS is optimal - it finds the smallest number of steps to reach the goal.
  • BFS has space complexity linear in the size(edges plus vertices) of the tree/graph searched as it needs to store all expanded nodes in memory.
  • BFS has time complexity linear in the size(edges plus vertices) of the graph or tree searched.

For the following graph:

Image:graph.traversal.example.png

a breadth-first search starting at A, and assuming that the left edges in the shown graph are chosen before right edges, will result in the search visiting the nodes in the following order: A, B, C, E, D, F, G. Compare with depth-first search.

Pseudocode


 function BFS (Start, Goal) { 
     push(Queue,Start)
     while notEmpty(Queue)) {
         Node := pop(Queue)
         if Node = Goal {
             return Node
         }
         for each Child in Expand(Node) {
           push(Queue, Child)
         }
     }
 }

See also

External links

03-10-2013 05:06:04
The contents of this article is licensed from www.wikipedia.org under the GNU Free Documentation License. Click here to see the transparent copy and copyright details
Science kits, science lessons, science toys, maths toys, hobby kits, science games and books - these are some of many products that can help give your kid an edge in their science fair projects, and develop a tremendous interest in the study of science. When shopping for a science kit or other supplies, make sure that you carefully review the features and quality of the products. Compare prices by going to several online stores. Read product reviews online or refer to magazines.

Start by looking for your science kit review or science toy review. Compare prices but remember, Price $ is not everything. Quality does matter.
Science Fair Coach
What do science fair judges look out for?
ScienceHound
Science Fair Projects for students of all ages
All Science Fair Projects.com Site
All Science Fair Projects Homepage
Search | Browse | Links | From-our-Editor | Books | Help | Contact | Privacy | Disclaimer | Copyright Notice