SlideShare ist ein Scribd-Unternehmen logo
1 von 13
SHORTEST ROUTE PROBLEM A Networking Model Report for DPA 702  QUANTITATIVE METHODS OF RESEARCH By: ALONA M. SALVACebu Technological University
What  is  the shortest  route  between  some node i and some other node j in  the  graph?
0.  To initialize:  ,[object Object]
b.  the distance to the origin is 0.
c.  the arc set is empty. Dijkstra’s algorithm
1.  Find  all  the  unsolved  nodes  that  are  directly  connected  by  a  single  arc  to  any solved node.   For each  unsolved node,  calculate all  of the  “candidate distances” (there  may  be  several  of  these  for  one  unsolved  node  because  it  may  directly connect to more than one solved node):  ,[object Object]
b.  the  “candidate  distance”  is  (distance  to  solved  node)  +  (length  of  arc directly connecting the solved and the unsolved node) Dijkstra’s algorithm
2.  Choose the smallest candidate distance:  ,[object Object]
b.  distance to the newly  solved node is the candidate distance.
c.  add the corresponding arc to the arc set. Dijkstra’s algorithm
3.  If  the  newly  solved  node  is  not  the  destination  node,  then  go  to  step  1. Else, stop and recover the solution:  ,[object Object]
b.  shortest route is found by tracing backwards from the destination node to the origin (or the reverse) using the arcs in the arc set.  It is usually easiest to  trace backwards because each node is reached from  exactly  one other node, but may have outward arcs to several other nodes. Dijkstra’s algorithm
Dijkstra’s algorithm

Weitere ähnliche Inhalte

Was ist angesagt?

Steps for Principal Component Analysis (pca) using ERDAS software
Steps for Principal Component Analysis (pca) using ERDAS softwareSteps for Principal Component Analysis (pca) using ERDAS software
Steps for Principal Component Analysis (pca) using ERDAS software
Swetha A
 
Bayseian decision theory
Bayseian decision theoryBayseian decision theory
Bayseian decision theory
sia16
 

Was ist angesagt? (20)

Using GIS for effective flood management
Using GIS for effective flood managementUsing GIS for effective flood management
Using GIS for effective flood management
 
Land use cover pptx.
Land use cover pptx.Land use cover pptx.
Land use cover pptx.
 
Application of GIS in Transportation Planning
Application of GIS in Transportation Planning Application of GIS in Transportation Planning
Application of GIS in Transportation Planning
 
How to download Sentinel 2 satellite data
How to download Sentinel 2 satellite dataHow to download Sentinel 2 satellite data
How to download Sentinel 2 satellite data
 
Environment Management Using GIS
Environment Management Using GISEnvironment Management Using GIS
Environment Management Using GIS
 
Introduction to GIS
Introduction to GISIntroduction to GIS
Introduction to GIS
 
Steps for Principal Component Analysis (pca) using ERDAS software
Steps for Principal Component Analysis (pca) using ERDAS softwareSteps for Principal Component Analysis (pca) using ERDAS software
Steps for Principal Component Analysis (pca) using ERDAS software
 
Applications of gis in the field of
Applications of gis in the field ofApplications of gis in the field of
Applications of gis in the field of
 
Bayseian decision theory
Bayseian decision theoryBayseian decision theory
Bayseian decision theory
 
Introduction to GIS
Introduction to GISIntroduction to GIS
Introduction to GIS
 
Urban Landuse/ Landcover change analysis using Remote Sensing and GIS
Urban Landuse/ Landcover change analysis using Remote Sensing and GISUrban Landuse/ Landcover change analysis using Remote Sensing and GIS
Urban Landuse/ Landcover change analysis using Remote Sensing and GIS
 
Grey wolf optimizer
Grey wolf optimizerGrey wolf optimizer
Grey wolf optimizer
 
Geographic information system (gis)
Geographic information system (gis)Geographic information system (gis)
Geographic information system (gis)
 
Cluster analysis
Cluster analysisCluster analysis
Cluster analysis
 
Geographic Phenomena and their Representations
Geographic Phenomena and their RepresentationsGeographic Phenomena and their Representations
Geographic Phenomena and their Representations
 
REMOTE SENSING & GIS APPLICATIONS IN WATERSHED MANAGEMENT
REMOTE SENSING & GIS APPLICATIONS IN WATERSHED MANAGEMENT REMOTE SENSING & GIS APPLICATIONS IN WATERSHED MANAGEMENT
REMOTE SENSING & GIS APPLICATIONS IN WATERSHED MANAGEMENT
 
