SlideShare a Scribd company logo
Prof. Madhumita Tamhane
Floyd's ALGORITHM
Prof. Madhumita TamhaneM
B
L
A
X
48
20
10 19
18
710
23
• Floyd’s Algorithm can be used to help solve Travelling
Salesman and other shortest routes problems.
• Floyd’s uses a matrix form.
• Above problem is explained to find shortest route.
Floyd's ALGORITHM
Prof. Madhumita Tamhane
D( 0 ) R( 0 )
This is the distance matrix.
It initially shows the direct
distance between one vertex
and the others. The infinity sign
denotes no direct route.
This is the route matrix.
It will eventually show the
next vertex that needs to be
taken on route to finding the
shortest route to another vertex.
A M L B X
A 23 10 18
M 23 10 48
L 10 10 19 7
B 48 19 20
X 18 7 20
A M L B X
A 1 2 3 4 5
M 1 2 3 4 5
L 1 2 3 4 5
B 1 2 3 4 5
X 1 2 3 4 5
∞
∞
∞
∞
∞ ∞
∞
∞
∞
Prof. Madhumita Tamhane
D( 0 ) R( 0 )
We highlight the first column and row of the Distance matrix and compare
all other items with the sum of the items highlighted in the same row and
column.
If the sum is less than the item then it should be replaced with the sum.
A M L B X
A 23 10 18
M 23 10 48
L 10 10 19 7
B 48 19 20
X 18 7 20
A M L B X
A 1 2 3 4 5
M 1 2 3 4 5
L 1 2 3 4 5
B 1 2 3 4 5
X 1 2 3 4 5
∞ ∞
∞ ∞
∞
∞ ∞
∞ ∞
Prof. Madhumita Tamhane
D( 0 ) R( 0 )
23 + 23 = 46, less than so
change.
A M L B X
A 23 10 18
M 23 10 48
L 10 10 19 7
B 48 19 20
X 18 7 20
A M L B X
A 1 2 3 4 5
M 1 2 3 4 5
L 1 2 3 4 5
B 1 2 3 4 5
X 1 2 3 4 5
∞
We highlight the first column and row of the Distance matrix and compare
all other items with the sum of the items highlighted in the same row and
column.
If the sum is less than the item then it should be replaced with the sum.
∞ ∞
∞ ∞
∞
∞ ∞
∞ ∞
Prof. Madhumita Tamhane
D( 0 ) R( 0 )
23 + 23 = 46, less than so
change.
A M L B X
A 23 10 18
M 23 46 10 48
L 10 10 19 7
B 48 19 20
X 18 7 20
∞
A M L B X
A 1 2 3 4 5
M 1 2 3 4 5
L 1 2 3 4 5
B 1 2 3 4 5
X 1 2 3 4 5
We highlight the first column and row of the Distance matrix and compare
all other items with the sum of the items highlighted in the same row and
column.
If the sum is less than the item then it should be replaced with the sum.
∞ ∞
∞
∞
∞ ∞
∞ ∞
Prof. Madhumita Tamhane
D( 0 ) R( 0 )
18 + 18 = 36, so replace this item.
!
Hence finally we have changed all desired cells in first iteration where sum is less
than the cell data.
!
Now whichever cell is changed, we put 1 (for node A) in corresponding cells in
matrix R(0). Finally at the end of first iteration…..
A M L B X
A 23 10 18
M 23 46 10 48 41
L 10 10 20 19 7
B 48 19 20
X 18 41 7 20 36
A M L B X
A 1 2 3 4 5
M 1 2 3 4 5
L 1 2 3 4 5
B 1 2 3 4 5
X 1 2 3 4 5
We highlight the first column and row of the Distance matrix and compare
all other items with the sum of the items highlighted in the same row and
column.
If the sum is less than the item then it should be replaced with the sum.
∞ ∞
∞ ∞
Prof. Madhumita Tamhane
R( 0 )
A M L B X
A 23 10 18
M 23 46 10 48 41
L 10 10 20 19 7
B 48 19 20
X 18 41 7 20 36
D( 0 )
A M L B X
A 1 2 3 4 5
M 1 1 3 4 1
L 1 2 1 4 5
B 1 2 3 4 5
X 1 1 3 4 1
∞ ∞
∞ ∞
Prof. Madhumita Tamhane
We have now completed one iteration. We rename the new matrices:
Subsequent iterations are now shown completed:
R( 1 )D( 1 )
A M L B X
A 23 10 18
M 23 46 10 48 41
L 10 10 20 19 7
B 48 19 20
X 18 41 7 20 36
A M L B X
A 1 2 3 4 5
M 1 1 3 4 1
L 1 2 1 4 5
B 1 2 3 4 5
X 1 1 3 4 1
∞ ∞
∞ ∞
Prof. Madhumita Tamhane
In second iteration, second row and column are highlighted. Similarly other cells are compared with
Sum of corresponding row and column and changed as before.
Corresponding cell at R(0) will have 2 (for node M). Result is …
R( 1 )D( 1 )
A M L B X
A 23 10 18
M 23 46 10 48 41
L 10 10 20 19 7
B 48 19 20
X 18 41 7 20 36
A M L B X
A 1 2 3 4 5
M 1 1 3 4 1
L 1 2 1 4 5
B 1 2 3 4 5
X 1 1 3 4 1
∞
∞ ∞
∞
Prof. Madhumita Tamhane
D( 1 ) R( 1 )
The items have been altered accordingly:
Subsequent iterations are now shown completed:
A M L B X
A 46 23 10 71 18
M 23 46 10 48 41
L 10 10 20 19 7
B 71 48 19 96 20
X 18 41 7 20 36
A M L B X
A 1 2 3 4 5
M 1 1 3 4 1
L 1 2 1 4 5
B 1 2 3 4 5
X 1 1 3 4 1
Prof. Madhumita Tamhane
D( 2 ) R( 2 )
We can now rename the matrices:
Similarly do 3rd, 4th and 5th iteration by highlighting 3rd, 4th and 5th
row and column respectively. Change cells of R(0) to 3, 4 or 5
accordingly. Final matrix is …
A M L B X
A 46 23 10 71 18
M 23 46 10 48 41
L 10 10 20 19 7
B 71 48 19 96 20
X 18 41 7 20 36
A M L B X
A 2 2 3 2 5
M 1 1 3 4 1
L 1 2 1 4 5
B 2 2 3 2 5
X 1 1 3 4 1
Prof. Madhumita Tamhane
D( 2 ) R( 2 )
Next iteration:
A M L B X
A 46 23 10 71 18
M 23 46 10 48 41
L 10 10 20 19 7
B 71 48 19 96 20
X 18 41 7 20 36
A M L B X
A 2 2 3 2 5
M 1 1 3 4 1
L 1 2 1 4 5
B 2 2 3 2 5
X 1 1 3 4 1
Prof. Madhumita Tamhane
D( 2 ) R( 2 )
Next iteration, the items are altered appropriately :
A M L B X
A 20 20 10 29 17
M 20 20 10 29 17
L 10 10 20 19 7
B 29 29 19 38 20
X 17 17 7 20 14
A M L B X
A 3 3 3 3 3
M 3 3 3 3 3
L 1 2 1 4 5
B 3 3 3 3 5
X 3 3 3 4 3
Prof. Madhumita Tamhane
D( 3 ) R( 3 )
The matrices are renamed :
A M L B X
A 20 20 10 29 17
M 20 20 10 29 17
L 10 10 20 19 7
B 29 29 19 38 20
X 17 17 7 20 14
A M L B X
A 3 3 3 3 3
M 3 3 3 3 3
L 1 2 1 4 5
B 3 3 3 3 5
X 3 3 3 4 3
Prof. Madhumita Tamhane
The next iteration :
D( 3 ) R( 3 )
A M L B X
A 20 20 10 29 17
M 20 20 10 29 17
L 10 10 20 19 7
B 29 29 19 38 20
X 17 17 7 20 14
A M L B X
A 3 3 3 3 3
M 3 3 3 3 3
L 1 2 1 4 5
B 3 3 3 3 5
X 3 3 3 4 3
Prof. Madhumita Tamhane
In this iteration, you do not need to change any of the items, so we go
onto the next iteration :
D( 3 ) R( 3 )
A M L B X
A 20 20 10 29 17
M 20 20 10 29 17
L 10 10 20 19 7
B 29 29 19 38 20
X 17 17 7 20 14
A M L B X
A 3 3 3 3 3
M 3 3 3 3 3
L 1 2 1 4 5
B 3 3 3 3 5
X 3 3 3 4 3
Prof. Madhumita Tamhane
A M L B X
A 20 20 10 29 17
M 20 20 10 29 17
L 10 10 20 19 7
B 29 29 19 38 20
X 17 17 7 20 14
A M L B X
A 3 3 3 3 3
M 3 3 3 3 3
L 1 2 1 4 5
B 3 3 3 3 5
X 3 3 3 4 3
D( 4 ) R( 4 )
Prof. Madhumita Tamhane
There is only one item that we need to change in this
case:
D( 4 ) R( 4 )
A M L B X
A 20 20 10 29 17
M 20 20 10 29 17
L 10 10 14 19 7
B 29 29 19 38 20
X 17 17 7 20 14
A M L B X
A 3 3 3 3 3
M 3 3 3 3 3
L 1 2 1 4 5
B 3 3 3 3 5
X 3 3 3 4 3
Prof. Madhumita Tamhane
These are the final matrices, remember that you can
use them to redraw the original network. You can then
use this to help us solve travelling salesman problems:
D( 5 ) R( 5 )
A M L B X
A 20 20 10 29 17
M 20 20 10 29 17
L 10 10 14 19 7
B 29 29 19 38 20
X 17 17 7 20 14
A M L B X
A 3 3 3 3 3
M 3 3 3 3 3
L 1 2 5 4 5
B 3 3 3 3 5
X 3 3 3 4 3
Prof. Madhumita Tamhane
page 1
M
B
L
A
X
29
20
10 19
17
710
20
29
17
This network now gives you a better idea of the quickest routes.
!The route matrix gives us an idea about the next vertex to visit on route -
1 represents A, 2 - M, etc.
Prof. Madhumita Tamhane
1
5
4
3
2
75 35
32
15
40
30
70
Q1.
Prof. Madhumita Tamhane
1 2 3 4 5
1 60 30 40 45 77
2 30 30 50 15 47
3 40 50 70 35 67
4 45 15 35 30 32
5 77 47 67 32 64
1 2 3 4 5
1 2 2 3 2 2
2 1 4 4 4 4
3 1 4 4 4 4
4 2 2 3 2 5
5 4 4 4 4 4
D( 5 ) R( 5 )
These are the completed matrices. Are yours correct?
Prof. Madhumita Tamhane
1
5
4
3
2
20 15 12
35
50
50
10
Q2.
Prof. Madhumita Tamhane
D( 5 ) R( 5 )
These are the completed matrices. Are yours correct?
1 2 3 4 5
1 100 50 50 65 60
2 50 40 20 35 30
3 50 20 20 15 10
4 65 35 15 24 12
5 60 30 10 12 20
1 2 3 4 5
1 2 2 3 3 3
2 1 3 3 4 3
3 1 2 5 4 5
4 3 2 3 5 5
5 3 3 3 4 3

