Graphs, relations and matrices

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

Rules of Matrix Arithmetic
Chapter Matrices Matrix Arithmetic
8.3 Representing Relations Connection Matrices Let R be a relation from A = {a 1, a 2,..., a m } to B = {b 1, b 2,..., b n }. Definition: A n m  n connection.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 – CHAPTER 4 GRAPHS 1.
Graph-02.
13 May 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Introduction.
1 Slides based on those of Kenneth H. Rosen Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus Graphs.
Lecture 17 Path Algebra Matrix multiplication of adjacency matrices of directed graphs give important information about the graphs. Manipulating these.
Representing Relations Using Matrices
Representing Graphs Wade Trappe. Lecture Overview Introduction Some Terminology –Paths Adjacency Matrix.
Linear Equations in Linear Algebra
Applied Discrete Mathematics Week 12: Trees
9.3 Representing Graphs and Graph Isomorphism
MATRICES. Matrices A matrix is a rectangular array of objects (usually numbers) arranged in m horizontal rows and n vertical columns. A matrix with m.
5  Systems of Linear Equations: ✦ An Introduction ✦ Unique Solutions ✦ Underdetermined and Overdetermined Systems  Matrices  Multiplication of Matrices.
Applied Discrete Mathematics Week 10: Equivalence Relations
Systems and Matrices (Chapter5)
7 Graph 7.1 Even and Odd Degrees.
2 2.1 © 2016 Pearson Education, Inc. Matrix Algebra MATRIX OPERATIONS.
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Week 11 - Wednesday.  What did we talk about last time?  Graphs  Euler paths and tours.
1 1.3 © 2012 Pearson Education, Inc. Linear Equations in Linear Algebra VECTOR EQUATIONS.
Chapter 9. Section 9.1 Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and.
Based on slides by Y. Peng University of Maryland
Module #19: Graph Theory: part II Rosen 5 th ed., chs. 8-9.
Week 11 - Monday.  What did we talk about last time?  Binomial theorem and Pascal's triangle  Conditional probability  Bayes’ theorem.
Slide Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Relations and their Properties
1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b.
Vocabulary and Representations of Graphs. NC Standard Course of Study Competency Goal 1: The learner will use matrices and graphs to model relationships.
2 2.1 © 2012 Pearson Education, Inc. Matrix Algebra MATRIX OPERATIONS.
Matrices Section 2.6. Section Summary Definition of a Matrix Matrix Arithmetic Transposes and Powers of Arithmetic Zero-One matrices.
Relation. Combining Relations Because relations from A to B are subsets of A x B, two relations from A to B can be combined in any way two sets can be.
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
4. Relations and Digraphs Binary Relation Geometric and Algebraic Representation Method Properties Equivalence Relations Operations.
MAT 2720 Discrete Mathematics Section 8.2 Paths and Cycles
Basic properties Continuation
Relations Section 9.1, 9.3—9.5 of Rosen Spring 2012
Graphs Basic properties.
RelationsCSCE 235, Spring Introduction A relation between elements of two sets is a subset of their Cartesian products (set of all ordered pairs.
Chapter 9: Graphs.
Relations and Functions ORDERED PAIRS AND CARTESIAN PRODUCT An ordered pair consists of two elements, say a and b, in which one of them, say a is designated.
Great Theoretical Ideas in Computer Science for Some.
Section 7.3: Representing Relations In this section, we will cover two ways to represent a relation over a finite set other than simply listing the relation.
COMPSCI 102 Introduction to Discrete Mathematics.
The Matrix Equation A x = b (9/16/05) Definition. If A is an m  n matrix with columns a 1, a 2,…, a n and x is a vector in R n, then the product of A.
Week 11 - Wednesday.  What did we talk about last time?  Graphs  Paths and circuits.
Section 2.4. Section Summary  Sequences. o Examples: Geometric Progression, Arithmetic Progression  Recurrence Relations o Example: Fibonacci Sequence.
1 Lecture 5 (part 2) Graphs II (a) Circuits; (b) Representation Reading: Epp Chp 11.2, 11.3
رياضيات متقطعة لعلوم الحاسب MATH 226. Chapter 10.
A very brief introduction to Matrix (Section 2.7) Definitions Some properties Basic matrix operations Zero-One (Boolean) matrices.
2.1 Matrix Operations 2. Matrix Algebra. j -th column i -th row Diagonal entries Diagonal matrix : a square matrix whose nondiagonal entries are zero.
Chapter8 Relations 8.1: Relations and their properties.
Discrete Mathematical
Relations.
Sections 2.4 and 2.5 Matrix Operations
Matrix Algebra MATRIX OPERATIONS © 2012 Pearson Education, Inc.
Matrix Representation of Graphs
Matrix Algebra MATRIX OPERATIONS © 2012 Pearson Education, Inc.
Matrix Representation of Graph
Mathematical Structures for Computer Science Chapter 6
Section 7.4 Matrix Algebra.
Connectivity Section 10.4.
Objectives Multiply two matrices.
Discrete Mathematics Lecture 6: Set and Function
Representing Graphs Wade Trappe.
Discrete Mathematics for Computer Science
Applied Discrete Mathematics Week 13: Graphs
Matrix Algebra MATRIX OPERATIONS © 2012 Pearson Education, Inc.
Presentation transcript:

Graphs, relations and matrices Section 7.4

Overview Graph structures are valuable because they can represent relationships among pairs of objects, and they remain simple in structure even when the number of objects is large. In application problems, it becomes important to use a computer to analyze graph properties, so we need a representation of a graph that a computer can understand.

One representation for a graph

Example

Practice Problem 1 Write the adjacency matrices of each of the following graphs. Make clear which vertex corresponds to which row/column. In each graph, what is the value of M12? Of M34? Of M21?

Directed Graphs Note that all of our examples involve “symmetric” matrices because the number in Mab and Mba must be the same for any graph. However, in some applications, this is not the case.

Directed Graphs A directed graph, like a graph, consists of a set V of vertices and a set E of edges. Each edge is associated with an ordered pair of vertices called its endpoints. In other words, a directed graph is the same as a graph, but the edges are described as ordered pairs rather than unordered pairs. If the endpoints for edge e are a and b in that order, we say e is an edge from a to b, and in the diagram we draw the edge as a straight or curved arrow from a to b. For a directed graph, we use (a, b) rather than [a, b] to indicate an edge from a to b. This emphasizes that the edge is an ordered pair, by using the usual notation for ordered pairs.

More definitions and terms A walk in a directed graph is a sequence v1e1v2e2 . . . vnenvn+1 of alternating vertices and edges that begins and ends with a vertex, and where each edge in the list lies between its endpoints in the proper order. If there is no chance of confusion, we omit the edges when we describe a walk. The adjacency matrix for a directed graph with vertices {v1, v2, . . . , vn} is the n × n matrix where Mij (the entry in row i , column j) is the number of edges from vertex vi to vertex vj.

Example Consider a two-player game where there is a single pile of 10 stones and each player may remove one or two stones at a time on his or her turn. If we use a node for each state of the game and an edge to denote a move, we get the directed graph below:

Questions Why is it important to use a directed graph in modeling this game? Find the adjacency matrix for this directed graph.

Matrix arithmetic Matrices can be multiplied and added using some standard mathematical rules. The surprising thing is that these standard operations, when applied to the adjacency matrix of a graph, have a real interpretation in terms of the graph properties we already know.

What does M2 represent? Given the adjacency matrix M for a directed graph G, the arithmetic operation M × M has an interpretation in G. Let’s see if we can figure out what it is in this example.

Matrix multiplication To compute the (2,3)-entry in M2, we multiply Row 2 of M times Column 3 of M as follows:

Matrix multiplication If we complete the multiplication (every row times every column), we get the result at the right. What do these numbers mean in terms of the original graph?

Interpretation of Mk Theorem. Let M be the adjacency matrix of a directed graph G with vertex set {1, 2, 3, . . . , n}. The row i, column j entry of Mk counts the number of k-step walks from node i to node j in the graph G.

Interpretation of the sum M + M2 + … + Mk We find the sum of two matrices by adding entries in the same position. This gives us the following extension of our theorem. Corollary. Let M be the adjacency matrix of a directed graph G with vertex set {1, 2, 3, . . . , n}. The row i, column j entry of M + M2 + … + Mk counts the number of walks from node i to node j in the graph G of length k or less.

Example

Connection to Relations Note that a directed graph looks exactly the same as a one-set arrow diagram for a relation R on a set A. This is no coincidence!!

Binary Relations, Directed Graphs, and Adjacency Matrices For a relation R on the set A = {1, 2, 3, . . . , n}, the following statements are equivalent for all a, b  A: (a, b)  R (which we write sometimes as aRb). There is a directed edge from node a to node b in the graph of R. There is a 1 in the row a, column b entry of the adjacency matrix for R.

Examples

Solutions

Boolean Operations and Composition of Relations We can find a connection between matrix arithmetic and composition of relations as long as we use “Boolean arithmetic” in our computations:

Boolean matrix multiplication In this example, we multiply A × A in the same way as before, except we use the Boolean addition and multiplication among the entries. To distinguish this from A2, we denote this A(2). Try it before checking the next slide for the answer!

Boolean matrix multiplication Take a moment to find the composition R ◦ R, and write the adjacency matrix for this new relation. Compare to A(2)!

Composition and Boolean matrix multiplication Theorem. If R is a binary relation on a set A with adjacency matrix M, then the matrix M(2) is the adjacency matrix for the relation R ◦ R on the set A.