Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Shortest Routing Algorithm Analysis With Dijkstra's algorithm and Bellman Ford

Abstract Problems to find the shortest route is a problem which is very famous in the world of Information Technology. From the beginning until now have been developed various algorithms to solve problems in a search ini. Well-known problem in the search for the shortest route is the traveling salesman problem (TSP). As written above, until recently been a lot of searching to find a solution to this the shortest route. One of them was the famous Dijkstra's algorithm. In addition, as comparative effectiveness of this algorithm we compare it with the algorithm Bellman - Ford algorithm which is also a fairly widely used in this problem. 1. Introduction The main problem of course search to find the shortest route or the shortest route possible. But for implementation, this issue can be developed more widely including to find a minimum cost, etc.. The point is to find the most effective solution that can be applied in the problems. 2. Analysis of Dijkstra's algorithm and Bellman-Ford 2.1 Dijkstra's algorithm Dijkstra algorithm, named for the name of its discoverer, Dutch computer scientist named Edsger Dijkstra, is the algorithm used to find the shortest path in a directed graph. The workings of Dijkstra's algorithm using greedy strategy, where at each step the selected side with the smallest weights that connect a node that has been selected by other nodes that have not been selected.

Picture 1. Directed graph

Table 1. Completion graph in picture 1

2.2 Bellman-Ford algorithm Bellman-Ford algorithm, like Dijkstra's algorithm, is used to find the shortest path in a directed graph. The different is the Bellman-Ford algorithm can be used for the graph that has a side with negative weights, although using a longer time. The complexity of the algorithm is O (nm) where n is the number of vertices and m is the number of sides. Here is one example of implementation of the Bellman-Ford algorithm :
/* defining the data type for a graph */ record vertex { list edges real distance vertex predecessor } record edge { node source node destination real weight } function BellmanFord(list vertices, list edges, vertex source) /* implementation of the graph that represented by a list of node and side, and change the node so that the distance and the predecesor keep distance shortest */ // initialization graph for each vertex v in vertices: if v is source then v.distance = 0 else v.distance := infinity v.predecessor := null

// checking every node for i from 1 to size(vertices): for each edge uv in edges: u := uv.source v := uv.destination // uv is the edge from u to v if v.distance>u.distance+uv.weight v.distance:=u.distance+uv.weight v.predecessor := u // look for negative weighted loops for each edge uv in edges: u := uv.source v := uv.destination if v.distance > u.distance + uv.weight error "Graph contains a negative loop"

3. Conclusion Both the Dijkstra algorithm and the bellman-ford are both used to find the shortest path. However, unlike the Dijkstra algorithm, Bellman-Ford algorithm can be used in a graph that contains the node negative, as long as the graph does not contain a negative loop that can be achieved from the starting point. Dijkstra's algorithm is more advantageous in terms of running time, but for a special issue containing the node negative, bellman-Ford algorithm is more favorable. 4. References http://en.wikipedia.org/wiki/Bellman-Ford_algorithm http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm

You might also like