Classical Algorithm Research Series: continued, A *, Dijkstra, two-way BFS algorithm performance comparison and Application of A * Algorithm

Source: Internet
Author: User

This article compares their path-finding processes in the form of a diagram to give you a clear and intuitive impression of them.
We compared the following five algorithms:
1. A * (using the Manhattan distance)
2. A * (using Euclidean distance)
3. A * (using the distance from cherbihov)
4. Dijkstra
5. Bi-Directional Breadth-First-Search (bidirectional Breadth-First Search)

For exampleGreenThe color square indicates the starting point,RedThe color square represents the target point,PurpleColor blocks represent obstacles, and white blocks represent accessible paths.
Below, we can place the starting point green blocks and the target point red blocks at will, and then draw some obstacles between them,
Finally, run the program and use the above five algorithms to obtainTheir respective paths, their respective scopes covered in the process, and their respective workflowsAnd you can see their efficiency.


A * Performance Comparison of Dijkstra and BFS algorithms:
OK. Three statuses of any green block and red block are displayed:
I. Starting Point green block, which is in the same horizontal line as the target point red block:


Their respective Search paths are:
1. A * (using the Manhattan distance)

2. A * (using Euclidean distance)

3. A * (using the distance from cherbihov)

4. Dijkstra algorithm. // it is obvious that Dijkstra search efficiency is much lower than A * algorithm. (You can easily see the path and coverage of the red block of the target point. The comparison below is based on the same principle.View paths, view coverage, and evaluate the efficiency of an algorithm).

 

5. Bi-Directional Breadth-First-Search (bidirectional Breadth-First Search)

 

2. The starting point is green, and the target point is red on a diagonal line:

Their respective Search paths are:
1. A * (using the Manhattan distance)

2. A * (using Euclidean distance)

3. A * (using the distance from cherbihov)

4. Dijkstra algorithm. // Compared with the preceding A * algorithm, the algorithm has A large coverage and low search efficiency.

 

5. Bi-Directional Breadth-First-Search (bidirectional Breadth-First Search)

 

3. Starting Point green block, the red block of the target point is blocked by multiple obstacles:

The respective Search Path is (Similarly, from green block to red block):
1. A * (using the Manhattan distance)

2. A * (using Euclidean distance )..

3. A * (using the distance from cherbihov)

4. Dijkstra ....

5. Bi-Directional Breadth-First-Search (bidirectional Breadth-First Search)// The coverage is as large as the Dijkstra algorithm, and the efficiency is low.


A * efficiency of search algorithms
As shown above, do I have A general impression on the performance of A *, Dijkstra, and bidirectional BFS algorithms? From the above demonstration, we can see that in the shortest path search efficiency, there are generally A *> Dijkstra, two-way BFS, where Dijkstra, two-way BFS in the end which algorithm is better, depending on the specific situation.
From the above, we can also see that A * search algorithm is indeed A more efficient pathfinding algorithm.

A * process with the most core AlgorithmsWhen you select the next search pointPoint found but not searchedMedium (may be different layers or not on the same branch), select the node with the minimum F value for expansion

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.