Tree pruning
 Tree pruning Tree pruning
Tree pruning
 
Flood risk mapping using GIS and remote sensing and SAR
Flood risk mapping using GIS and remote sensing and SARFlood risk mapping using GIS and remote sensing and SAR
Flood risk mapping using GIS and remote sensing and SAR
 
Gis powerpoint
Gis powerpointGis powerpoint
Gis powerpoint
 
GIS.INTRODUCTION TO GIS PACKAGES &GEOGRAPHIIC ANALYSIS
GIS.INTRODUCTION TO GIS PACKAGES &GEOGRAPHIIC ANALYSISGIS.INTRODUCTION TO GIS PACKAGES &GEOGRAPHIIC ANALYSIS
GIS.INTRODUCTION TO GIS PACKAGES &GEOGRAPHIIC ANALYSIS
 

Andere mochten auch (9)

The Shortest Route Problem
The Shortest Route ProblemThe Shortest Route Problem
The Shortest Route Problem
 
Math project final 1
Math project final 1Math project final 1
Math project final 1
 
460 operations - 4.20
460   operations - 4.20460   operations - 4.20
460 operations - 4.20
 
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
 
Shortest Path Problem: Algoritma Dijkstra
Shortest Path Problem: Algoritma DijkstraShortest Path Problem: Algoritma Dijkstra
Shortest Path Problem: Algoritma Dijkstra
 
Quantitative Analysis for Management, Tenth Edition
Quantitative Analysis for Management, Tenth EditionQuantitative Analysis for Management, Tenth Edition
Quantitative Analysis for Management, Tenth Edition
 
Trafic Sign Localization & Recognition using Client-Server Architecture
Trafic Sign Localization & Recognition using Client-Server ArchitectureTrafic Sign Localization & Recognition using Client-Server Architecture
Trafic Sign Localization & Recognition using Client-Server Architecture
 
My presentation minimum spanning tree
My presentation minimum spanning treeMy presentation minimum spanning tree
My presentation minimum spanning tree
 
Pert & cpm project management
Pert & cpm   project managementPert & cpm   project management
Pert & cpm project management
 

Ähnlich wie Shortest route and mst

APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
KUSHDHIRRA2111026030
 
Fault tolerance in wireless sensor networks by Constrained Delaunay Triangula...
Fault tolerance in wireless sensor networks by Constrained Delaunay Triangula...Fault tolerance in wireless sensor networks by Constrained Delaunay Triangula...
Fault tolerance in wireless sensor networks by Constrained Delaunay Triangula...
Sigma web solutions pvt. ltd.
 

Ähnlich wie Shortest route and mst (20)

OR II - M3.pptx
OR II - M3.pptxOR II - M3.pptx
OR II - M3.pptx
 
Dijkstra's algorithm presentation
Dijkstra's algorithm presentationDijkstra's algorithm presentation
Dijkstra's algorithm presentation
 
Network analysis
Network analysisNetwork analysis
Network analysis
 
Analysis and reactive measures on the blackhole attack
Analysis and reactive measures on the blackhole attackAnalysis and reactive measures on the blackhole attack
Analysis and reactive measures on the blackhole attack
 
Shortest Path Algorithm
Shortest Path AlgorithmShortest Path Algorithm
Shortest Path Algorithm
 
Shortest path algorithm
Shortest  path algorithmShortest  path algorithm
Shortest path algorithm
 
Pulkit 10103644
Pulkit 10103644Pulkit 10103644
Pulkit 10103644
 
Cut detection
Cut detectionCut detection
Cut detection
 
Cut detection
Cut detectionCut detection
Cut detection
 
Cut Detection in Wireless Sensor Network
Cut Detection in Wireless Sensor NetworkCut Detection in Wireless Sensor Network
Cut Detection in Wireless Sensor Network
 
Routing algorithm network layer
Routing algorithm  network layerRouting algorithm  network layer
Routing algorithm network layer
 
Ram minimum spanning tree
Ram   minimum spanning treeRam   minimum spanning tree
Ram minimum spanning tree
 
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
APznzaZLM_MVouyxM4cxHPJR5BC-TAxTWqhQJ2EywQQuXStxJTDoGkHdsKEQGd4Vo7BS3Q1npCOMV...
 
Node Path Visualizer Using Shortest Path Algorithms
Node Path Visualizer Using Shortest Path AlgorithmsNode Path Visualizer Using Shortest Path Algorithms
Node Path Visualizer Using Shortest Path Algorithms
 
