Dijkstra of Shortest path and experimental results of bidirectional Dijkstra

Source: Internet
Author: User
1. Experimental data

Data set: City of Oldenburg (OL) Road Network

9 groups of queries are nodes that are far apart 2. The results of the experiment

Recently has been around the bidirectional Dijkstra, on which the important priority queue data structure, has attempted to use the non-indexed two fork heap implementation, indexed two fork heap implementation and the non-indexed Fibonacci implementation three ways. The priority queue with no indexes allows the same nodes to appear, while the indexed priority queue is not allowed. The different implementations run time as shown in table 2-1, where each query runs 10,000 times in units of Ms.

Table 2-1 bidirectional Dijkstra operation result of different priority queue implementation mode

Inquire

Bidirectional Dijkstra

Binary Heap No index t1

Binary Heap has index T2

T2/t1

Fibonacci Heap No Index

1

873

1716

1.96

1982

2

4103

8065

1.96

11466

3

6615

10842

1.63

17207

4

2106

3448

1.63

5460

5

5444

8674

1.59

14804

6

3666

6052

1.65

10046

7

655

1092

1.66

1264

8

4212

6662

1.58

11840

9

6272

9578

1.52

16365

 

Issue 1: an index-free two-fork heap has an average of 1.7 times times faster than an index-implemented priority queue shortest path solution. There are two ways to try the index part: the array index and the hash (CMAP) index, both of which are similar in effect.

Analysis: the time to establish and adjust the index is the same as the time of the storage node, so adding an index inevitably increases the time consumption of the priority queue.

In addition, for non-indexed priority queues, the same nodes appear in the queue at the same time. For the same node, the first out is definitely the smallest, when the other nodes come out to the shortest path of the node has been calculated, only one time to judge. In practice, only the out-of-queue operations that are less than 20% are invalid.

The run-time analysis of the main functions of the non-indexed two-fork two-way Dijkstra is shown in Figure 2-1. The function call relationship is shown in Figure 2-2.


Figure 2-1 Run time of each main function

Figure 2-2 Important Path 3. Experimental results two

For Dijkstra, using a priority queue is nearly 60 times times faster than the normal method. So the Dijkstra that the method realizes is ignored directly in the comparison. Table 3-1 lists the query time, where each group of queries runs 10,000 times, where the priority queue is implemented as an index-free two-fork heap.

Table 3-1 Non-indexed bidirectional Dijkstra vs. Dijkstra time

 

Bidirectional Dijkstra

Dijkstra

1

873

2262

2

4103

6911

3

6615

7425

4

2106

1092

5

5444

7207

6

3666

1872

7

p>655

1154

8

4212

7051

9

6272

7489

 

Issue 2: for query 4 and Query 7 bidirectional Digestra Bidgestra slow.

Analysis: The bidirectional Dijkstra reduces the shortest path calculation of some nodes compared to Dijkstra, that is to reduce the processing nodes. However, the former requires multiple addition operations and consumes a lot of time. 4. The results of the experiment three

Issue 3: Floyd Bidigestra and bidirectional Dijkstra are fast when solving the shortest path for all point pairs. Analysis: There is no duplication problem when solving Floyd, and there are many repeated computations when the shortest path of single source point is solved by multiple runs. Therefore, the Floyd algorithm is better than Dijkstra and bidirectional Dijkstra when solving all pairs or many-to-shortest paths.

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.