slides33

slides33
slides33

L3-3.2

Copyright ? Radhika Nagpal, 2002.

Partial Order

Two students are related to each other

if one is shorter and younger than

the other

(s1, a1) R(s2, a2)iff(s1≤s2) ∧(a1≤a2)

–Reflexive

–Antisymmetric

–Transitive

L3-3.3

Copyright ? Radhika Nagpal, 2002.

Partial Order

Transitive:

Prove (s

1

, a

1

) R(s

2

, a

2

)and (s

2

, a

2

) R(s

3

, a

3

)

implies (s

1

, a

1

) R(s

3

, a

3

) :

(s

1

≤s

2

≤s

3

)and (a

1

≤a

2

≤a

3

)

Therefore (s

1

≤s

3

)and (a

1

≤a

3

)

If we line up the students in a chain in order of

If we line up the students in an antichain

order of

Older

L3-3.7Copyright ? Radhika Nagpal, 2002.

Normal Person’s Graph x

y

y = f(x)

L3-3.8

Copyright ? Radhika Nagpal, 2002. Computer Scientist’s Graph

a

f

e

c

d

b

edge (e ,a )

L3-3.9

Copyright ? Radhika Nagpal, 2002.

Definition

A Graph is a set of vertices V and a set E of edges, such that

So E is simply a binary relation

on the set V.

V

V E ×?L3-3.10

Copyright ? Radhika Nagpal, 2002.

Relations and Graphs

A = {a,b,c,d}R = {(a,b) (a,c) (c,b)}

a

c

b

d

Properties of Relations

Reflexive

Transitive

Symmetric

Antisymmetric

NO

Types of Relations

Total Order (<)

1

3

2

4

5

6

Equivalence (mod 3)

16

4

3

5

2Partial Order

(a |b)

1

23

5

46

L3-3.13

Copyright ? Radhika Nagpal, 2002.

A Relation on Buildings

a R

b ::= Building a is “physically

adjacent” to Building b

A B C

A R B,

B R A not A R

C A R A

L3-3.14

Copyright ? Radhika Nagpal, 2002.

MIT Building Connections

R

413

10

12

26

8

L3-3.15

Copyright ? Radhika Nagpal, 2002.

Class Problem 1

R

4

13

10

12

26

8

L3-3.16

Copyright ? Radhika Nagpal, 2002.

MIT Building Connections

413

1012

413

1012

413

1012

R 2= {(a,b) | a,b are

connected by path of length 2}

R 3= {(a,b) | a,b are connected by a path of length 3}

Composition and Path Lengths R k is the set of all pairs (a,b ) such

that a and b are connected by a path of length exactly k.

Composition and Path Lengths

If R is not reflexive

If R is reflexive and transitive

R

R 2

R

R 2

L3-3.19

Copyright ? Radhika Nagpal, 2002.

The Same Questions

Question 1:Can you drive from one state to another with at most 5state-boundary crossings ?

C ×C =R 0∪R 1∪???∪R 5?

Question 2:Can you fly on KLM from Boston to

Paramaribo with at most 3stopovers ?

(BOS, PAR ) ∈R 0∪R 1 ∪???∪R 4 ?

Quiz:Paramaribo is the capital of …?

L3-3.20

Copyright ? Radhika Nagpal, 2002.

Connectivity

Is it possible at all to get from bldg a to b ?Is there a path of some length k from a to b ?

(a, b )∈

? =R n-1

Why n-1?

R is reflexive and …

0k k R ∞

=∪L3-3.21Copyright ? Radhika Nagpal, 2002. Connectivity

…the greatest distance between any pair of nodes is n-1:

If longer than n -1

can remove cycle

L3-3.22

Copyright ? Radhika Nagpal, 2002.

Reflexive Transitive Closure

R *::=

k k R ∞

=∪= R 0 ∪R 1∪R 2 ∪???∪R k ∪???

d

I aka the Connectivity Relation

Boolean Matrix Representation

A = {a,b,c,d}

R = {(a,b) (a,c) (c,b)}

a

c

b

d

a b c d

a 0 11 0

b 0 0 0 0

c 0 1 0 0

d 0 0 0 0

Boolean Matrix Operations

e.g R = A×A –R

(all pairs not in R)

a b c d a 0 1 10b 0 0 0 0c 0 1 0 0d 0 0 0 0

a b c d

a 1 0 01

b 1 1 1 1

c 1 0 1 1

d 1 1 1 1

L3-3.25Copyright ? Radhika Nagpal, 2002.

Composition using Matrices

1a 0 1 1 00 0 0 01 0 0 00 0 0 1

R

2a 3a 4

a 1

b 2b 3b 4b 1

c 2c 3c 4c 1b 2b 3b 4

b 00 0 010 0 000 1 000 0 1

S

=

T ::= R )S

10 1 00 0 0 00 0 0 00 0 0 1

1a 2a 3a 1c 2c 3c 4a 4c T (a 1,c 1) = [R (a 1,b 1)∧S (b 1,c 1)] ∨[R (a 1,b 2)∧S (b 2,c 1)] ∨

[R (a 1,b 3)∧S(b 3,c 1)] ∨[R (a 1,b 4)∧S (b 4,c 1)]

L3-3.26

Copyright ? Radhika Nagpal, 2002. Class Problems

L3-3.27Copyright ? Radhika Nagpal, 2002.

MIT Building Connections

812101326

4

4

13

10

12

26

8

812101326

4C

R

C R

L3-3.28

Copyright ? Radhika Nagpal, 2002.

MIT Building Connections

3

R 2

R 413

10

12

26

8

R

413

10

12

26

8

413

1012

26

8

相关主题
相关文档
最新文档