5. Networks
A B C D E F G
A - - 310 - 300 - 620
B - - 550 430 530 330 -
C 310 550 - - 350 - -
D - 430 - - - 210 390
E 300 530 350 - - 380 360
F - 330 - 210 380 - -
G 620 - - 390 360 - -
You can start at ANY node, but let’s choose A
• Decide row/column (lets choose column)
• If you choose a column, rule out the LINE for A
• Find the shortest connection from A
• Now Rule out the rest of row E
• look at both columns for A and E for shortest connection
• Rule out the rest of row C
• Now we look at columns A, E, C for shortest connection
• Rule out rest of row G
• Include column G, find shortest from A, E, C, G
Prim’s algorithm:
Minimum Spanning Tree:
AC, AE, EF, EG, FB, FD
6. Maximum flow:
The maximum flow from the source, that reaches the endpoint (sink)
50
40
10
30 40
30
20
A
B
X
C
D
A-B-X = 40
10
0
A-B-C-X = 100
0
30
A-C-X = 30
0
0
A-D-X = 20
10
0
Total = 100