Social Network Analysis and Visualization
Social Network Analysis and VisualizationSocial Network Analysis and Visualization
Social Network Analysis and Visualization
 
Networks
NetworksNetworks
Networks
 
Modified Coverage Hole Detection Algorithm for Distributed WSNs
Modified Coverage Hole Detection Algorithm for Distributed WSNsModified Coverage Hole Detection Algorithm for Distributed WSNs
Modified Coverage Hole Detection Algorithm for Distributed WSNs
 
2512ijcsea02
2512ijcsea022512ijcsea02
2512ijcsea02
 
Fault tolerance in wireless sensor networks by Constrained Delaunay Triangula...
Fault tolerance in wireless sensor networks by Constrained Delaunay Triangula...Fault tolerance in wireless sensor networks by Constrained Delaunay Triangula...
Fault tolerance in wireless sensor networks by Constrained Delaunay Triangula...
 
Analysis of Pathfinding Algorithms
Analysis of Pathfinding AlgorithmsAnalysis of Pathfinding Algorithms
Analysis of Pathfinding Algorithms
 

Mehr von Alona Salva

Mehr von Alona Salva (17)

1.2 theories of nationalism
1.2 theories of nationalism1.2 theories of nationalism
1.2 theories of nationalism
 
1.1 what is nationalism
1.1 what is nationalism1.1 what is nationalism
1.1 what is nationalism
 
Political science part xi
Political science part xiPolitical science part xi
Political science part xi
 
Does God Exist
Does God ExistDoes God Exist
Does God Exist
 
Political science part vii
Political science part viiPolitical science part vii
Political science part vii
 
Political science part viii
Political science part viiiPolitical science part viii
Political science part viii
 
Political science part ix
Political science part ixPolitical science part ix
Political science part ix
 
Political science part x
Political science part xPolitical science part x
Political science part x
 
National budget
National budgetNational budget
National budget
 
Process of research
Process of researchProcess of research
Process of research
 
Political science part iii
Political science part iiiPolitical science part iii
Political science part iii
 
Political science part ii
Political science part iiPolitical science part ii
Political science part ii
 
Political science part i
Political science part iPolitical science part i
Political science part i
 
Vienna convention on consular relations
Vienna convention on consular relationsVienna convention on consular relations
Vienna convention on consular relations
 
Social theory of International Politics
Social theory of International PoliticsSocial theory of International Politics
Social theory of International Politics
 
S R P
S R PS R P
S R P
 
F E R P A
F E  R P AF E  R P A
F E R P A
 

Kürzlich hochgeladen

Jual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan Cytotec
Jual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan CytotecJual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan Cytotec
Jual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan Cytotec
ZurliaSoop
 
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
daisycvs
 
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al MizharAl Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
allensay1
 

Kürzlich hochgeladen (20)

Call 7737669865 Vadodara Call Girls Service at your Door Step Available All Time
Call 7737669865 Vadodara Call Girls Service at your Door Step Available All TimeCall 7737669865 Vadodara Call Girls Service at your Door Step Available All Time
Call 7737669865 Vadodara Call Girls Service at your Door Step Available All Time
 
Durg CALL GIRL ❤ 82729*64427❤ CALL GIRLS IN durg ESCORTS
Durg CALL GIRL ❤ 82729*64427❤ CALL GIRLS IN durg ESCORTSDurg CALL GIRL ❤ 82729*64427❤ CALL GIRLS IN durg ESCORTS
Durg CALL GIRL ❤ 82729*64427❤ CALL GIRLS IN durg ESCORTS
 
Marel Q1 2024 Investor Presentation from May 8, 2024
Marel Q1 2024 Investor Presentation from May 8, 2024Marel Q1 2024 Investor Presentation from May 8, 2024
Marel Q1 2024 Investor Presentation from May 8, 2024
 
joint cost.pptx COST ACCOUNTING Sixteenth Edition ...
joint cost.pptx  COST ACCOUNTING  Sixteenth Edition                          ...joint cost.pptx  COST ACCOUNTING  Sixteenth Edition                          ...
joint cost.pptx COST ACCOUNTING Sixteenth Edition ...
 
Escorts in Nungambakkam Phone 8250092165 Enjoy 24/7 Escort Service Enjoy Your...
Escorts in Nungambakkam Phone 8250092165 Enjoy 24/7 Escort Service Enjoy Your...Escorts in Nungambakkam Phone 8250092165 Enjoy 24/7 Escort Service Enjoy Your...
Escorts in Nungambakkam Phone 8250092165 Enjoy 24/7 Escort Service Enjoy Your...
 
