q11-relationapp

# q11-relationapp - this digraph ±atherOf= John Mary John...

This preview shows pages 1–2. Sign up to view the full content.

CSE 260 QUIZ-11– Relations Applications- ANSWERS (20 minutes) NAME: 1. Compute the transitive closure of the Relation= { (1 , 2) , (1 , 3) , (2 , 3) , (3 , 4) , (3 , 2) } de- Fned over the set { 1 , 2 , 3 , 4 } using the algorithm given below. Procedure transitiveclosure ( M R : zero-one nxn matrix) A := M R B := A for i:=2 to n begin A := A ¯ M R B := B A end { B is the zero-one matrix for R * } \$A1=B1=MR= 0 1 1 0 i=2, A2=A1 O MR= 0 0 1 1 B2=B1 V A2= 0 1 1 1 0 0 1 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 i=3, A3=A2 O MR= 0 1 1 0 B3=B2 V A3= 0 1 1 1 0 0 1 0 0 1 1 0 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 B3=B2, therefore, B4=B3. 2. Compute the transitive closure for the relation ±atherOf, given below, deFned over the set persons= { John, Mary, steve, Justin, Ned, Sam, Linda } : You draw the digraph for the relation Frst and then Fnd the transitive closure from

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: this digraph. ±atherOf= { John, Mary ) , ( John, steve ) , ( steve, Ned ) , ( Ned, Sam ) , ( Sam, Linda ) } What is the real world meaning of this transitive relation. SEE NEXT PAGE John Mary Steve Justin Ned Sam Linda TRANSITIVE CLOSURE: All pairs of nodes which are up to 6 (i.e., 7-1) hops away from each other because there are 7 nodes. { ( John, Mary ) , ( John, steve ) , ( steve, Ned ) , ( Ned, Sam ) , ( Sam, Linda ) , ( John, Ned ) , ( Steve, Sam ) , ( Ned, Linda ) , ( John, Sam ) , ( Steve, Linda ) , ( John, Linda ) } Real world meaning of the relation created by this transitive closure: AncestorOf...
View Full Document

{[ snackBarMessage ]}

### Page1 / 2

q11-relationapp - this digraph ±atherOf= John Mary John...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online