Introduction to Computer Science CSCI 109 An al algor orithm hm - - PowerPoint PPT Presentation

introduction to computer science
SMART_READER_LITE
LIVE PREVIEW

Introduction to Computer Science CSCI 109 An al algor orithm hm - - PowerPoint PPT Presentation

Introduction to Computer Science CSCI 109 An al algor orithm hm (pronounced AL-go-rith- Readings um) is a procedure or formula for St. Amant, Ch. 4 solving a problem. The word derives from the name of the mathematician, Mohammed


slide-1
SLIDE 1

Introduction to Computer Science

CSCI 109

Andrew Goodney Fall 2019

Readings

  • St. Amant, Ch. 4

Lecture 4: Data Structures & Algorithms Sept. 23rd, 2019

“An al algor

  • rithm

hm (pronounced AL-go-rith- um) is a procedure or formula for solving a problem. The word derives from the name of the mathematician, Mohammed ibn-Musa al-Khwarizmi, who was part of the royal court in Baghdad and who lived from about 780 to 850.”

slide-2
SLIDE 2

Reminders

u HW #1 due tomorrow. u Grading: After HW#1 is graded, if you feel there has been a

grading error, you have two options: #1 (best option) go to TA

  • ffice hours to discuss the problem. This will give you a chance to

get feedback on your answer while also resolving the dispute. Option #2: post a private note on Piazza and the graders will look into the issue.

u HW#2 out later today

1

slide-3
SLIDE 3

Where are we?

2

slide-4
SLIDE 4

Problem Solving

u Architecture puts the computer under the microscope u Computers are used to solve problems u Abstraction for problems

v How to represent a problem ? v How to break down a problem into smaller parts ? v What does a solution look like ?

u Two key building blocks

v Algorithms v Abstract data types

5

slide-5
SLIDE 5

Algorithms

u Algorithm: a step by step description of actions to solve

a problem

u Typically at an abstract level u Analogy: clearly written recipe for preparing a meal

“Algorithms are models of procedures at an abstract level we decided is appropriate.” [St. Amant, pp. 53]

6

slide-6
SLIDE 6

Abstract Data Types

u Models of collections of information u Typically at an abstract level

“… describes what can be done with a collection of information, without going down to the level of computer storage.” [St. Amant, pp. 53]

7

slide-7
SLIDE 7

Sequences, Trees and Graphs

8

u Sequence: a list

v Items are called elements v Item number is called the index

u Graph u Tree

Eric Emily Jane Terry Bob Jim Mike Chris Bob

slide-8
SLIDE 8

Sequences, Trees and Graphs

9

u Sequence: a list

v Items are called elements v Item number is called the index

u Tree

Eric Emily Jane Terry Bob

u Lists

v Searching

u Unsorted list u Sorted list

v Sorting

u Selection sort u Quicksort

u The notion of a brute force

algorithm

u The divide and conquer

strategy

slide-9
SLIDE 9

Motivation for Abstract Data Structures (Graphs, Trees)

u The nature of some data, and the way we need to accesses it

  • ften requires some structure, or organization to make things

efficient (or even possible)

u Data: large set of people and their family relationship used

for genetic research

u Problems: two people share a rare genetic trait, how closely

are the related? (motivates for a tree)

10

slide-10
SLIDE 10

Motivation for Abstract Data Structures (Graphs, Trees)

u Data set: roads and intersections. u Problem: how to travel from A to B @5pm on a Friday? How

to avoid traffic vs. prefer freeways? (motivates a weighted graph)

u Data set: freight enters country at big port (LA/Long Beach). u Problem: How to route freight given train lines/connections?

v Route fastest, vs. lowest cost?

u Data set: airport locations u Problem: how to route and deliver a package to any address

in the US with minimum cost? Think UPS, FedEx

11

slide-11
SLIDE 11

Motivation for Abstract Data Structures (Graphs, Trees)

u Data set: network switches and their connectivity (network

links)

u Problem: Chose a subset of network links that connect all

switches without loops (networks don’t like loops). Motivates graphs, and graph -> tree algorithm

12

slide-12
SLIDE 12

Motivation for Abstract Data Structures (Graphs, Trees)