Nashik Call Girl Just Call 7091819311 Top Class Call Girl Service Available
Nashik Call Girl Just Call 7091819311 Top Class Call Girl Service AvailableNashik Call Girl Just Call 7091819311 Top Class Call Girl Service Available
Nashik Call Girl Just Call 7091819311 Top Class Call Girl Service Available
 
Berhampur 70918*19311 CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Berhampur 70918*19311 CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDINGBerhampur 70918*19311 CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Berhampur 70918*19311 CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
 
Jual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan Cytotec
Jual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan CytotecJual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan Cytotec
Jual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan Cytotec
 
Chennai Call Gril 80022//12248 Only For Sex And High Profile Best Gril Sex Av...
Chennai Call Gril 80022//12248 Only For Sex And High Profile Best Gril Sex Av...Chennai Call Gril 80022//12248 Only For Sex And High Profile Best Gril Sex Av...
Chennai Call Gril 80022//12248 Only For Sex And High Profile Best Gril Sex Av...
 
Kalyan Call Girl 98350*37198 Call Girls in Escort service book now
Kalyan Call Girl 98350*37198 Call Girls in Escort service book nowKalyan Call Girl 98350*37198 Call Girls in Escort service book now
Kalyan Call Girl 98350*37198 Call Girls in Escort service book now
 
Lucknow Housewife Escorts by Sexy Bhabhi Service 8250092165
Lucknow Housewife Escorts  by Sexy Bhabhi Service 8250092165Lucknow Housewife Escorts  by Sexy Bhabhi Service 8250092165
Lucknow Housewife Escorts by Sexy Bhabhi Service 8250092165
 
Phases of Negotiation .pptx
 Phases of Negotiation .pptx Phases of Negotiation .pptx
Phases of Negotiation .pptx
 
Uneak White's Personal Brand Exploration Presentation
Uneak White's Personal Brand Exploration PresentationUneak White's Personal Brand Exploration Presentation
Uneak White's Personal Brand Exploration Presentation
 
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
 
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDINGParadip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
 
Organizational Transformation Lead with Culture
Organizational Transformation Lead with CultureOrganizational Transformation Lead with Culture
Organizational Transformation Lead with Culture
 
Falcon Invoice Discounting: Empowering Your Business Growth
Falcon Invoice Discounting: Empowering Your Business GrowthFalcon Invoice Discounting: Empowering Your Business Growth
Falcon Invoice Discounting: Empowering Your Business Growth
 
CROSS CULTURAL NEGOTIATION BY PANMISEM NS
CROSS CULTURAL NEGOTIATION BY PANMISEM NSCROSS CULTURAL NEGOTIATION BY PANMISEM NS
CROSS CULTURAL NEGOTIATION BY PANMISEM NS
 
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al MizharAl Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
 
Buy gmail accounts.pdf buy Old Gmail Accounts
Buy gmail accounts.pdf buy Old Gmail AccountsBuy gmail accounts.pdf buy Old Gmail Accounts
Buy gmail accounts.pdf buy Old Gmail Accounts
 

Shortest route and mst

