Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

Wide Search Algorithm: Search Algorithm by Width

Understand Wide Search Algorithm: Search Algorithm by Width with clear explanations, practical examples, and useful tips. This updated guide covers the...

Table of Contents

Wide Search Algorithm: Search Algorithm by Width is easier to understand when the core ideas are paired with practical examples. The sections below explain the topic clearly, highlight useful steps, and point out details that can prevent common errors.

What is a search algorithm in width?

The breadth search algorithm (Breadth First Search - BFS for short) walks through a wide graph and uses a queue to memorize adjacent vertices to start the search when no peak is found. adjacent in any loop.

Wide Search Algorithm: Search Algorithm by Width example image 1

As shown in the example above, the search algorithm broadcasts from A to B to E to F then to C , to G and finally to D. This algorithm follows the rule:

Rule 1 : Browse to the adjacent vertices without approval. Mark the vertex that has been approved. Show that peak and push into a queue (queue).

Rule 2 : If no adjacent vertices are found, then delete the first vertex in the queue.

Rule 3 : Repeat Rule 1 and 2 until the queue is empty.

The following table illustrates how search-width algorithms work with a simple example:

Queue initialization (queue)

Wide Search Algorithm: Search Algorithm by Width example image 2

We start browsing vertex S (start vertex) and mark this vertex as approved.

Wide Search Algorithm: Search Algorithm by Width example image 3

Then we find the vertex adjacent to S that has not been approved. In this example we have 3 vertices, and in alphabetical order we select vertex A marked as approved and put A in the queue.

Wide Search Algorithm: Search Algorithm by Width example image 4

Continue to browse vertices adjacent to S as B. Mark as approved and place this vertex in the queue.

Wide Search Algorithm: Search Algorithm by Width example image 5

Continue to browse vertices adjacent to S as C. Mark as approved and place this vertex in the queue.

Wide Search Algorithm: Search Algorithm by Width example image 6

Now vertex S has no adjacent vertices that have not been approved yet. Now we draw A from the queue.

Wide Search Algorithm: Search Algorithm by Width example image 7

From vertex A we have an adjacent vertex of D and an unopened vertex. Marking vertex D is already browsing and queuing.

Wide Search Algorithm: Search Algorithm by Width example image 8

At this point, we see that no vertices are unmarked (not yet approved with the example in this table). But the algorithm continues, we continue to extract vertices from the queue To find all vertices that have not been approved. When the queue is empty, it is the end of the algorithm.

According to Tutorialspoint

Previous lesson: Deep search algorithm

Next lesson: Tree data structure

FAQ

What is a search algorithm in width?

The breadth search algorithm (Breadth First Search - BFS for short) walks through a wide graph and uses a queue to memorize adjacent vertices to start the search when no peak is found. adjacent in any loop.

What is Wide Search Algorithm: Search Algorithm by Width?

What is a search algorithm in width? The breadth search algorithm (Breadth First Search - BFS for short) walks through a wide graph and uses a queue to memorize adjacent vertices to start the search when no peak is found.

Why is Wide Search Algorithm: Search Algorithm by Width important?

A clear understanding of Wide Search Algorithm: Search Algorithm by Width helps you make informed decisions, avoid common mistakes, and use the relevant tools or techniques more effectively.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.