Decision Maths Dijkstra’s Algorithm.

Slides:



Advertisements
Similar presentations
and 6.855J Dijkstras Algorithm with simple buckets (also known as Dials algorithm)
Advertisements

For each of the following networks: Use Dijkstra's algorithm to find a quickest route between the stated vertices Indicate the order in which the vertices.
Graph Algorithms - 3 Algorithm Design and Analysis Victor AdamchikCS Spring 2014 Lecture 13Feb 12, 2014Carnegie Mellon University.
Decision Maths Networks Kruskals Algorithm Wiltshire Networks A Network is a weighted graph, which just means there is a number associated with each.
Problem solving with graph search
CS1022 Computer Programming & Principles
Networks Prim’s Algorithm
Visibility Graph Team 10 NakWon Lee, Dongwoo Kim.
Discrete Math for Computer Science. Mathematical Model Real-world Problem Computerized Solution Abstract Model Transformed Model picture of the real worldpicture.
CS 206 Introduction to Computer Science II 11 / 07 / 2008 Instructor: Michael Eckmann.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 CHAPTER 4 - PART 2 GRAPHS 1.
4-step Model – Trip Assignment 1CVEN672 Lecture 13-1.
Graphs. Graph definitions There are two kinds of graphs: directed graphs (sometimes called digraphs) and undirected graphs Birmingham Rugby London Cambridge.
1 Dijkstra's Shortest Path Algorithm Find shortest path from s to t. s 3 t
Shortest path algorithm. Introduction 4 The graphs we have seen so far have edges that are unweighted. 4 Many graph situations involve weighted edges.
1 Routing Algorithms. 2 Outline zBellaman-Ford Algorithm zDijkstra Algorithm.
CS 206 Introduction to Computer Science II 03 / 30 / 2009 Instructor: Michael Eckmann.
The Travelling Salesman Algorithm A Salesman has to visit lots of different stores and return to the starting base On a graph this means visiting every.
The Shortest Path Problem
Quickest Route B St Li C La time matrix (minutes) Liskeard Launceston Callington St Austell Bodmin 32 What is the quickest route from.
1 1 Slide © 2000 South-Western College Publishing/ITP Slides Prepared by JOHN LOUCKS.
1 Shortest Path Calculations in Graphs Prof. S. M. Lee Department of Computer Science.
More Graph Algorithms 15 April Applications of Graphs Graph theory is used in dealing with problems which have a fairly natural graph/network.
Chapter 4: Finding the Shortest Path Lesson 1: Dijkstra’s Algorithm
Using Dijkstra’s Algorithm to Find a Shortest Path from a to z 1.
Dijkstra’s Algorithm. 2 Shortest-path Suppose we want to find the shortest path from node X to node Y It turns out that, in order to do this, we need.
CSCI-455/552 Introduction to High Performance Computing Lecture 18.
Operations Research Assistant Professor Dr. Sana’a Wafa Al-Sayegh 2 nd Semester ITGD4207 University of Palestine.
Shortest Path Algorithm This is called “Dijkstra’s Algorithm” …pronounced “Dirk-stra”
Shortest Path. Dijkstra’s Algorithm finds the shortest path from the start vertex to every other vertex in the network. We will find the shortest path.
Dijkstras Algorithm Named after its discoverer, Dutch computer scientist Edsger Dijkstra, is an algorithm that solves the single-source shortest path problem.
Representing and Using Graphs
Which of these can be drawn without taking your pencil off the paper and without going over the same line twice? If we can find a path that goes over all.
Structures 7 Decision Maths: Graph Theory, Networks and Algorithms.
Minimum spanning trees Aims: To know the terms: tree, spanning tree, minimum spanning tree. To understand that a minimum spanning tree connects a network.
Graphs, Puzzles, & Map Coloring
1 Network Models Transportation Problem (TP) Distributing any commodity from any group of supply centers, called sources, to any group of receiving.
TSP – Upper Bounds and Lower Bounds Initial problem : Upper Bound A salesman based in Stockton needs to visit shops based in Darlington, Billingham, Middlesbrough,
Networks and Graphs in Introduction Many Decision Science problems can be modelled using what are called graphs or networks. A network is.
Liskeard Launceston Callington St Austell Bodmin Starter Find the quickest route from St Austell to Launceston.
Graphs A ‘Graph’ is a diagram that shows how things are connected together. It makes no attempt to draw actual paths or routes and scale is generally inconsequential.
The Travelling Salesperson Problem A salesperson needs to visit London, Nottingham, Manchester and Leeds, he lives in Birmingham. Find the shortest route.
CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg.
E E Module 5 © Wayne D. Grover 2002, (for non-negative edge weights only) Key concepts: “labelling”, “scanning” Label = {distance, predecessor}.
Suppose G = (V, E) is a directed network. Each edge (i,j) in E has an associated ‘length’ c ij (cost, time, distance, …). Determine a path of shortest.
Decision Maths 1 Shortest path algorithm Dijkstra’s Algorithm A V Ali :
Network Problems A D O B T E C
Spanning Trees Dijkstra (Unit 10) SOL: DM.2 Classwork worksheet Homework (day 70) Worksheet Quiz next block.
Mjdah Al Shehri Hamdy A. Taha, Operations Research: An introduction, 8 th Edition Chapter 6: Network Models.
CSE 373: Data Structures and Algorithms Lecture 21: Graphs V 1.
Networks Teacher’s guide. Networks 2 Problem 1 – the Link The EMTV Company needs to install a new cable system that links the six major towns in its.
1 1 Slide © 2005 Thomson/South-Western Chapter 9 Network Models n Shortest-Route Problem n Minimal Spanning Tree Problem n Maximal Flow Problem.
Shortest Path from G to C Using Dijkstra’s Algorithm
Network Flow Problems – Shortest Path Problem
Discrete Math 2 Weighted Graph Search Tree
Party-by-Night Problem
Decision Maths Dijkstra’s Algorithm.
Shortest Path.
Shortest Path.
CSE 373: Data Structures and Algorithms
Shortest Path Problems
Chapter 4: Finding the Shortest Path Lesson 1: Dijkstra’s Algorithm
Route Inspection Which of these can be drawn without taking your pencil off the paper and without going over the same line twice? If we introduce a vertex.
Networks Kruskal’s Algorithm
Shortest Path.
and 6.855J Dijkstra’s Algorithm
Networks Prim’s Algorithm
Implementation of Dijkstra’s Algorithm
Graphs.
Shortest Route Problems
Presentation transcript:

Decision Maths Dijkstra’s Algorithm

Networks Maps are examples of a real life networks. In the map below each town is a vertex (node) and each road is an edge (arc).

Networks In real life we often want to know what is the shortest path between two places. In the past you used to look on a map and plan the route yourself. These days there are websites that will do this for you. http://www.theaa.com/travelwatch/planner_main.jsp The computer cannot decide which route is the best, so it uses an algorithm to do so. One such Algorithm is Dijkstra`s.

Dijkstra`s Algorithm. Throughout this algorithm you will be required to fill in the grid below. It is important that you have a key in your work so that the examiner will understand your workings.

Dijkstra`s Algorithm Consider the network below. We are going to apply an algorithm to find the shortest route from S to T. The solution to this should be obvious but it is important to learn the algorithm so we can apply it in more complex situations. As you work through the algorithm try to understand why it works.

Dijkstra`s Algorithm Give the start node a permanent label of 0. The “1” indicates that this is the first node to receive a permanent label.

Dijkstra`s Algorithm Look at all the nodes which can be reached from the start node in one edge. That’s A, D and F. Give them a temporary label of their distance from the start node.

Dijkstra`s Algorithm Make the lowest temporary node permanent. This is node A in this case. If there had been more than one, then you could choose any.

Dijkstra`s Algorithm Node A has just received the permanent label “3”. Look at all the nodes you can reach from A without a permanent label. Give such nodes a temporary label of 3 + their distance from A.

Dijkstra`s Algorithm Make the lowest temporary node permanent. This is node D in this case.

Dijkstra`s Algorithm Repeat step 4, only this time with node D. Label all nodes from D with temporary label (4 + distance) from D. If a node has a temporary label, replace it, if (4 + distance) is less than the temporary label.

Dijkstra`s Algorithm Make the lowest temporary node permanent. F now gets a permanent label. Node G already has a temporary label which does not change.

Dijkstra`s Algorithm Both B and E have the same temporary label. It makes no difference which we pick, so B is selected. B is the 5th permanent label. C needs a temporary label.

Dijkstra`s Algorithm E gets a permanent label, as it has the lowest temporary label. C`s temporary label must change to 9 as you can go S,D,E,C which has length 4 + 3 + 2 = 9 as this is less than the existing label. T is given a temporary label of 11.

Dijkstra`s Algorithm Again there are two vertices that can be assigned a permanent label. G is chosen. No adjustments need to be made.

Dijkstra`s Algorithm C is assigned a permanent label. T`s temporary label can be adjusted as 4 + 3 + 2 + 1 = 10.

Dijkstra`s Algorithm T now gets a permanent label of 10. This tells us that the shortest route from S to T has a length 10.

Dijkstra`s Algorithm The shortest path will be marked with a red line. To find it you work backwards from T to S identifying whose length is the same as the difference between the permanent labels at either end.

Dijkstra`s Algorithm The weights on the arcs can represent different things that might lead to alternate routes. Example – They could change to represent the time taken to travel a stretch of road rather than distance.

Dijkstra`s Algorithm Can you explain how the Algorithm works? What do the temporary and permanent labels mean? They are values for the quickest route to that particular node.

Dijkstra`s Algorithm Why do we assign temporary labels? The algorithm systematically searches for the quickest route to every node. We assign a temporary label as that stands for the current quickest route to that node. Later in the algorithm an alternative route may be found so we replace the temporary label with a new temporary label.

Dijkstra`s Algorithm Why do we make the node with the lowest temporary label permanent? All routes up to a certain point have been covered, so the node with the lowest temporary label must be the next nearest node to the start point.

Dijkstra`s Algorithm What happens after this? You are certain that there is no shorter way of reaching the node you are currently at. So you can assign neighbouring nodes a temporary label. Why does the first node get assigned permanent label zero? It is the start point , you have not travelled anywhere.

Dijkstra`s Algorithm Why does the method for finding the route at the end work? At the end of the algorithm each node has a permanent label that represents the shortest distance to that node. If two nodes are joined then the difference in their permanent labels will tell you the shortest distance between them. If the arc joining them matches this distance then it must be the quickest route.

Ex 3d q1i – Shortest route from S to T 7 6 7 9 7 2 2 9 2 1 10 8 4 4 10 15 10 4 6 15 3 3 10 9 3 6 5 10 6

Ex 3d q1i 7 6 7 9 7 2 2 9 2 1 10 8 4 4 10 15 10 4 6 15 3 3 10 9 3 6 5 10 6