12.3 Directed Graphs

Post on 10-Jan-2016

29 views 2 download

description

12.3 Directed Graphs. A finite graph is a set of points, called nodes , connected by a set of lines, called edges . We can represent the graph in an adjacency matrix . If the nodes are connected, you place a 1 in the matrix. Ex:. TO: n 1 n 2 n 3 n 4. n 2. n 1. n 3. FROM:. n 4. - PowerPoint PPT Presentation

Transcript of 12.3 Directed Graphs

12.3 Directed Graphs

A finite graph is a set of points, called nodes, connected by a set of lines, called edges.We can represent the graph in an adjacency matrix. If the nodes are connected, you place a 1 in the matrix.Ex:

1

2

3

4

0 1 1 0

1 0 1 1

1 1 0 0

0 1 0 0

n

n

n

n

TO:n1 n2 n3 n4

FROM:

A finite graph may need to include info about direction.We get a directed graph.*Flights work this way.

n1

n2

n3

n4

From Long Beach to Orlando on Jet Blue

Ex 1) Create the adjacency matrix.

Chicago New York

St. Louis

C 0 1 1

N 1 0 0

S 1 1 0

TO:C N S

FROM:

What options do you have if you are making 2 flights?You would have the same matrix, but there would be two of them.

0 1 1 0 1 1 2 1 0

1 0 0 1 0 0 0 1 1

1 1 0 1 1 0 1 1 1

2nd x–1 is MATRIX EDIT choose 1: [A]enter dimensions 3 × 3Now enter each element. When done, go 2nd MODE to QUIT

Calculate [A]2 MATRIX NAMES 1: [A]

matches! 2

2 1 0

0 1 1

1 1 1

A

If we continued this, it would be a lot of multiplying.We can use our graphing calculators to speed things up!

Ex 2) Suppose the nodes in the diagram represent people and the directed edges mean the first person knows the second person’s phone number.a) Interpret the diagram in a matrix.

Al

Betty

Fred

Charles

David

Ellen

A 0 0 0 0 1 0

B 1 0 1 0 0 0

C 0 0 0 1 1 0

D 0 0 0 0 1 1

E 1 1 0 0 0 0

F 1 1 0 0 0 0

2nd person:A B C D E F

1st person:

Ex 2) cont…b) In how many ways can a message get from Betty to Ellen in 3 or

fewer calls? (*Use your calculator!)

2

3

A 0 0 0 0 1 0 A 1 1 0 0 0 0

B 1 0 1 0 0 0 B 0 0 0 1 2 0

C 0 0 0 1 1 0 C 1 1 0 0 1 1

D 0 0 0 0 1 1 D 2 2 0 0 0 0

E 1 1 0 0 0 0 E 1 0 1 0 1 0

F 1 1 0 0 0 0 F 1 0 1 0 1 0

A 1 0 1 0 1 0

B 2 2 0 0 1 1

C 3 2 1 0 1 0

D 2 0 2 0 2 0

E 1 1 0 1 2 0

F 1 1 0 1 2 0

B B

B

A B C D E F A B C D E F

A B C D E FNo ways 2 ways

1 way

so 3 different ways

Ex 2) cont…c) Is it possible to get a message from Fred to Charles? If yes, what is the minimum number of calls?

2

A 0 0 0 0 1 0 A 1 1 0 0 0 0

B 1 0 1 0 0 0 B 0 0 0 1 2 0

C 0 0 0 1 1 0 C 1 1 0 0 1 1

D 0 0 0 0 1 1 D 2 2 0 0 0 0

E 1 1 0 0 0 0 E 1 0 1 0 1 0

F 1 1 0 0 0 0 F 1 0 1 0 1 0

B B

A B C D E F A B C D E F

1 callNo way

2 calls1 way

Yes, 2 calls minimum

Homework

#1203 Pg 616 #1–5, 7, 9, 11, 15, 17–20, 22–32