Lecture 18 Solving Shortest Path Problem: Dijkstra’s Algorithm

2y ago
28 Views
2 Downloads
2.35 MB
19 Pages
Last View : 21d ago
Last Download : 3m ago
Upload by : Lilly Kaiser
Transcription

Lecture 18Solving Shortest Path Problem:Dijkstra’s AlgorithmOctober 23, 2009

Lecture 18Outline Focus on Dijkstra’s Algorithm Importance: Where it has been used? Algorithm’s general description Algorithm steps in detail ExampleOperations Research Methods1

Lecture 18One-To-All Shortest Path ProblemWe are given a weighted network (V, E, C) with node set V , edge set E ,and the weight set C specifying weights cij for the edges (i, j) E . We arealso given a starting node s V . The one-to-all shortest path problem isthe problem of determining the shortest path from node s to all the othernodes in the network.The weights on the links are also referred as costs.Operations Research Methods2

Lecture 18Algorithms Solving the Problem Dijkstra’s algorithm Solves only the problems with nonnegative costs, i.e.,cij 0 for all (i, j) E Bellman-Ford algorithm Applicable to problems with arbitrary costs Floyd-Warshall algorithm Applicable to problems with arbitrary costs Solves a more general all-to-all shortest path problemFloyd-Warshall and Bellman-Ford algorithm solve the problems on graphsthat do not have a cycle with negative cost.Operations Research Methods3

Lecture 18Importance of Dijkstra’s algorithmMany more problems than you might at first think can be cast as shortestpath problems, making Dijkstra’s algorithm a powerful and general tool.For example: Dijkstra’s algorithm is applied to automatically find directions betweenphysical locations, such as driving directions on websites like Mapquestor Google Maps. In a networking or telecommunication applications, Dijkstra’s algorithmhas been used for solving the min-delay path problem (which is theshortest path problem). For example in data network routing, the goalis to find the path for data packets to go through a switching networkwith minimal delay. It is also used for solving a variety of shortest path problems arising inplant and facility layout, robotics, transportation, and VLSI design Very Large Scale IntegrationOperations Research Methods4

Lecture 18General DescriptionSuppose we want to find a shortest path from a given node s to other nodesin a network (one-to-all shortest path problem) Dijkstra’s algorithm solves such a problem It finds the shortest path from a given node s to all other nodes inthe network Node s is called a starting node or an initial node How is the algorithm achieving this? Dijkstra’s algorithm starts by assigning some initial values for thedistances from node s and to every other node in the network It operates in steps, where at each step the algorithm improves thedistance values. At each step, the shortest distance from node s to another node isdeterminedOperations Research Methods5

Lecture 18Formal DescriptionThe algorithm characterizes each node by its stateThe state of a node consists of two features:distance value and status label Distance value of a node is a scalar representing an estimate of the itsdistance from node s. Status label is an attribute specifying whether the distance value of anode is equal to the shortest distance to node s or not. The status label of a node is Permanent if its distance value is equalto the shortest distance from node s Otherwise, the status label of a node is TemporaryThe algorithm maintains and step-by-step updates the states of the nodesAt each step one node is designated as currentOperations Research Methods6

Lecture 18NotationIn what follows: d denotes the distance value of a node . p or t denotes the status label of a node, where p stand for permanentand t stands for temporary cij is the cost of traversing link (i, j) as given by the problemThe state of a node is the ordered pair of its distance value d and itsstatus label.Operations Research Methods7

Lecture 18Algorithm StepsStep 1. Initialization Assign the zero distance value to node s, and label it as Permanent.[The state of node s is (0, p).] Assign to every node a distance value of and label them asTemporary. [The state of every other node is ( , t).] Designate the node s as the current nodeOperations Research Methods8

Lecture 18Step 2. Distance Value Update and Current Node Designation UpdateLet i be the index of the current node.(1) Find the set J of nodes with temporary labels that can be reachedfrom the current node i by a link (i, j). Update the distance valuesof these nodes. For each j J , the distance value dj of node j is updated as followsnew dj min{dj , di cij }where cij is the cost of link (i, j), as given in the network problem.(2) Determine a node j that has the smallest distance value dj among allnodes j J ,find j such thatmin dj dj j J(3) Change the label of node j to permanent and designate this node asthe current node.Operations Research Methods9

Lecture 18Step 3. Termination CriterionIf all nodes that can be reached from node s have been permanentlylabeled, then stop - we are done.If we cannot reach any temporary labeled node from the current node,then all the temporary labels become permanent - we are done.Otherwise, go to Step 2.Operations Research Methods10

Lecture 18Dijkstra’s Algorithm: ExampleWe want to find the shortest path from node 1 to all other nodes usingDijkstra’s algorithm.Operations Research Methods11

