Dijkstra s Algorithm (5/9/2013)

Similar documents
Common Mistakes. Quick sort. Only choosing one pivot per iteration. At each iteration, one pivot per sublist should be chosen.

Coding for Efficiency

Modeling, Analysis and Optimization of Networks. Alberto Ceselli

MASSACHUSETTS INSTITUTE OF TECHNOLOGY

A Gentle Introduction to Dynamic Programming and the Viterbi Algorithm

CS 457 Lecture 16 Routing Continued. Spring 2010

Graphs and Network Flows IE411. Lecture 14. Dr. Ted Ralphs

Greedy Algorithms. Kleinberg and Tardos, Chapter 4

Foundations of Distributed Systems: Tree Algorithms

Mark Scheme (Results) Summer GCE Decision D1 (6689) Paper 1

UMBC 671 Midterm Exam 19 October 2009

Decision Mathematics practice paper

CS 32 Puzzles, Games & Algorithms Fall 2013

Ad Hoc Networks - Routing and Security Issues

Lecture5: Lossless Compression Techniques

Decision Mathematics D1 Advanced/Advanced Subsidiary. Friday 17 May 2013 Morning Time: 1 hour 30 minutes

UMBC CMSC 671 Midterm Exam 22 October 2012

Q(173)Q(177)Q(188)Q(193)Q(203)

physicsandmathstutor.com

The Pythagorean Theorem

Current Mirrors. Basic BJT Current Mirror. Current mirrors are basic building blocks of analog design. Figure shows the basic NPN current mirror.

Link and Link Impedance 2018/02/13. VECTOR DATA ANALYSIS Network Analysis TYPES OF OPERATIONS

Econ 172A - Slides from Lecture 18

Lectures: Feb 27 + Mar 1 + Mar 3, 2017

Link State Routing. Stefano Vissicchio UCL Computer Science CS 3035/GZ01

Catty Corner. Side Lengths in Two and. Three Dimensions

Pythagorean Theorem. Student Choice Drawing Project with Rubric

: Principles of Automated Reasoning and Decision Making Midterm

MITOCW R19. Dynamic Programming: Crazy Eights, Shortest Path

Conversion Masters in IT (MIT) AI as Representation and Search. (Representation and Search Strategies) Lecture 002. Sandro Spina

Taxicab Geometry Part II Meeting 3

Stanford University CS261: Optimization Handout 9 Luca Trevisan February 1, 2011

Assignment Problem. Introduction. Formulation of an assignment problem

The tenure game. The tenure game. Winning strategies for the tenure game. Winning condition for the tenure game

Angles with Parallel Lines Topic Index Geometry Index Regents Exam Prep Center

CSE/EE 461. Link State Routing. Last Time. This Lecture. Routing Algorithms Introduction Distance Vector routing (RIP)

Decision Mathematics D1

APPM 4120/5120, Spring 2015 HW 3

Putting It All Together

Motion Planning in Dynamic Environments

Dynamic games: Backward induction and subgame perfection

Regents Exam Questions by Topic Page 1 TOOLS OF GEOMETRY: Constructions NAME:

2. Where might you find an example of a right angle in your home? How could you check that it is a right angle?

EET 1150 Lab 6 Ohm s Law

Routing Algorithm Classification. A Distance Vector Routing Algorithm

OSPF Fundamentals. Agenda. OSPF Principles. L41 - OSPF Fundamentals. Open Shortest Path First Routing Protocol Internet s Second IGP

OSPF - Open Shortest Path First. OSPF Fundamentals. Agenda. OSPF Topology Database

1 This work was partially supported by NSF Grant No. CCR , and by the URI International Engineering Program.

Module 3 Greedy Strategy

ROUTING PROTOCOLS. Dr. Ahmed Khattab. EECE Department Cairo University Fall 2012 ELC 659/ELC724

Module 3 Greedy Strategy

Network-building. Introduction. Page 1 of 6

A Location-Aware Routing Metric (ALARM) for Multi-Hop, Multi-Channel Wireless Mesh Networks

Chapter 8. Constant Current Sources

MOBILE COMPUTING NIT Agartala, Dept of CSE Jan-May,2012

3CP Curve Plotting Tool for Model Railways

Seismology and Seismic Imaging

EQ-ROBO Programming : bomb Remover Robot

Algorithmique appliquée Projet UNO

CSE 573 Problem Set 1. Answers on 10/17/08

Past questions from the last 6 years of exams for programming 101 with answers.

Delay Aware Link Scheduling for Multi-hop TDMA Wireless Networks

Dynamic Routing and Wavelength Assignment Using Learning Automata Technique

NANYANG TECHNOLOGICAL UNIVERSITY SEMESTER II EXAMINATION MH1301 DISCRETE MATHEMATICS. Time Allowed: 2 hours

UNIVERSITY of PENNSYLVANIA CIS 391/521: Fundamentals of AI Midterm 1, Spring 2010

Optimisation and Operations Research

Chapter 6: CPU Scheduling

and 6.855J. Network Simplex Animations

Link State Routing. Brad Karp UCL Computer Science. CS 3035/GZ01 3 rd December 2013

UCS-805 MOBILE COMPUTING NIT Agartala, Dept of CSE Jan-May,2011

Playing With Mazes. 3. Solving Mazes. David B. Suits Department of Philosophy Rochester Institute of Technology Rochester NY 14623

Simple Search Algorithms

CMPUT 657: Heuristic Search

Lesson 0.1 The Same yet Smaller

Mittwoch, 14. September The Pelita contest (a brief introduction)

ALGEBRA: Chapter I: QUESTION BANK