Hinweis der Redaktion

  1. Introduction to Networks Network models are an extremely important category of mathematical program that have numerous practical applications. Part of their appeal is the direct and intuitive mapping between the real world, the network diagram, and the underlying solution algorithms. Many network problems can be solved via linear programming, and in fact, special extremely fast variants of linear programming can be applied. The largest mathematical programs that are regularly solved in practice, e.g. airline crew scheduling problems, are usually network problems. For many types of network problems there are also specialized non-LP solution algorithms. We will first look at some of the classic non-LP solution methods, and later return to the idea of solving networks via LP. The solution approach to the minimal spanning tree problem is actually easier than the shortest route solution method. In the minimal spanning tree solution approach, we can start at any node in the network. However, the conventional approach is to start with node 1.
  2. Here is a technical statement of the shortest route problem: given a graph in which each arc is labeled with the distance between the two nodes that it connects, what is the shortest route between some node i and some other node j in the graph? For example, consider the graph in Figure 8.3: what is the shortest route between node A and node H? What is the length of the shortest route? In a graph this small, it is possible to solve the problem by simple inspection: try this for the graph in Figure 8.3. However, if the graph is quite large, a more organized approach is needed. Brute force enumeration of all of the possible routes is impractical in large graphs because the number of possible routes is combinatorially explosive. ry tracing out all of the routes between nodes A and H in Figure 8.3 for example: there are quite a few! Note that “shortest route problem” is also the name applied when the arc labels ar e not distances, but perhaps travel time (quickest route problem) or travel cost (cheapest route problem). The solution methods are identical in all cases. We will look first at one of the most popular methods for finding the shor test route in a graph or network: Dijkstra’s algorithm. It is an iterative method. At the nth iteration you will find the nth closest node to the start node (the origin), and the shortest route to that node. You stop iterating when the destination node is reached, even if you have not visited all of the nodes in the network. All of the nodes in the network are initially “unsolved”. A node is “solved” at each iteration when the shortest distance and route to that node is found. The length of the shortest path from the origin to a node is the “distance”: a node is solved when the distance is determined. By definition (and common sense), the distance from the origin node to the origin node is zero. Arcs which may form part of the shortest route are gradually added to the “arc set” as the method proceeds; the arc set is initially empty. Note that the method ventures up some blind alleys as it proceeds: not all of the arcs that are added to the arc set will feature in the final shortest route!
  3. You can keep track of the progress of the algorithm by constructing a table with headings such as iteration number, unsolved node connected to solved node, candidate distances and arcs, selected node, distance and arc. However, for relatively small problems it is easier to keep track by making notations directly on the diagram. We will use the following conventions for tracking the algorithm on a diagram: mark the solved nodes in boldface and label them with the distance, mark the arcs in the arc set in boldface.
  4. Let us follow the progress of Dijkstra’s algorithm as we apply it to the network shown in Figure 8.3. We will omit the initial diagram in which only node A, the origin, is solved, and so shown in boldface and labeled with the distance 0. At this point, there are 3 unsolved nodes to consider (B, C, and D) because they are directly connected to the only solved node (A). The candidate distances are AB (0+3=3), AC (0+2=2), and AD (0+5=5). The smallest candidate distance is AC, so C is now a solved node with a distance of 2 as shown in Figure 8.4.
  5. Now there are 3 unsolved nodes to consider (B, D, and E). Candidate distances are AB (0+3=3), AD (0+5=5), CD (2+2=4), and CE (2+5=7). The smallest candidate distance is AB at 3, so B is now a solved node, as shown in Figure 8.5.
  6. There are again 3 unsolved nodes to consider (F, D, and E). Candidate distances are BF (3+13=16), BD (3+2=5), AD (0+5=5), CD (2+2=4), and CE (2+5=7). The smallest candidate distance is CD at 4, so D is now a solved node, as shown in Figure 8.6.
  7. Now the unsolved nodes to consider are F, G, and E. Candidate distances are BF (3+13=16), DF (4+6=10), DG (4+3=7), DE (4+4=8), and CE (2+5=7). The smallest candidate distance is 7 with tie between DG and CE. We can choose either candidate arbitrarily and update the diagram accordingly, however we know that the candidate not chosen this time will definitely be chosen in the next iteration, so we might as well update both candidates at once, as shown in Figure 8.7.
  8. Now there are only two unsolved nodes to consider: F and H. The candidate distances are BF (3+13=16), DF (4+6=10), GF (7+2=9), and GH (7+6=13). The smallest candidate distance is 9, so F is now a solved node, as shown in Figure 8.8.
  9. Finally there is only one remaining unsolved node: H. The candidate distances are FH (9+3=12) and GH (7+6=13). So H becomes a solved node with a distance of 12, as shown in Figure 8.9. Since H is the destination node, the iterations stop. We visited every node in the network in this small example, but this will not always happen. Figure 8.9 : 7t h closest node to A is H. Finished! At this point, we know that the length of the shortest route from A to H is 12 units (kilometers perhaps). But how do we determine the route? Simply trace backwards from H to A, and then reverse the route that you find in this manner. In Figure 8.9, the reverse route is HFGDCA, and when given in the forward order this is ACDGFH. The reason for finding the route in this manner is that working backwards avoids the blind alleys that exist in the forward direction. Note that you may sometimes find a tie in the routing to an intermediate node. For example, if arc BD had a length of 1, then there would be two routes from A to D with length 4: ACD as selected in the diagram, and ABD. It doesn’t matter which one you use. In fact, you can mark both choices on the diagram as you proceed, which will remind you of the alternate routes. What makes Dijkstra’s algorithm efficient is that it calculates the lengths of only a very small subset of all of the possible routes through the graph. Once a node has been solved, the shortest path to the node from the origin is known. All paths that follow on from that node then have the benefit of the shortest path to that point.