Lecture 18Initialization - Step 1 Node 1 is designated as the currentnode The state of node 1 is (0, p) Every other node has state ( , t)Operations Research Methods12

Lecture 18Step 2 Nodes 2, 3,and 6 can be reachedfrom the current node 1 Update distance values for thesenodesd2 min{ , 0 7} 7d3 min{ , 0 9} 9d6 min{ , 0 14} 14 Now, among the nodes 2, 3, and 6, node 2 has the smallest distancevalue The status label of node 2 changes to permanent, so its state is (7, p),while the status of 3 and 6 remains temporary Node 2 becomes the current nodeOperations Research Methods13

Lecture 18Step 3Graph at the end of Step 2We are not done, not all nodes have been reached from node 1, so weperform another iteration (back to Step 2)Operations Research Methods14

Lecture 18Another Implementation of Step 2 Nodes 3 and 4 can be reachedfrom the current node 2 Update distance values for thesenodesd3 min{9, 7 10} 9d6 min{ , 7 15} 22 Now, between the nodes 3 and 4 node 3 has the smallest distance value The status label of node 3 changes to permanent, while the status of 6remains temporary Node 3 becomes the current nodeWe are not done (Step 3 fails), so we perform another Step 2Operations Research Methods15

Lecture 18Another Step 2 Nodes 6 and 4 can be reachedfrom the current node 3 Update distance values for themd4 min{22, 9 11} 20d6 min{14, 9 2} 11 Now, between the nodes 6 and 4 node 6 has the smallest distance value The status label of node 6 changes to permanent, while the status of 4remains temporary Node 6 becomes the current nodeWe are not done (Step 3 fails), so we perform another Step 2Operations Research Methods16

Lecture 18Another Step 2 Node 5 can be reached from thecurrent node 6 Update distance value for node 5d5 min{ , 11 9} 20 Now, node 5 is the only candidate, so its status changes to permanent Node 5 becomes the current nodeFrom node 5 we cannot reach any other node.permanently labeled and we are done.Operations Research MethodsHence, node 4 gets17

Lecture 18Chapter 6.3.2 in your book has another example of the implementation ofDijkstra’s algorithmOperations Research Methods18

Lecture 18 Algorithms Solving the Problem Dijkstra’s algorithm Solves only the problems with nonnegative costs, i.e., c ij 0 for all (i,j) E Bellman-Ford algorithm Applicable to problems with arbitrary costs Floyd-Warshall algorithm Applicable to problems with arbitrary costs Solves a more gene

Related Documents:

Introduction of Chemical Reaction Engineering Introduction about Chemical Engineering 0:31:15 0:31:09. Lecture 14 Lecture 15 Lecture 16 Lecture 17 Lecture 18 Lecture 19 Lecture 20 Lecture 21 Lecture 22 Lecture 23 Lecture 24 Lecture 25 Lecture 26 Lecture 27 Lecture 28 Lecture

shortest one. Yen (1971) first introduced a k-shortest path searching method by deleting node from the network, and then several k-shortest algorithms have been suggested. There are two groups of k-shortest path algorithm. The difference is one allow loops in result paths and another don’t. In transportation network the latter is always used .

a discrete mode and proposed a new algorithm to find the discrete fuzzy shortest length in a network. Kung & Chuang [7] proposed a new algorithm to solve the shortest path problem with discrete fuzzy arc lengths. They is developed a fuzzy shortest path length procedure by a

shortest paths between many hidden states. Despite the long history of research on the shortest path problem, only the standard algorithm of one-to-one short-est path has been used in the existing HMM-based map-matching. We use one-to-many shortest path search and investigate when we can truncate the search particularly in

Given a directed graph with positive edge weights: that is, each edge has a positive weight and vertices and , find the shortest path from to . The shortest path from to in a weighted graph is a path from to (or a - path) with minimum weight . G (V,E) e E w(e) s t s t s t P s t s t w(P) e P w(P)

The classical K -Shortest Paths (KSP) problem, which identifies the k shortest paths in a directed graph, plays an important role in many application domains, such as providing alternative paths for v ehicle routing services. However, the returned k shortest paths may be highly similar, i.e., sharing significant amounts of edges, thus adversely

Our algorithm takes the hierarchy-based approach invented by Thorup. Key words. single-source shortest paths, all-pairs shortest paths, undirected graphs, Dijkstra’s algorithm AMS subject classifications. 05C12, 05C85, 68R10 DOI. 10.1137/S0097539702419650 1. Introduction. The problem of computing shortest paths is indisputably one

B. The Lazy Shortest Path (LAZYSP) Framework We are interested in shortest path algorithms that minimize the number of evaluated edges jEevalj.1 These are lazy algo-rithms, i.e. they seek to defer the evaluation of an edge as much as possible. When this laziness is taken to the limit, one arrives at the Lazy Shortest Path (LAZYSP) class of .