u Data set: potential solutions to a big problem u Problem: how to find an optimal solution to the problem,

without searching every possibility (solution space too big). Motivates graphs and graph search to solve problems.

u Other data/problems that motivate graphs/trees:

v Financial networks and money flows, social networks, rendering HTML

code, compilers, 3D graphics and game engines… and more

13

slide-13
SLIDE 13

Trees

u Each node/vertex has

exactly one parent node/vertex

u No loops u Directed (links/edges point

in a particular direction)

u Undirected (links/edges

don’t have a direction)

u Weighted (links/edges have

weights)

u Unweighted (links/edges

don’t have weights)

14

Eric Emily Jane Terry Bob

slide-14
SLIDE 14

Which of these are NOT trees?

15

1 2 3 5 6 7 4 8

slide-15
SLIDE 15

Graph/Tree Traversal

u Traversing a graph or a tree: “moving” and examining the

nodes to enumerate the nodes or look for solutions

u Example: find all living descendants of X in our genetic

database.

u For traversing a graph we pick a starting node, then two

methods are obvious:

v Depth first

u Go as deep (far away from starting node) as possible before backtracking

v Breadth first

u Examine one layer at a time 16

slide-16
SLIDE 16

Tree Traversal

u Depth first traversal

Eric, Emily, Terry, Bob, Drew, Pam, Kim, Jane

u Breadth first traversal

Eric, Emily, Jane, Terry, Bob, Drew, Pam, Kim Eric, Jane, Emily, Bob, Terry, Pam, Drew, Kim

17

Eric Emily Jane Terry Bob Drew Pam Kim

slide-17
SLIDE 17

Tree Traversal

u Depth first vs. Breadth first eventually visit all nodes, but do

so in a different order

u Used to answer different questions

v Depth first: good for game trees, evaluating down a certain path v Breadth first: look for shortest path between two nodes (e.g for

computer networks)

u Roughly:

v Depth first: find ‘a’ solution to the problem v Breadth first: find ‘the’ solution to the problem

18

slide-18
SLIDE 18

Graphs: Directed and Undirected

19

Tia Jim Mike Chris Bob Joe Sofie

Undirected

Tia Jim Mike Chris Bob Joe Sofie

Directed

slide-19
SLIDE 19

Graph to Tree Conversion Algorithms

u Sometimes the question is best answered by a tree, but we

have a graph

u Need to convert graph to tree (by deleting edges) u Usually want to create a “spanning tree”

20

slide-20
SLIDE 20

Spanning Trees

u Spanning tree: Any tree that covers all vertices

v “Cover” = “include” in graph-speak

u Example: graph of social network connections. Want to

create a “phone tree” to disseminate information in the event of an emergency

u Example: network of switches with redundant links and

multiple paths between switches (there are loops aka cycles in the graph). Need to chose a set of links that connects all switches with no loops.

21

slide-21
SLIDE 21

Minimum Spanning trees

uSpanning tree: Any tree that covers all vertices, not

as common as the MST

uMinimum spanning tree (MST): Tree of minimal total

edge cost

uIf you have a graph with weighted edges, a MST is

the tree where the sum of the weights of the edges is minimum

uThere is at least one MST, could be more than one uIf you have unweighted edges any spanning tree is a

MST

22

slide-22
SLIDE 22

uWhy compute the minimum spanning tree?

v Minimize the cost of connections between cities

(logistics/shipping)

v Minimize of cost of wires in a layout (printed

circuit, integrated circuit design)

23

slide-23
SLIDE 23

Edge costs, minimum spanning tree

24

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

slide-24
SLIDE 24

Edge costs, minimum spanning tree

25

Tia Jim Mike Chris Bob Joe Sofie

1 1 2 4 3 1 1 3 4 1 1

Tia Jim Mike Chris Bob Joe Sofie

1 3 1 4 1 1

slide-25
SLIDE 25

Spanning Trees

Tia Jim Mike Chris Bob Joe Sofie

1 3 1 4 1 1

slide-26
SLIDE 26

Spanning Trees

27

Tia Jim Mike Chris Bob Joe Sofie

1 3 1 4 1 1

Tia Jim Mike Chris Bob Joe Sofie

1 1 2 3 1 1