Tutorial 1. (ii) There are finite many possible positions. (iii) The players take turns to make moves.

Approximation Algorithms for Conflict-Free Vehicle Routing

A Quoridor-playing Agent

2359 (i.e. 11:59:00 pm) on 4/16/18 via Blackboard

olsr.org 'Optimized Link State Routing' and beyond December 28th, 2005 Elektra

Travel time uncertainty and network models

Introduction to Spring 2009 Artificial Intelligence Final Exam

Topics to be covered

TASK PATRIK POLICIJA SABOR

Outline. Content The basics of counting The pigeonhole principle Reading Chapter 5 IRIS H.-R. JIANG

CSE 373 DECEMBER 4 TH ALGORITHM DESIGN

3G TR 25.xxx V0.0.1 ( )

Final Exam (ECE 408/508 Digital Communications) (05/05/10, Wed, 6 8:30PM)

Link-state protocols and Open Shortest Path First (OSPF)

Probe Considerations for Low Voltage Measurements such as Ripple

INTRODUCTION. Figure 1 Three-terminal op amp symbol.

E D C B A MS2.1. Correctly calculates the perimeter of most of the drawn shapes. Shapes are similarly drawn. Records lengths using cm.

Dynamic Routing and Spectrum Assignment in Brown-field Fixed/Flex Grid Optical Network. Tanjila Ahmed

Collection of rules, techniques and theorems for solving polynomial congruences 11 April 2012 at 22:02

Lecture 8 Link-State Routing

The Deeter Group. Wireless Site Survey Tool

Lab 1: Basic Lab Equipment and Measurements

Decision Mathematics D2 Advanced/Advanced Subsidiary. Thursday 6 June 2013 Morning Time: 1 hour 30 minutes

CPSC 217 Assignment 3

Transcription:

Dijkstra s Algorithm (5/9/2013) www.alevelmathsng.co.uk (Shortest Path Problem) The aim is to find the shortest path between two specified nodes. The idea with this algorithm is to attach to each node a label showing its shortest distance from the start node (ie using the optimum route). Example (starting at S and finishing at T) We start by attaching temporary labels to A, B and C of 4, 7 and 3 respectively (these being the distances directly from S). The shortest distance from S to C is then clearly 3 (since an indirect route via A or B has to produce a distance greater than 3). Thus C can be given a permanent label for the shortest distance. The temporary labels of A and B will be modified later if a shorter (indirect) route is subsequently discovered. 1

As can be seen above, each node has a box attached to it. The labelling convention is as follows: We now consider the nodes that are immediate neighbours of C (the one that has just had a permanent label assigned to it); namely B and D. In the case of B, we can improve on the temporary label of 7, since the route via C will have distance 3+2=5. Thus the temporary label is changed to 5. The shortest distance from S to D, via C, is 3+5=8, and so D is given the temporary label 8. 2

We now consider the node with the smallest temporary label; in this case, A - with 4. This will, in fact, be the shortest distance from S. [If you re interested, the reasoning behind this is as follows: We are trying to establish that the shortest route from S to A is just SA (the route that gives rise to the temporary label of 4. Suppose that the shortest route is some other path(eg SCBA), so that the first temporary label that is reached is not A (eg B). Because this is the shortest route to A, it will also be the shortest route to (eg) B, which means that B's temporary label of 5 must be its permanent label, since the value of 5 was arrived at by considering all routes directly from a permanent label - including C. But this leads to a contradiction, since we know that the shortest route to A has a length no greater than 4, and we have already taken 5 to reach B. Hence our supposition was incorrect: the first temporary label that is reached is in fact A, and SA is the shortest route to A.] Note: If more than one node shares the smallest temporary label, it doesn t matter which is chosen. 3

From now on we will refer to the final diagram, shown below. This is the only diagram that is required when answering exam questions. The boxes will make it clear that the algorithm has been applied correctly. The procedure from now on is simply a repeat of what we have done so far, but will be described, in order to reinforce the ideas involved. We now consider the nodes that can be reached directly from A; namely B and T. In the case of B, we can t improve on the temporary label of 5, since the route directly from A will have distance 4+5=9. The shortest distance from S to T directly from A is 4+9=13, and so T is given the temporary label 13. We once again consider the node with the smallest temporary label; in this case, B with 5. This will be the shortest distance from S, since we have already investigated the routes via the permanently labelled A and C (C did in fact generate the label of 5), and routes via the temporarily labelled nodes D and T can once again be rejected (as B has been chosen because it has the smallest temporary label). Thus B s label is made permanent. As can be seen, we alternate between (i) selecting the smallest temporary label and making it permanent and (ii) labelling (or re-labelling) its neighbouring nodes with temporary labels. 4

Thus we now examine the nodes with temporary labels neighbouring B; ie D and T. For D, the label of 8 can be improved on, since the shortest route directly from B has distance 5+1=6. For T, the label of 13 can also be improved on, since the shortest route directly from B has distance 5+7=12. The node with the smallest temporary label is now D, and this is made permanent. Finally, we consider the route to T directly from D: the shortest distance along this route is 6+4=10, which is an improvement on the temporary label of 12. As T is now the only remaining temporary label, it is therefore the smallest temporary label, and can safely be made permanent. The shortest distance from S to T is thus 10. The shortest route is determined by looking for neighbouring nodes for which the length of the arc between them equals the difference between their permanent labels. In this example, working backwards from T, the last stage has to be DT (since 10-6=4, which is the arc length). Then BD=1 is the next leg, followed by CB=2, and finally SC=3. Thus the shortest route is SCBDT, with a total distance of 3+2+1+4=10 (which as a useful check - equals the label of T). 5