RESEARCH ARTICLE An Investigation of Dijkstra and Floyd … · 2014-02-07 · Dijkstra’s Algorithm, Floyd-Warshall Algorithm, Bellman-Ford Algorithm, and Genetic Algorithm (GA)
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Arun Kumar Sangaiah et al, Int. Journal of Computer Science and Mobile Computing,
ABSTRACT:- This paper is focus on design and implementation of the National City traffic advisory procedures. The main aim of this paper provides the optimal decision and transport advisory procedure to the passengers. In this paper we are trying to investigate Dijkstra algorithm and Floyd algorithm implemented in Microsoft Visual Studio in order to establish the storage structure of transportation network and find the shortest path between two cities. We have formulated the optimal decision rules to analyze the time and cost parameters among various cities in china. We have used Dijkstra and Floyd algorithm in order to compare the performance and provide optimal solution to the passengers. Keywords: National City traffic advisory, Dijkstra, Floyd, Microsoft Visual Studio
Arun Kumar Sangaiah et al, Int. Journal of Computer Science and Mobile Computing,
1. Introduction Due to the different purposes the travel of the passengers and its transport requirements are different. For example, for business travel, the passenger wants the time of travel as short as possible. Tourists prefer the cost of travel as minimum as possible. National City traffic advisory procedures can satisfy the passengers demand and provide two to three optimal decision rules according to the transport advisory for passengers. The procedures allow users to look up city information, choose the optimal decision rule and edit city information. At first, the users choose the starting station, the terminal station, the optimal decision rules and traffic tool. The output information are the most time-efficient or the cost- efficient decision, the cost of time and money. Users can also add the city information and edit the cost and the timetable of traffic tools. 2. Literature review This section briefly discusses the Dikjstra and Floyd algorithms adopted in the existing studies. Feng (2005) discussed the taxonomy of the shortest path algorithms from the perspective of problem type, network characteristics and solution techniques and compared to the time complexities. However, the most popular sequential shortest path algorithms are evaluated for their practical efficiency with urban traffic networks. The advance of time dependent and parallel shortest path algorithms is also discussed in many studies The earlier studies [4,5] presented four shortest path algorithms namely Dijkstra’s Algorithm, Floyd-Warshall Algorithm, Bellman-Ford Algorithm, and Genetic Algorithm (GA) for intelligent traffic system. In addition, the earlier study [8] finding shortest path from one node to all other nodes can be derived quickly by using the shortest path algorithm. Further, the earlier study [8] have analyzed dynamic path of all-pairs using shortest path problem for recalculation shortest paths after changing the weight of any single edge. Thus, we can observe two different cases: increasing and decreasing of the weight. The time complexity depends on graph structure and in most cases the time complexity is better than Floyd-Warshall algorithms. In case of decreasing the weight the algorithm which requires O(n^2) time is described. Moreover the earlier study [10] discussed the shortest path between two points in a city road net based on the geographic relevance relationship among roads in the road net. Based on the literature this paper provides some instance which prove applicability and reliability of Dijkstra and Floyd algorithm for national traffic advisory procedures.
3. Proposed Methodology : Dijkstra and Floyd algorithm In this paper, Dijkstra algorithm is been used to search the shortest route from starting station to terminal station. Dijkstra's algorithm is a graph search algorithm that can solve the single-source shortest path problem for a graph with non- negative edge path cost, outputting a shortest path tree. For a given source vertex (node) in the graph, the algorithm finds the path with lowest cost or the shortest path between that vertex and every other vertex. In this paper, transport cost matrix will be initialized first. Users
Arun Kumar Sangaiah et al, Int. Journal of Computer Science and Mobile Computing,
choose the starting station and terminal station, using Dijkstra's algorithm to find the least time and the least cost between the two places. Floyd algorithm The purpose of this Floyd algorithm is to find the shortest paths in a weighted graph with positive or negative edge weights. A single execution of the algorithm will find the lengths (summed weights) of the shortest paths between all pairs of vertices, though it does not return details of the paths themselves. This algorithm can also use in dynamic programming.
Edi
Figure 1: Main Menu
Figure 2: Information Menu
Start
City infomation Search the Shortest time route Search the most cost-saving route Information editing
4. Process flow Description Tourist traffic between the cities is a typical graph structure which can be seen as a directed graph. The vertex is the city and the side is the cost of time or money. We use the adjacency matrix “G->cost[MAX][MAX]” as a data storage structure which can store the cost of money or time between cities. Editing the information of cities and traffic by different functional modules. Using the structure array to save the new cities and the information between cities. Users can look up the city information and choose the optimal decision rule in main menu. According to the specific requirements of optimal decisions we can Use Dijkstra algorithm to find the optimal value from starting station to the terminal station, (minimum time or minimum cost). Using the array “pre[MAX]” to store the previous city which can output the graph of the path. Output the path from the starting city to the destination city (including transit city) and the least time or the least cost of the travel. Process of Dijkstra algorithm is as follows:
1. Define global variables: dist[MAX] , v0,cost[MAX][MAX] and initialize
cost[MAX][ MAX].The starting node is v0. Let final [v0] =1.The remaining points are
assigned to 0:final [vt] = 0
2.Search the node of shortest distance from which final [vt] = 0.Let final [vt] = 1. 3.For each of the adjacent node u, if dist [vt] + w [vt, u] <dist [u], then let dist[u] =dist[vt] + w[vt,u] 4.If i<MAX-1.Then go back to the second step. 5.For any u, dist [u] is the distance from v0 to u.
3. Time-cost of the Dijkstra algorithm and Floyd algorithm(Unit:ns)
Search the shortest time route Time-cost of the
Dijkstra algorithm Time-cost of the Floyd algorithm
From Chengdu to Beijing 20863 ns 135271 ns FromXi’an to Shanghai 20706 ns 127890 ns From Wuhan to Chengdu 21704 ns 128436 ns From Guangzhou to Beijing 20107 ns 126914 ns From Chengdu to Xi’an 20622 ns 125989 ns From Chengdu to Zhengzhou 20328 ns 123984 ns From Xi’an to Liuzhou 20706 ns 124855 ns From Zhuzhou to Guiyang 20202 ns 129801 ns From Guangzhou to Shanghai 21010 ns 134705 ns From Nanling to Xuzhou 21137 ns 126231 ns From Beijing to Tianjing 20171 ns 126683 ns From Xi’an to Guangzhou 19099 ns 126840 ns From Tianjing to Shanghai 20622 ns 125559 ns From Guiyang to Xuzhou 21493 ns 125548 ns From Shanghai to Xuzhou 20454 ns 128226 ns From Nanling to Chengdu 21000 ns 125989 ns
Arun Kumar Sangaiah et al, Int. Journal of Computer Science and Mobile Computing,
From Liuzhou to Chengdu 21609 ns 125402 ns From Zhuzhou to Beijing 19772 ns 127775 ns From Nanling to Shanghai 21746 ns 127837 ns From Beijing to Shanghai 21053 ns 125916 ns
Table 5: Time & Cost computation of Algorithms
Figure 11: Comparative Analysis of Algorithm
6. Discussion of Result
The existing research【2】have analyzed Dijkstra algorithm, PSP (partitioning shortest
path)algorithm and DBFS1(Dynamic Breadth-First Search algorithm and compared these three algorithms. Giving the analysis of DBFS1 algorithm which is the extremely
superior algorithm. The existing papers【10】use shortest path algorithm to find the
shortest path between two points in a city's road net. Using examples demonstrate the availability of models and algorithm.
In this paper,we not only use Dijkstra algorithm to implement the National City traffic
advisory procedures which can satisfy the passengers’ different demand of travel and provide some optimal decision but also compare Dijkstra algorithm with Floyd algorithm in practical case. This paper compares the two algorithms in time-cost of searching the shortest route.
0
20000
40000
60000
80000
100000
120000
140000
160000
180000
Dat
a 1
Dat
a 2
Dat
a 3
Dat
a 4
Dat
a 5
Dat
a 6
Dat
a 7
Dat
a 8
Dat
a 9
Data
10
Data
11
Data
12
Data
13
Data
14
Data
15
Data
16
Data
17
Data
18
Data
19
Data
20
Floyd algorithm
Dijkstra's algorithm
Arun Kumar Sangaiah et al, Int. Journal of Computer Science and Mobile Computing,
We give twenty examples to Search the shortest time route. Measuring the time-cost of the Dijkstra algorithm and the Floyd algorithm. Time units is ‘ns’,1 s=109 ns. As can be seen from the graph, the time-cost of Dijkstra algorithm is less than Floyd algorithm. Comparing the graph and the twenty groups’ data of two algorithms, we can conclude that the time-cost of Dijkstra's algorithm in searching the shortest route is less than Floyd algorithm. Conclusion We have successfully designed and implemented the National City traffic advisory procedures which create a storage structure of transportation network and find the shortest path of the network. The National City traffic advisory procedures satisfy the passengers’ different demand of travel .Enable users to select two means of transportation, train and plane, providing the least time solution and the least cost solution for users. The search of shortest path is achieved by Dijkstra algorithm and Floyd algorithm. Comparing the time-cost of two algorithms, Dijkstra’s algorithm is more effective than Floyd algorithm. References
【1】 Feng, L. U. (2001). Shortest Path Algorithms: Taxonomy and Advance in
Research [J]. Acta Geodaetica Et Cartographic Sinica, 3, 020.
【2】 Sunan, W., Wei, S., & Wensheng, J. (1994). Comparison of the shortest path
algorithms. Systems Engineering and Electronics, 05.
【3】 Krivoshein D Y, Marchenko A M. Algorithms for dynamic all-pairs shortest
path problem[C]//Problems of Perspective Micro-and Nanoelectronic Systems Development-2012 (ÌÝÑ-2012). 2012: 263-266.
【4】 Magzhan K, Jani H M. A Review And Evaluations Of Shortest Path
Algorithms[J]. INTERNATIONAL JOURNAL OF SCIENTIFIC & TECHNOLOGY RESEARCH VOLUME 2, ISSUE 6, JUNE 2013
【5】 Ziliaskopoulos, A. K., & Mahmassani, H. S. (1993). Time-dependent,
shortest-path algorithm for real-time intelligent vehicle highway system applications (No. 1408).
【6】 ZHOU, Y. M., SUN, S. X., & TIAN, L. (2005). Practical parallel algorithm for
all-pairs shortest-path problem [J]. Computer Applications, 12.
Arun Kumar Sangaiah et al, Int. Journal of Computer Science and Mobile Computing,