Chapter 4 matrices and closures of relations l.jpg
This presentation is the property of its rightful owner.
Sponsored Links
1 / 37

Chapter 4: Matrices and Closures of Relations PowerPoint PPT Presentation


  • 253 Views
  • Uploaded on
  • Presentation posted in: General

Chapter 4: Matrices and Closures of Relations. Discrete Mathematical Structures: Theory and Applications. Learning Objectives. Learn about matrices and their relationship with relations Become familiar with Boolean matrices

Download Presentation

Chapter 4: Matrices and Closures of Relations

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Chapter 4 matrices and closures of relations l.jpg

Chapter 4:Matrices and Closures of Relations

Discrete Mathematical Structures:

Theory and Applications


Learning objectives l.jpg

Learning Objectives

  • Learn about matrices and their relationship with relations

  • Become familiar with Boolean matrices

  • Learn the relationship between Boolean matrices and different closures of a relation

  • Explore how to find the transitive closure using Warshall’s algorithm

Discrete Mathematical Structures: Theory and Applications


Matrices l.jpg

Matrices

Discrete Mathematical Structures: Theory and Applications


Matrices4 l.jpg

Matrices

Discrete Mathematical Structures: Theory and Applications


Matrices5 l.jpg

Matrices

Discrete Mathematical Structures: Theory and Applications


Matrices6 l.jpg

Matrices

Discrete Mathematical Structures: Theory and Applications


Matrices7 l.jpg

Matrices

Discrete Mathematical Structures: Theory and Applications


Matrices8 l.jpg

Matrices

  • Two matrices are added only if they have the same number of rows and the same number of columns

  • To determine the sum of two matrices, their corresponding elements are added

Discrete Mathematical Structures: Theory and Applications


Matrices9 l.jpg

Matrices

Discrete Mathematical Structures: Theory and Applications


Matrices10 l.jpg

Matrices

Discrete Mathematical Structures: Theory and Applications


Matrices11 l.jpg

Matrices

Discrete Mathematical Structures: Theory and Applications


Matrices12 l.jpg

Matrices

Discrete Mathematical Structures: Theory and Applications


Matrices13 l.jpg

Matrices

  • The multiplication AB of matrices A and B is defined only if the number of rows and columns of A is the same as the number of rows and of B

Discrete Mathematical Structures: Theory and Applications


Matrices14 l.jpg

Matrices

Figure 4.1

  • Let A = [aij]m×nbe an m × n matrix and B = [bjk]n×pbe an n × p matrix. Then AB is defined

  • To determine the (i, k)th element of AB, take the ith row of A and the kth column of B, multiply the corresponding elements, and add the result

  • Multiply corresponding elements as in Figure 4.1

Discrete Mathematical Structures: Theory and Applications


Slide15 l.jpg

Discrete Mathematical Structures: Theory and Applications


Matrices16 l.jpg

Matrices

Discrete Mathematical Structures: Theory and Applications


Slide17 l.jpg

Discrete Mathematical Structures: Theory and Applications


Matrices18 l.jpg

Matrices

  • The rows of A are the columns of ATand the columns of A are the rows of AT

Discrete Mathematical Structures: Theory and Applications


Slide19 l.jpg

Discrete Mathematical Structures: Theory and Applications


Matrices20 l.jpg

Matrices

  • Boolean (Zero-One) Matrices

    • Matrices whose entries are 0 or 1

    • Allows for representation of matrices in a convenient way in computer memory and for design and implement algorithms to determine the transitive closure of a relation

Discrete Mathematical Structures: Theory and Applications


Matrices21 l.jpg

Matrices

  • Boolean (Zero-One) Matrices

    • The set {0, 1} is a lattice under the usual “less than or equal to” relation, where for all a, b ∈ {0, 1}, a ∨ b = max{a, b} and a ∧ b = min{a, b}

Discrete Mathematical Structures: Theory and Applications


Matrices22 l.jpg

Matrices

Discrete Mathematical Structures: Theory and Applications


Matrices23 l.jpg

Matrices

Discrete Mathematical Structures: Theory and Applications


Matrices24 l.jpg

Matrices

Discrete Mathematical Structures: Theory and Applications


Slide25 l.jpg

Discrete Mathematical Structures: Theory and Applications


The matrix of a relation and closure l.jpg

The Matrix of a Relation and Closure

Discrete Mathematical Structures: Theory and Applications


The matrix of a relation and closure27 l.jpg

The Matrix of a Relation and Closure

Discrete Mathematical Structures: Theory and Applications


The matrix of a relation and closure28 l.jpg

The Matrix of a Relation and Closure

Discrete Mathematical Structures: Theory and Applications


The matrix of a relation and closure29 l.jpg

The Matrix of a Relation and Closure

Discrete Mathematical Structures: Theory and Applications


Slide30 l.jpg

Discrete Mathematical Structures: Theory and Applications


Slide31 l.jpg

  • ALGORITHM 4.3: Compute the transitive closure

  • Input: M —Boolean matrices of the relation R n—positive integers such that n × n specifies the size of M

  • Output: T —an n × n Boolean matrix such that T is the transitive closure of M

    • 1. procedure transitiveClosure(M,T,n)

    • 2. begin

    • 3. A := M;

    • 4. T := M;

    • 5. for i := 2 to n do

    • 6. begin

    • 7. A := //A = Mi

    • 8. T := T ∨ A; //T= M ∨ M2∨ · · · ∨ Mi

    • 9. end

    • 10. end

Discrete Mathematical Structures: Theory and Applications


Warshall s algorithm for determining the transitive closure l.jpg

Warshall’s Algorithm for Determining the Transitive Closure

  • Previously,the transitive closure of a relation R was foundby computing the matrices and then taking the Boolean join

    • This method is expensive in terms of computer time

  • Warshall’s algorithm: an efficient algorithm to determine the transitive closure

Discrete Mathematical Structures: Theory and Applications


Warshall s algorithm for determining the transitive closure33 l.jpg

Warshall’s Algorithm for Determining the Transitive Closure

  • Let A = {a1, a2, . . . , an} be a finite set, n ≥ 1, and let R be a relation on A.

  • Warshall’s algorithm determines the transitive closure by constructing a sequence of n Boolean matrices

Discrete Mathematical Structures: Theory and Applications


Warshall s algorithm for determining the transitive closure34 l.jpg

Warshall’s Algorithm for Determining the Transitive Closure

Discrete Mathematical Structures: Theory and Applications


Warshall s algorithm for determining the transitive closure35 l.jpg

Warshall’s Algorithm for Determining the Transitive Closure

Discrete Mathematical Structures: Theory and Applications


Warshall s algorithm for determining the transitive closure36 l.jpg

Warshall’s Algorithm for Determining the Transitive Closure

Discrete Mathematical Structures: Theory and Applications


Warshall s algorithm for determining the transitive closure37 l.jpg

Warshall’s Algorithm for Determining the Transitive Closure

  • ALGORITHM 4.4: Warshall’s Algorithm

  • Input: M —Boolean matrices of the relation R

  • n—positive integers such that n × n specifies the size of M

  • Output: W —an n × n Boolean matrix such thatW is the transitive closure of M

    • 1. procedure WarshallAlgorithm(M,W,n)

    • 2. begin

    • 3. W := M;

    • 4. for k := 1 to n do

    • 5. for i := 1 to n do

    • 6. for j := 1 to n do

    • 7. if W[i,j] = 1 then

    • 8. if W[i,k] = 1 and W[k,j] = 1 then

    • 9. W[i,j] := 1;

    • 10. end

Discrete Mathematical Structures: Theory and Applications


  • Login