Is Dijkstra's Shortest Path Algorithm, the efficient of all algorithms?
-
-
Answer:
Dijkstra's Shortest Path Algorithm Back in 2000, I posted a Graph Search unit that contained the data structure describing graphs (nodes and edges). It has "depth first" and "breadth first" search procedures that look for ways to get from some starting node to some goal node. I recently modified the structure to allow weights to be associated with the edges which connect nodes. A new procedure implements "Dijkstra's Shortest Path Search algorithm, a clever and relatively efficient way to search for shortest paths between nodes. The algorithm finds the shortest paths from a specified start node to any other reachable node (or all reachable nodes) for graphs with positive weights (or costs, or distances) between nodes. Edsger Wybe Dijkstra, programmer, professor, and mathematician, invented and published his Shortest Path algorithm early in his career, around 1960 as best I can determine. He died in 2002, but you can find many of his writings and learn more about his somewhat eccentric character by searching on his full name. I would like to have known him. The immediate motivation was problem number 83 in the Euler Project programming challenges at http://ProjectEuler.net, a great site if you think you are a pretty good programmer. There are other sections of the site with lots of good math problems that do not require programming skills. In any event, Problem 83 asks for the shortest path from top left to bottom right of an 80x80 matrix of positive integers. Moves can be made up, down, left or right which is what makes the problem hard. The demo program included here does not solve that problem, but could be adapted to do so, if you figure out how to represent the matrix as a graph. The demo randomly assigns weights to the same graph used in the 10 node graph in the original Graph Search demo program and calls the Dijkstra search procedure to find the shortest path. I have included a "verbose" feature that will let you see algorithm working step by step. It works so well that I found several ways to improve the program when I first ran "verbosely". I think I'll add the same feature to Depth and Breadth first procedures one of these days. Source: http://delphiforfun.org/programs/Math_Topics/ShortestPath.htm
James_Brown at Amazon Askville Visit the source
Other answers
Dijkstra's Shortest Path Algorithm Dijkstra's algorithm, conceived by Dutch computer scientist Edsger Dijkstra in 1956 and published in 1959,[1][2] is a graph search algorithm that solves the single-source shortest path problem for a graph with nonnegative edge path costs, producing a shortest path tree. This algorithm is often used in routing. An equivalent algorithm was developed by Edward F. Moore in 1957.[3] For a given source vertex (node) in the graph, the algorithm finds the path with lowest cost (i.e. the shortest path) between that vertex and every other vertex. It can also be used for finding costs of shortest paths from a single vertex to a single destination vertex by stopping the algorithm once the shortest path to the destination vertex has been determined. For example, if the vertices of the graph represent cities and edge path costs represent driving distances between pairs of cities connected by a direct road, Dijkstra's algorithm can be used to find the shortest route between one city and all other cities. As a result, the shortest path first is widely used in network routing protocols, most notably IS-IS and OSPF (Open Shortest Path First). Algorithm Let the node at which we are starting be called the initial node. Let the distance of node Y be the distance from the initial node to Y. Dijkstra's algorithm will assign some initial distance values and will try to improve them step by step. 1. Assign to every node a distance value. Set it to zero for our initial node and to infinity for all other nodes. 2. Mark all nodes as unvisited. Set initial node as current. 3. For current node, consider all its unvisited neighbors and calculate their tentative distance (from the initial node). For example, if current node (A) has distance of 6, and an edge connecting it with another node (B) is 2, the distance to B through A will be 6+2=8. If this distance is less than the previously recorded distance (infinity in the beginning, zero for the initial node), overwrite the distance. 4. When we are done considering all neighbors of the current node, mark it as visited. A visited node will not be checked ever again; its distance recorded now is final and minimal. 5. If all nodes have been visited, finish. Otherwise, set the unvisited node with the smallest distance (from the initial node) as the next "current node" and continue from step 3. Source:
TakeaChillPillYo
Related Q & A:
- How to find contour lines for Appel's Hidden Line Removal Algorithm?Best solution by Computer Science
- Where did a downloaded file from SharePoint come from? (it's SharePoint path?Best solution by SharePoint
- How to determine the shortest path?Best solution by Stack Overflow
- What's the difference between prim and dijkstra's algorithm?Best solution by Stack Overflow
- Is the Google's PageRank algorithm a secret?Best solution by Theoretical Computer Science
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.