slide-27
SLIDE 27

Computing the MST

uTwo greedy algorithms to compute the MST

v Prim’s algorithm: Start with any node and greedily

grow the tree from there

v Kruskal’s algorithm: Order edges in ascending order of

  • cost. Add next edge to the tree without creating a

cycle.

u‘Greedy’ means solution is refined at each step

using the most obvious next step, with the hope that eventual solution is globally optimal

28

slide-28
SLIDE 28

Prim’s algorithm

u Initialize the minimum spanning tree with a vertex chosen at

random.

u Find all the edges that connect the tree to new vertices (i.e

uncovered, or disconnected), find the minimum and add it to the tree

u Keep repeating step 2 until all vertices are added to the MST

(adapted from: https://www.programiz.com/dsa )

29

slide-29
SLIDE 29

Prim’s algorithm

30

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

1 Joe-Jim 1 Jim-Sofie 1 Jim-Tia 1 Tia-Bob 1 Chris-Bob 1 Mike-Bob 2 Chris-Jim 3 Tia-Chris 3 Mike-Tia 4 Joe-Tia 4 Jim-Bob

slide-30
SLIDE 30

Prim’s algorithm

31

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

1 Joe-Jim 1 Jim-Sofie 1 Jim-Tia 1 Tia-Bob 1 Chris-Bob 1 Mike-Bob 2 Chris-Jim 3 Tia-Chris 3 Mike-Tia 4 Joe-Tia 4 Jim-Bob

slide-31
SLIDE 31

Prim’s algorithm

32

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

1 Joe-Jim 1 Jim-Sofie 1 Jim-Tia 1 Tia-Bob 1 Chris-Bob 1 Mike-Bob 2 Chris-Jim 3 Tia-Chris 3 Mike-Tia 4 Joe-Tia 4 Jim-Bob

slide-32
SLIDE 32

Prim’s algorithm

33

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

1 Joe-Jim 1 Jim-Sofie 1 Jim-Tia 1 Tia-Bob 1 Chris-Bob 1 Mike-Bob 2 Chris-Jim 3 Tia-Chris 3 Mike-Tia 4 Joe-Tia 4 Jim-Bob

slide-33
SLIDE 33

Prim’s algorithm

34

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

1 Joe-Jim 1 Jim-Sofie 1 Jim-Tia 1 Tia-Bob 1 Chris-Bob 1 Mike-Bob 2 Chris-Jim 3 Tia-Chris 3 Mike-Tia 4 Joe-Tia 4 Jim-Bob

slide-34
SLIDE 34

Prim’s algorithm

35

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

1 Joe-Jim 1 Jim-Sofie 1 Jim-Tia 1 Tia-Bob 1 Chris-Bob 1 Mike-Bob 2 Chris-Jim 3 Tia-Chris 3 Mike-Tia 4 Joe-Tia 4 Jim-Bob

slide-35
SLIDE 35

Prim’s algorithm

36

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

1 Joe-Jim 1 Jim-Sofie 1 Jim-Tia 1 Tia-Bob 1 Chris-Bob 1 Mike-Bob 2 Chris-Jim 3 Tia-Chris 3 Mike-Tia 4 Joe-Tia 4 Jim-Bob

slide-36
SLIDE 36

Kruskal’s algorithm

u Sort all the edges from low weight to high u Take the edge with the lowest weight, if adding the edge

would create a cycle, then reject this edge and select the edge with the next lowest weight

u Keep adding edges until we reach all vertices.

(adapted from: https://www.programiz.com/dsa )

37

slide-37
SLIDE 37

Kruskal’s algorithm

38

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

1 Joe-Jim 1 Jim-Sofie 1 Jim-Tia 1 Tia-Bob 1 Chris-Bob 1 Mike-Bob 2 Chris-Jim 3 Tia-Chris 3 Mike-Tia 4 Joe-Tia 4 Jim-Bob

slide-38
SLIDE 38

Kruskal’s algorithm

39

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

1 Joe-Jim 1 Jim-Sofie 1 Jim-Tia 1 Tia-Bob 1 Chris-Bob 1 Mike-Bob 2 Chris-Jim 3 Tia-Chris 3 Mike-Tia 4 Joe-Tia 4 Jim-Bob

slide-39
SLIDE 39

Kruskal’s algorithm

40

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

1 Joe-Jim 1 Jim-Sofie 1 Jim-Tia 1 Tia-Bob 1 Chris-Bob 1 Mike-Bob 2 Chris-Jim 3 Tia-Chris 3 Mike-Tia 4 Joe-Tia 4 Jim-Bob

slide-40
SLIDE 40

Kruskal’s algorithm

41

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

1 Joe-Jim 1 Jim-Sofie 1 Jim-Tia 1 Tia-Bob 1 Chris-Bob 1 Mike-Bob 2 Chris-Jim 3 Tia-Chris 3 Mike-Tia 4 Joe-Tia 4 Jim-Bob

slide-41
SLIDE 41

Kruskal’s algorithm

42

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

1 Joe-Jim 1 Jim-Sofie 1 Jim-Tia 1 Tia-Bob 1 Chris-Bob 1 Mike-Bob 2 Chris-Jim 3 Tia-Chris 3 Mike-Tia 4 Joe-Tia 4 Jim-Bob

slide-42
SLIDE 42

Kruskal’s algorithm

43

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

1 Joe-Jim 1 Jim-Sofie 1 Jim-Tia 1 Tia-Bob 1 Chris-Bob 1 Mike-Bob 2 Chris-Jim 3 Tia-Chris 3 Mike-Tia 4 Joe-Tia 4 Jim-Bob

slide-43
SLIDE 43

Kruskal’s algorithm

44

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

1 Joe-Jim 1 Jim-Sofie 1 Jim-Tia 1 Tia-Bob 1 Chris-Bob 1 Mike-Bob 2 Chris-Jim 3 Tia-Chris 3 Mike-Tia 4 Joe-Tia 4 Jim-Bob

slide-44
SLIDE 44

Kruskal’s algorithm

45

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

1 Joe-Jim 1 Jim-Sofie 1 Jim-Tia 1 Tia-Bob 1 Chris-Bob 1 Mike-Bob 2 Chris-Jim 3 Tia-Chris 3 Mike-Tia 4 Joe-Tia 4 Jim-Bob

slide-45
SLIDE 45

Kruskal’s algorithm

46

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

1 Joe-Jim 1 Jim-Sofie 1 Jim-Tia 1 Tia-Bob 1 Chris-Bob 1 Mike-Bob 2 Chris-Jim 3 Tia-Chris 3 Mike-Tia 4 Joe-Tia 4 Jim-Bob

slide-46
SLIDE 46

Kruskal’s algorithm

47

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

1 Joe-Jim 1 Jim-Sofie 1 Jim-Tia 1 Tia-Bob 1 Chris-Bob 1 Mike-Bob 2 Chris-Jim 3 Tia-Chris 3 Mike-Tia 4 Joe-Tia 4 Jim-Bob

slide-47
SLIDE 47

Kruskal’s algorithm

48

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

1 Joe-Jim 1 Jim-Sofie 1 Jim-Tia 1 Tia-Bob 1 Chris-Bob 1 Mike-Bob 2 Chris-Jim 3 Tia-Chris 3 Mike-Tia 4 Joe-Tia 4 Jim-Bob

slide-48
SLIDE 48

Kruskal’s algorithm

49

Tia Jim Mike Chris Bob Joe Sofie

Undirected

1 1 2 4 3 1 1 3 4 1 1

1 Joe-Jim 1 Jim-Sofie 1 Jim-Tia 1 Tia-Bob 1 Chris-Bob 1 Mike-Bob 2 Chris-Jim 3 Tia-Chris 3 Mike-Tia 4 Joe-Tia 4 Jim-Bob

slide-49
SLIDE 49

Kruskal’s algorithm example #2

50

Tia Jim Mike Chris Bob Joe Sofie

Undirected

4 1 2 4 3 4 3 2 1 5

1 Jim-Sofie 1 Jim-Tia 2 Chris-Jim 2 Joe-Tia 3 Tia-Chris 3 Mike-Tia 4 Jim-Bob 4 Joe-Jim 4 Chris-Bob 5 Tia-Bob

slide-50
SLIDE 50

Kruskal’s algorithm example #2

51

Tia Jim Mike Chris Bob Joe Sofie

Undirected

4 1 2 4 3 4 3 2 1 5

1 Jim-Sofie 1 Jim-Tia 2 Chris-Jim 2 Joe-Tia 3 Tia-Chris 3 Mike-Tia 4 Jim-Bob 4 Joe-Jim 4 Chris-Bob 5 Tia-Bob

slide-51
SLIDE 51

Kruskal’s algorithm example #2

52

Tia Jim Mike Chris Bob Joe Sofie

Undirected

4 1 2 4 3 4 3 2 1 5

1 Jim-Sofie 1 Jim-Tia 2 Chris-Jim 2 Joe-Tia 3 Tia-Chris 3 Mike-Tia 4 Jim-Bob 4 Joe-Jim 4 Chris-Bob 5 Tia-Bob

slide-52
SLIDE 52

Kruskal’s algorithm example #2

53

Tia Jim Mike Chris Bob Joe Sofie

Undirected

4 1 2 4 3 4 3 2 1 5

1 Jim-Sofie 1 Jim-Tia 2 Chris-Jim 2 Joe-Tia 3 Tia-Chris 3 Mike-Tia 4 Jim-Bob 4 Joe-Jim 4 Chris-Bob 5 Tia-Bob

slide-53
SLIDE 53

Kruskal’s algorithm example #2

54

Tia Jim Mike Chris Bob Joe Sofie

Undirected

4 1 2 4 3 4 3 2 1 5

1 Jim-Sofie 1 Jim-Tia 2 Chris-Jim 2 Joe-Tia 3 Tia-Chris 3 Mike-Tia 4 Jim-Bob 4 Joe-Jim 4 Chris-Bob 5 Tia-Bob

slide-54
SLIDE 54

Kruskal’s algorithm example #2

55

Tia Jim Mike Chris Bob Joe Sofie

Undirected

4 1 2 4 3 4 3 2 1 5

1 Jim-Sofie 1 Jim-Tia 2 Chris-Jim 2 Joe-Tia 3 Tia-Chris 3 Mike-Tia 4 Jim-Bob 4 Joe-Jim 4 Chris-Bob 5 Tia-Bob

slide-55
SLIDE 55

Kruskal’s algorithm example #2

56

Tia Jim Mike Chris Bob Joe Sofie

Undirected

4 1 2 4 3 4 3 2 1 5

1 Jim-Sofie 1 Jim-Tia 2 Chris-Jim 2 Joe-Tia 3 Tia-Chris 3 Mike-Tia 4 Jim-Bob 4 Joe-Jim 4 Chris-Bob 5 Tia-Bob

slide-56
SLIDE 56

Kruskal’s algorithm example #2

57

Tia Jim Mike Chris Bob Joe Sofie

Undirected

4 1 2 4 3 4 3 2 1 5

1 Jim-Sofie 1 Jim-Tia 2 Chris-Jim 2 Joe-Tia 3 Tia-Chris 3 Mike-Tia 4 Jim-Bob 4 Joe-Jim 4 Chris-Bob 5 Tia-Bob

slide-57
SLIDE 57

Kruskal’s algorithm example #2

58

Tia Jim Mike Chris Bob Joe Sofie

Undirected

4 1 2 4 3 4 3 2 1 5

1 Jim-Sofie 1 Jim-Tia 2 Chris-Jim 2 Joe-Tia 3 Tia-Chris 3 Mike-Tia 4 Jim-Bob 4 Joe-Jim 4 Chris-Bob 5 Tia-Bob

slide-58
SLIDE 58

Kruskal’s algorithm example #2

59

Tia Jim Mike Chris Bob Joe Sofie

Undirected

4 1 2 4 3 4 3 2 1 5

1 Jim-Sofie 1 Jim-Tia 2 Chris-Jim 2 Joe-Tia 3 Tia-Chris 3 Mike-Tia 4 Jim-Bob 4 Joe-Jim 4 Chris-Bob 5 Tia-Bob

slide-59
SLIDE 59

Kruskal’s algorithm example #2

60

Tia Jim Mike Chris Bob Joe Sofie

Undirected

4 1 2 4 3 4 3 2 1 5

1 Jim-Sofie 1 Jim-Tia 2 Chris-Jim 2 Joe-Tia 3 Tia-Chris 3 Mike-Tia 4 Jim-Bob 4 Joe-Jim 4 Chris-Bob 5 Tia-Bob

slide-60
SLIDE 60

Shortest path

u For a given source vertex (node)

in the graph, it finds the path with lowest cost (i.e. the shortest path) between that vertex and every other vertex.

u Say your source vertex is Mike

u Lowest cost path from Mike to Jim

is Mike – Bob - Tia – Jim (cost 3)

u Lowest cost path from Mike to Joe

is Mike – Bob – Tia – Jim – Joe (cost 4)

v Very important for networking

applications!

61

Tia Jim Mike Chris Bob Joe Sofie

1 1 2 4 3 1 1 3 4 1 1

slide-61
SLIDE 61

Dijkstra’s algorithm: Basic idea

u Fan out from the initial node u In the beginning the distances to the neighbors of the initial node

are known. All other nodes are tentatively infinite distance away.

u The algorithm improves the estimates to the other nodes step by

step.

u As you fan out, perform the operation illustrated in this example:

if the current node A is marked with a distance of 4, and the edge connecting it with a neighbor B has length 2, then the distance to B (through A) will be 4 + 2 = 6. If B was previously marked with a distance greater than 6 then change it to 6. Otherwise, keep the current value.

62

slide-62
SLIDE 62

Shortest path from Mike

63

Tia Jim Mike Chris Bob Joe Sofie

1 1 2 4 3 1 1 3 4 1 1

Mike Bob Tia Jim Chris Sofie Joe 1 3 ∞ ∞ ∞ ∞

slide-63
SLIDE 63

Shortest path from Mike

64

Tia Jim Mike Chris Bob Joe Sofie

1 1 2 4 3 1 1 3 4 1 1

Mike Bob Tia Jim Chris Sofie Joe 1 3 ∞ ∞ ∞ ∞ 1 2 5 2 ∞ ∞

slide-64
SLIDE 64

Shortest path from Mike

65

Tia Jim Mike Chris Bob Joe Sofie

1 1 2 4 3 1 1 3 4 1 1

Mike Bob Tia Jim Chris Sofie Joe 1 3 ∞ ∞ ∞ ∞ 1 2 5 2 ∞ ∞ 1 2 4 2 ∞ ∞

slide-65
SLIDE 65

Shortest path from Mike

66

Tia Jim Mike Chris Bob Joe Sofie

1 1 2 4 3 1 1 3 4 1 1

Mike Bob Tia Jim Chris Sofie Joe 1 3 ∞ ∞ ∞ ∞ 1 2 5 2 ∞ ∞ 1 2 4 2 ∞ ∞ 1 2 3 2 ∞ 6

slide-66
SLIDE 66

Shortest path from Mike

67

Tia Jim Mike Chris Bob Joe Sofie

1 1 2 4 3 1 1 3 4 1 1

Mike Bob Tia Jim Chris Sofie Joe 1 3 ∞ ∞ ∞ ∞ 1 2 5 2 ∞ ∞ 1 2 4 2 ∞ ∞ 1 2 3 2 ∞ 6 1 2 3 2 4 4

slide-67
SLIDE 67

Shortest path from Mike

68

Tia Jim Mike Chris Bob Joe Sofie

1 1 2 4 3 1 1 3 4 1 1

Mike Bob Tia Jim Chris Sofie Joe 1 3 ∞ ∞ ∞ ∞ 1 2 5 2 ∞ ∞ 1 2 4 2 ∞ ∞ 1 2 3 2 ∞ 6 1 2 3 2 4 4 1 2 3 2 4 4

slide-68
SLIDE 68

Shortest path from Mike

69

Tia Jim Mike Chris Bob Joe Sofie

1 1 2 4 3 1 1 3 4 1 1

Mike Bob Tia Jim Chris Sofie Joe 1 3 ∞ ∞ ∞ ∞ 1 2 5 2 ∞ ∞ 1 2 4 2 ∞ ∞ 1 2 3 2 ∞ 6 1 2 3 2 4 4 1 2 3 2 4 4 1 2 3 2 4 4