More Related Content

PPTX
February 17, 2015
PPT
Parallel and perpendicular lines
PPT
Parallel and Perpendicular Slopes lines
PPT
Parallel and Perpendicular lines
PDF
24 kestirim-omar
PPTX
Thomas algorithm
PPT
5.6 Parallel & Perpendicular Lines
PPTX
Euclidean theories
February 17, 2015
Parallel and perpendicular lines
Parallel and Perpendicular Slopes lines
Parallel and Perpendicular lines
24 kestirim-omar
Thomas algorithm
5.6 Parallel & Perpendicular Lines
Euclidean theories

What's hot (19)

PPT
Parallel And Perpendicular Lines
PDF
4 ESO Academics - Unit 03 - Exercises 4.3.4 - The Remainder Theorem. Roots of...
PPTX
7.7 Solving Radical Equations
PPTX
Some methods for small systems of equations solutions
PDF
CBSE Deleted Syllabus Class 11, 12 Mathematics 2020-21
PPTX
Plane geometry
DOCX
Uas teori bil.
PPTX
Division of polynomials
PDF
surveying and levelling
PPT
Pythagorean theorem and distance formula
PPTX
Math12 lesson 6
PPTX
Trigonometric identities
PPTX
Sytems of linear equation
PPT
Completing the square (added and revised)
PPT
5.5 parallel and_perpendicular_lines
PPTX
Mathematics
PDF
PPT
3.5 write and graph equations of lines
PPT
Algebraic fractions
Parallel And Perpendicular Lines
4 ESO Academics - Unit 03 - Exercises 4.3.4 - The Remainder Theorem. Roots of...
7.7 Solving Radical Equations
Some methods for small systems of equations solutions
CBSE Deleted Syllabus Class 11, 12 Mathematics 2020-21
Plane geometry
Uas teori bil.
Division of polynomials
surveying and levelling
Pythagorean theorem and distance formula
Math12 lesson 6
Trigonometric identities
Sytems of linear equation
Completing the square (added and revised)
5.5 parallel and_perpendicular_lines
Mathematics
3.5 write and graph equations of lines
Algebraic fractions
Ad

