decision maths 1 shortest path algorithm dijkstras algorithm a v ali :

3
Decision Maths 1 Shortest path algorithm Dijkstra’s Algorithm A V Ali : www.2july- maths.co.uk

Upload: shon-goodman

Post on 18-Jan-2018

239 views

Category:

Documents


0 download

DESCRIPTION

Step 4 : Repeat 3, for all nodes in the network. Label Box 2 when you have checked the shortest path has been found. Label Box 3 with the node order number through the path Find the shortest path from A to G Step 1 : For first node label Box 1, 2 and 3 all 0. Step 2 : Each node has Box 1 labeled as the shortest distance to this node from the start so far. Step 3 : Go from each node labeled so far, and replace Box 1 value if a new shortest path from the start is found. Shortest route from A to G = 17

TRANSCRIPT

Page 1: Decision Maths 1 Shortest path algorithm Dijkstras Algorithm A V Ali :

Decision Maths 1

Shortest path algorithmDijkstra’s Algorithm

A V Ali : www.2july-maths.co.uk

Page 2: Decision Maths 1 Shortest path algorithm Dijkstras Algorithm A V Ali :

Box 3 Box 2

Box 1

Dijkstra’s algorithm used to find the shortest path through a network.

Page 3: Decision Maths 1 Shortest path algorithm Dijkstras Algorithm A V Ali :

Step 4 : Repeat 3, for all nodes in the network. Label Box 2 when you have checked the shortest path has been found. Label Box 3 with the node order number through the path.

0 0

1 3 2 5

4 9

3 6

5 14

6 17

12

3 5

15

19

8

18

7 6

9 14

170

Find the shortest path from A to G Step 1 : For first node

label Box 1, 2 and 3 all 0.

Step 2 : Each node has Box 1 labeled as the shortest distance to this node from the start so far.

Step 3 : Go from each node labeled so far, and replace Box 1 value if a new shortest path from the start is found.

Shortest route from A to G = 17