31-AdjMatrices

31-AdjMatrices - Discussion #31 Adjacency Matrices...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Discussion #31 Chapter 7, Section 4 1/12 Discussion #31 Adjacency Matrices
Background image of page 1

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

View Full DocumentRight Arrow Icon
Discussion #31 Chapter 7, Section 4 2/12 Topics Adjacency matrix for a directed graph Reachability Algorithmic Complexity and Correctness Big Oh Proofs of correctness for algorithms Loop invariants Induction
Background image of page 2
Discussion #31 Chapter 7, Section 4 3/12 Adjacency Matrix Definition: Let G = ( V , E ) be a simple digraph. Let V = { v 1 , v 2 ,… v n } be the vertices (nodes). Order the vertices from v 1 to v n . The n × n matrix A whose elements are given by a ij = 1, if ( v i , v j ) E 0, otherwise is the adjacency matrix of the graph G . Example: { 1 2 3 4 1 0 1 0 v 4 1 0 0 0 v 3 1 1 0 0 v 2 0 0 1 0 v 1 v 4 v 3 v 2 v 1 A =
Background image of page 3

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

View Full DocumentRight Arrow Icon
Discussion #31 Chapter 7, Section 4 4/12 Powers of adjacency matrices: A 2 , A 3 , … Can compute powers Using ordinary arithmetic: Using Boolean arithmetic: a ij = k =1 n a ik a kj Powers of Adjacency Matrices a ij = k =1 n a ik a kj
Background image of page 4
Discussion #31 Chapter 7, Section 4 5/12 1 2 3 4 Powers Using Ordinary Arithmetic 1 0 1 0 4 1 0 0 0 3 1 1 0 0 2 0 0 1 0 1 4 3 2 1 A = 2 1 1 0 4 1 0 1 0 3 2 0 1 0 2 1 1 0 0 1 4 3 2 1 A 2 = 4 1 2 0 4 2 1 1 0 3 3 1 2 0 2 2 0 1 0 1 4 3 2 1 A 3 = <2,3,4> <2,4,4> <4,2,4> <4,4,4> <1,2,3,4> <1,2,4,4> <2,4,2,4> <2,4,4,4> <2,3,4,4> <3,4,2,4> <3,4,4,4> <4,2,3,4> <4,2,4,4> <4,4,2,4> <4,4,4,4> <1,2,4> <3,4,4>
Background image of page 5

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

View Full DocumentRight Arrow Icon
Discussion #31 Chapter 7, Section 4 6/12 Powers Using Ordinary Arithmetic (continued…) The element in the i th row and the j th column of A n is equal to the number of paths of length n from the i th node to the j th node.
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/02/2012 for the course C S 236 taught by Professor Michaelgoodrich during the Winter '12 term at BYU.

Page1 / 12

31-AdjMatrices - Discussion #31 Adjacency Matrices...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online