Viewers also liked (9)

PPTX
(floyd's algm)
PPT
The Floyd–Warshall algorithm
PPT
Floyd Warshall Algorithm
PDF
All pairs shortest path algorithm
PDF
Floyd warshall-algorithm
PPT
Shortest path
PPTX
My presentation all shortestpath
PPTX
Dijkstra's algorithm
PPTX
Big o notation
(floyd's algm)
The Floyd–Warshall algorithm
Floyd Warshall Algorithm
All pairs shortest path algorithm
Floyd warshall-algorithm
Shortest path
My presentation all shortestpath
Dijkstra's algorithm
Big o notation
Ad

Similar to Flyod's algorithm for finding shortest path (20)

PPTX
unit3_Dynamic_Progrghaiajawzjabagamming1.pptx
PPTX
Bba i-bm-u-2- matrix -
PDF
Engg maths k notes(4)
PPTX
Hungarian Assignment Problem
PPT
Lecture11
PPT
001 ppt Matrix Algebra and application in Undergraduate Mathematics
PPTX
MATRICES
DOCX
R Matrix Math Quick Reference
PPTX
unit-4-dynamic programming
PPTX
Beginning direct3d gameprogrammingmath05_matrices_20160515_jintaeks
PPT
001 ppt Matrix Algebra Analysis and uses.ppt
PPT
Properties of Matrix Algebra and operations .
PPTX
DAA-Floyd Warshall Algorithm.pptx
PPT
Linear Algebra and Matrix
PPTX
Dynamic Programming - Matrix Chain Multiplication
PPTX
Matrices ppt
PDF
Chapter 3: Linear Systems and Matrices - Part 2/Slides
DOCX
BSC_COMPUTER _SCIENCE_UNIT-3_DISCRETE MATHEMATICS
PPTX
dynamic programming complete by Mumtaz Ali (03154103173)
unit3_Dynamic_Progrghaiajawzjabagamming1.pptx
Bba i-bm-u-2- matrix -
Engg maths k notes(4)
Hungarian Assignment Problem
Lecture11
001 ppt Matrix Algebra and application in Undergraduate Mathematics
MATRICES
R Matrix Math Quick Reference
unit-4-dynamic programming
Beginning direct3d gameprogrammingmath05_matrices_20160515_jintaeks
001 ppt Matrix Algebra Analysis and uses.ppt
Properties of Matrix Algebra and operations .
DAA-Floyd Warshall Algorithm.pptx
Linear Algebra and Matrix
Dynamic Programming - Matrix Chain Multiplication
Matrices ppt
Chapter 3: Linear Systems and Matrices - Part 2/Slides
BSC_COMPUTER _SCIENCE_UNIT-3_DISCRETE MATHEMATICS
dynamic programming complete by Mumtaz Ali (03154103173)

More from Madhumita Tamhane (20)

PPTX
Fiber optic sensors
PDF
OFDM for LTE
PDF
Small cells I : Femto cell
PDF
Optical wireless communication li fi
PDF
Optical Fiber Communication Part 3 Optical Digital Receiver
PDF
Optical fiber communication Part 2 Sources and Detectors
PDF
Optical fiber communication Part 1 Optical Fiber Fundamentals
PDF
Colout TV Fundamentals
PDF
Black and white TV fundamentals
PDF
Telecommunication switching system
PDF
Data Link Synchronous Protocols - SDLC, HDLC
PDF
Data communication protocols in centralised networks (in master:slave environ...
PDF
Data link control line control unit LCU
PDF
Line codes
PDF
ISDN Integrated Services Digital Network
PDF
Asynchronous Transfer Mode ATM
PDF
Setting Artificial Neural Networks parameters
PDF
Weight enumerators of block codes and the mc williams
PDF
Justesen codes alternant codes goppa codes
Fiber optic sensors
OFDM for LTE
Small cells I : Femto cell
Optical wireless communication li fi
Optical Fiber Communication Part 3 Optical Digital Receiver
Optical fiber communication Part 2 Sources and Detectors
Optical fiber communication Part 1 Optical Fiber Fundamentals
Colout TV Fundamentals
Black and white TV fundamentals
Telecommunication switching system
Data Link Synchronous Protocols - SDLC, HDLC
Data communication protocols in centralised networks (in master:slave environ...
Data link control line control unit LCU
Line codes
ISDN Integrated Services Digital Network
Asynchronous Transfer Mode ATM
Setting Artificial Neural Networks parameters
Weight enumerators of block codes and the mc williams
Justesen codes alternant codes goppa codes

Recently uploaded (20)

PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Digital Logic Computer Design lecture notes
PDF
PPT on Performance Review to get promotions
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
DOCX
573137875-Attendance-Management-System-original
PPTX
Welding lecture in detail for understanding
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPT
Project quality management in manufacturing
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
web development for engineering and engineering
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Geodesy 1.pptx...............................................
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
Internet of Things (IOT) - A guide to understanding
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Digital Logic Computer Design lecture notes
PPT on Performance Review to get promotions
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
573137875-Attendance-Management-System-original
Welding lecture in detail for understanding
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Automation-in-Manufacturing-Chapter-Introduction.pdf
Project quality management in manufacturing
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
web development for engineering and engineering
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Geodesy 1.pptx...............................................
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Internet of Things (IOT) - A guide to understanding

Flyod's algorithm for finding shortest path

  • 2. Prof. Madhumita TamhaneM B L A X 48 20 10 19 18 710 23 • Floyd’s Algorithm can be used to help solve Travelling Salesman and other shortest routes problems. • Floyd’s uses a matrix form. • Above problem is explained to find shortest route. Floyd's ALGORITHM
  • 3. Prof. Madhumita Tamhane D( 0 ) R( 0 ) This is the distance matrix. It initially shows the direct distance between one vertex and the others. The infinity sign denotes no direct route. This is the route matrix. It will eventually show the next vertex that needs to be taken on route to finding the shortest route to another vertex. A M L B X A 23 10 18 M 23 10 48 L 10 10 19 7 B 48 19 20 X 18 7 20 A M L B X A 1 2 3 4 5 M 1 2 3 4 5 L 1 2 3 4 5 B 1 2 3 4 5 X 1 2 3 4 5 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞
  • 4. Prof. Madhumita Tamhane D( 0 ) R( 0 ) We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. A M L B X A 23 10 18 M 23 10 48 L 10 10 19 7 B 48 19 20 X 18 7 20 A M L B X A 1 2 3 4 5 M 1 2 3 4 5 L 1 2 3 4 5 B 1 2 3 4 5 X 1 2 3 4 5 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞
  • 5. Prof. Madhumita Tamhane D( 0 ) R( 0 ) 23 + 23 = 46, less than so change. A M L B X A 23 10 18 M 23 10 48 L 10 10 19 7 B 48 19 20 X 18 7 20 A M L B X A 1 2 3 4 5 M 1 2 3 4 5 L 1 2 3 4 5 B 1 2 3 4 5 X 1 2 3 4 5 ∞ We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞
  • 6. Prof. Madhumita Tamhane D( 0 ) R( 0 ) 23 + 23 = 46, less than so change. A M L B X A 23 10 18 M 23 46 10 48 L 10 10 19 7 B 48 19 20 X 18 7 20 ∞ A M L B X A 1 2 3 4 5 M 1 2 3 4 5 L 1 2 3 4 5 B 1 2 3 4 5 X 1 2 3 4 5 We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞
  • 7. Prof. Madhumita Tamhane D( 0 ) R( 0 ) 18 + 18 = 36, so replace this item. ! Hence finally we have changed all desired cells in first iteration where sum is less than the cell data. ! Now whichever cell is changed, we put 1 (for node A) in corresponding cells in matrix R(0). Finally at the end of first iteration….. A M L B X A 23 10 18 M 23 46 10 48 41 L 10 10 20 19 7 B 48 19 20 X 18 41 7 20 36 A M L B X A 1 2 3 4 5 M 1 2 3 4 5 L 1 2 3 4 5 B 1 2 3 4 5 X 1 2 3 4 5 We highlight the first column and row of the Distance matrix and compare all other items with the sum of the items highlighted in the same row and column. If the sum is less than the item then it should be replaced with the sum. ∞ ∞ ∞ ∞
  • 8. Prof. Madhumita Tamhane R( 0 ) A M L B X A 23 10 18 M 23 46 10 48 41 L 10 10 20 19 7 B 48 19 20 X 18 41 7 20 36 D( 0 ) A M L B X A 1 2 3 4 5 M 1 1 3 4 1 L 1 2 1 4 5 B 1 2 3 4 5 X 1 1 3 4 1 ∞ ∞ ∞ ∞
  • 9. Prof. Madhumita Tamhane We have now completed one iteration. We rename the new matrices: Subsequent iterations are now shown completed: R( 1 )D( 1 ) A M L B X A 23 10 18 M 23 46 10 48 41 L 10 10 20 19 7 B 48 19 20 X 18 41 7 20 36 A M L B X A 1 2 3 4 5 M 1 1 3 4 1 L 1 2 1 4 5 B 1 2 3 4 5 X 1 1 3 4 1 ∞ ∞ ∞ ∞
  • 10. Prof. Madhumita Tamhane In second iteration, second row and column are highlighted. Similarly other cells are compared with Sum of corresponding row and column and changed as before. Corresponding cell at R(0) will have 2 (for node M). Result is … R( 1 )D( 1 ) A M L B X A 23 10 18 M 23 46 10 48 41 L 10 10 20 19 7 B 48 19 20 X 18 41 7 20 36 A M L B X A 1 2 3 4 5 M 1 1 3 4 1 L 1 2 1 4 5 B 1 2 3 4 5 X 1 1 3 4 1 ∞ ∞ ∞ ∞
  • 11. Prof. Madhumita Tamhane D( 1 ) R( 1 ) The items have been altered accordingly: Subsequent iterations are now shown completed: A M L B X A 46 23 10 71 18 M 23 46 10 48 41 L 10 10 20 19 7 B 71 48 19 96 20 X 18 41 7 20 36 A M L B X A 1 2 3 4 5 M 1 1 3 4 1 L 1 2 1 4 5 B 1 2 3 4 5 X 1 1 3 4 1
  • 12. Prof. Madhumita Tamhane D( 2 ) R( 2 ) We can now rename the matrices: Similarly do 3rd, 4th and 5th iteration by highlighting 3rd, 4th and 5th row and column respectively. Change cells of R(0) to 3, 4 or 5 accordingly. Final matrix is … A M L B X A 46 23 10 71 18 M 23 46 10 48 41 L 10 10 20 19 7 B 71 48 19 96 20 X 18 41 7 20 36 A M L B X A 2 2 3 2 5 M 1 1 3 4 1 L 1 2 1 4 5 B 2 2 3 2 5 X 1 1 3 4 1
  • 13. Prof. Madhumita Tamhane D( 2 ) R( 2 ) Next iteration: A M L B X A 46 23 10 71 18 M 23 46 10 48 41 L 10 10 20 19 7 B 71 48 19 96 20 X 18 41 7 20 36 A M L B X A 2 2 3 2 5 M 1 1 3 4 1 L 1 2 1 4 5 B 2 2 3 2 5 X 1 1 3 4 1
  • 14. Prof. Madhumita Tamhane D( 2 ) R( 2 ) Next iteration, the items are altered appropriately : A M L B X A 20 20 10 29 17 M 20 20 10 29 17 L 10 10 20 19 7 B 29 29 19 38 20 X 17 17 7 20 14 A M L B X A 3 3 3 3 3 M 3 3 3 3 3 L 1 2 1 4 5 B 3 3 3 3 5 X 3 3 3 4 3
  • 15. Prof. Madhumita Tamhane D( 3 ) R( 3 ) The matrices are renamed : A M L B X A 20 20 10 29 17 M 20 20 10 29 17 L 10 10 20 19 7 B 29 29 19 38 20 X 17 17 7 20 14 A M L B X A 3 3 3 3 3 M 3 3 3 3 3 L 1 2 1 4 5 B 3 3 3 3 5 X 3 3 3 4 3
  • 16. Prof. Madhumita Tamhane The next iteration : D( 3 ) R( 3 ) A M L B X A 20 20 10 29 17 M 20 20 10 29 17 L 10 10 20 19 7 B 29 29 19 38 20 X 17 17 7 20 14 A M L B X A 3 3 3 3 3 M 3 3 3 3 3 L 1 2 1 4 5 B 3 3 3 3 5 X 3 3 3 4 3
  • 17. Prof. Madhumita Tamhane In this iteration, you do not need to change any of the items, so we go onto the next iteration : D( 3 ) R( 3 ) A M L B X A 20 20 10 29 17 M 20 20 10 29 17 L 10 10 20 19 7 B 29 29 19 38 20 X 17 17 7 20 14 A M L B X A 3 3 3 3 3 M 3 3 3 3 3 L 1 2 1 4 5 B 3 3 3 3 5 X 3 3 3 4 3
  • 18. Prof. Madhumita Tamhane A M L B X A 20 20 10 29 17 M 20 20 10 29 17 L 10 10 20 19 7 B 29 29 19 38 20 X 17 17 7 20 14 A M L B X A 3 3 3 3 3 M 3 3 3 3 3 L 1 2 1 4 5 B 3 3 3 3 5 X 3 3 3 4 3 D( 4 ) R( 4 )
  • 19. Prof. Madhumita Tamhane There is only one item that we need to change in this case: D( 4 ) R( 4 ) A M L B X A 20 20 10 29 17 M 20 20 10 29 17 L 10 10 14 19 7 B 29 29 19 38 20 X 17 17 7 20 14 A M L B X A 3 3 3 3 3 M 3 3 3 3 3 L 1 2 1 4 5 B 3 3 3 3 5 X 3 3 3 4 3
  • 20. Prof. Madhumita Tamhane These are the final matrices, remember that you can use them to redraw the original network. You can then use this to help us solve travelling salesman problems: D( 5 ) R( 5 ) A M L B X A 20 20 10 29 17 M 20 20 10 29 17 L 10 10 14 19 7 B 29 29 19 38 20 X 17 17 7 20 14 A M L B X A 3 3 3 3 3 M 3 3 3 3 3 L 1 2 5 4 5 B 3 3 3 3 5 X 3 3 3 4 3
  • 21. Prof. Madhumita Tamhane page 1 M B L A X 29 20 10 19 17 710 20 29 17 This network now gives you a better idea of the quickest routes. !The route matrix gives us an idea about the next vertex to visit on route - 1 represents A, 2 - M, etc.
  • 22. Prof. Madhumita Tamhane 1 5 4 3 2 75 35 32 15 40 30 70 Q1.
  • 23. Prof. Madhumita Tamhane 1 2 3 4 5 1 60 30 40 45 77 2 30 30 50 15 47 3 40 50 70 35 67 4 45 15 35 30 32 5 77 47 67 32 64 1 2 3 4 5 1 2 2 3 2 2 2 1 4 4 4 4 3 1 4 4 4 4 4 2 2 3 2 5 5 4 4 4 4 4 D( 5 ) R( 5 ) These are the completed matrices. Are yours correct?
  • 24. Prof. Madhumita Tamhane 1 5 4 3 2 20 15 12 35 50 50 10 Q2.
  • 25. Prof. Madhumita Tamhane D( 5 ) R( 5 ) These are the completed matrices. Are yours correct? 1 2 3 4 5 1 100 50 50 65 60 2 50 40 20 35 30 3 50 20 20 15 10 4 65 35 15 24 12 5 60 30 10 12 20 1 2 3 4 5 1 2 2 3 3 3 2 1 3 3 4 3 3 1 2 5 4 5 4 3 2 3 5 5 5 3 3 3 4 3