Ma/CS 6b Class 12: Graphs and Matrices

Similar documents
Ma/CS 6b Class 20: Spectral Graph Theory

Ma/CS 6b Class 20: Spectral Graph Theory

Ma/CS 6a Class 19: Group Isomorphisms

EE263 Review Session 1

Ma/CS 6a Class 28: Latin Squares

Ma/CS 6b Class 25: Error Correcting Codes 2

Ma/CS 6b Class 3: Stable Matchings

21-301, Spring 2019 Homework 4 Solutions

Ma/CS 6a Class 19: Isomorphisms and Subgroups

Multi-coloring and Mycielski s construction

CSE 321 Solutions to Practice Problems

Ma/CS 6b Class 23: Eigenvalues in Regular Graphs

Graphic sequences, adjacency matrix

Ma/CS 6a Class 28: Latin Squares

AUTOMORPHISM GROUPS AND SPECTRA OF CIRCULANT GRAPHS

1.10 Matrix Representation of Graphs

ACO Comprehensive Exam March 17 and 18, Computability, Complexity and Algorithms

CHAPTER 1. Relations. 1. Relations and Their Properties. Discussion

Strong Mathematical Induction

Graph G = (V, E). V ={vertices}, E={edges}. V={a,b,c,d,e,f,g,h,k} E={(a,b),(a,g),( a,h),(a,k),(b,c),(b,k),...,(h,k)}

Graph fundamentals. Matrices associated with a graph

Recitation 8: Graphs and Adjacency Matrices

Ma/CS 6b Class 3: Stable Matchings

On the Dynamic Chromatic Number of Graphs

I. Approaches to bounding the exponent of matrix multiplication

MATH 61-02: PRACTICE PROBLEMS FOR FINAL EXAM

USING GRAPHS AND GAMES TO GENERATE CAP SET BOUNDS

Advanced Combinatorial Optimization September 22, Lecture 4

Course : Algebraic Combinatorics

THE DYNAMICS OF SUCCESSIVE DIFFERENCES OVER Z AND R

The Matrix-Tree Theorem

MODEL ANSWERS TO THE SEVENTH HOMEWORK. (b) We proved in homework six, question 2 (c) that. But we also proved homework six, question 2 (a) that

Section Summary. Relations and Functions Properties of Relations. Combining Relations

Ma/CS 6b Class 15: The Probabilistic Method 2

Spectra of Semidirect Products of Cyclic Groups

Definition: A binary relation R from a set A to a set B is a subset R A B. Example:

(x 1 +x 2 )(x 1 x 2 )+(x 2 +x 3 )(x 2 x 3 )+(x 3 +x 1 )(x 3 x 1 ).

18.312: Algebraic Combinatorics Lionel Levine. Lecture 19

Permutations and Combinations

CS173 Strong Induction and Functions. Tandy Warnow

Matrix Multiplication

SUMS PROBLEM COMPETITION, 2000

Approaches to bounding the exponent of matrix multiplication

Mathematical Structures Combinations and Permutations

MAC Module 2 Systems of Linear Equations and Matrices II. Learning Objectives. Upon completing this module, you should be able to :

SUB-EXPONENTIALLY MANY 3-COLORINGS OF TRIANGLE-FREE PLANAR GRAPHS

The Theory of the Simplex Method. Chapter 5: Hillier and Lieberman Chapter 5: Decision Tools for Agribusiness Dr. Hurley s AGB 328 Course

Algorithms and Data Structures Strassen s Algorithm. ADS (2017/18) Lecture 4 slide 1

1 I A Q E B A I E Q 1 A ; E Q A I A (2) A : (3) A : (4)

Math 775 Homework 1. Austin Mohr. February 9, 2011

Algebraic Methods in Combinatorics

Chapter 5. Divide and Conquer CLRS 4.3. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Spectrally arbitrary star sign patterns

7 Matrix Operations. 7.0 Matrix Multiplication + 3 = 3 = 4

Combinatorial Optimization

Reductions. Example 1

REVIEW QUESTIONS. Chapter 1: Foundations: Sets, Logic, and Algorithms

Complexity of Matrix Multiplication and Bilinear Problems

This section is an introduction to the basic themes of the course.

Computational Complexity

Determinants. Copyright c 2012 Dan Nettleton (Iowa State University) Statistics / 25

7.6 The Inverse of a Square Matrix

Tutorials. Algorithms and Data Structures Strassen s Algorithm. The Master Theorem for solving recurrences. The Master Theorem (cont d)

Ma/CS 6a Class 25: Partitions

An Algorithm to Determine the Clique Number of a Split Graph. In this paper, we propose an algorithm to determine the clique number of a split graph.

* 8 Groups, with Appendix containing Rings and Fields.

Discrete Optimization 23

The Interlace Polynomial of Graphs at 1

Introduction to Graph Theory

Discrete Structures for Computer Science

Edge colored complete bipartite graphs with trivial automorphism groups

22m:033 Notes: 3.1 Introduction to Determinants

Matching Polynomials of Graphs

The Master Theorem for solving recurrences. Algorithms and Data Structures Strassen s Algorithm. Tutorials. The Master Theorem (cont d)

Matrices and Vectors

Trees. A tree is a graph which is. (a) Connected and. (b) has no cycles (acyclic).

F 2k 1 = F 2n. for all positive integers n.

Notes on the Matrix-Tree theorem and Cayley s tree enumerator

4. How to prove a problem is NPC

The Probabilistic Method

Lecture 9: Submatrices and Some Special Matrices

Chapter 2. Ma 322 Fall Ma 322. Sept 23-27

Harvard CS 121 and CSCI E-207 Lecture 6: Regular Languages and Countability

Review 1 Math 321: Linear Algebra Spring 2010

6 Permutations Very little of this section comes from PJE.

Semidefinite and Second Order Cone Programming Seminar Fall 2001 Lecture 5

Reachability and controllability of time-variant discrete-time positive linear systems

Definition 2.3. We define addition and multiplication of matrices as follows.

Linear algebra and applications to graphs Part 1

SUPPLEMENTARY NOTES: CHAPTER 1

Relations. Relations of Sets N-ary Relations Relational Databases Binary Relation Properties Equivalence Relations. Reading (Epp s textbook)

CS100: DISCRETE STRUCTURES. Lecture 3 Matrices Ch 3 Pages:

Relations Graphical View

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2)

arxiv: v1 [math.co] 20 Dec 2016

Sydney University Mathematical Society Problems Competition Solutions.

Combinations and Probabilities

Eigenvectors Via Graph Theory

Powers of Tensors and Fast Matrix Multiplication


Transcription:

Ma/CS 6b Class 2: Graphs and Matrices 3 3 v 5 v 4 v By Adam Sheffer Non-simple Graphs In this class we allow graphs to be nonsimple. We allow parallel edges, but not loops.

Incidence Matrix Consider a graph G = V, E. We order the vertices as V = v,,, v n and the edges as E = e, e 2,, e m The incidence matrix of G is an n m matrix M. The cell M ij contains if v i is an endpoint of e j, and otherwise. v v 5 e 4 v 4 e e 2 e 3 e 5 e 6 Playing with an Incidence Matrix Let M be the incidence matrix of a graph G = V, E, and let B = MM T. What is the value of B ii? The degree of v i in G. What is the value of B ij for i j? The number of edges between v i and v j. M = e v 5 e 4 v 4 v e 2 e 3 e 5 e 6 2

Adjacency Matrix A = Consider a graph G = V, E. We order the vertices as V = v,,, v n. The adjacency matrix of G is a symmetric n n matrix A. The cell A ij contains the number of edges between v i and v j. v 3 3 v 5 v 4 A Connection Problem. Let G = V, E be a graph with incidence matrix M and adjacency matrix A. Express MM T using A. Answer. This is a V V matrix. MM T ii is the degree of v i. MM T ij for i j is number of edges between v i and v j. Let D be a diagonal matrix with D ii being the degree of v i. We have MM T = A + D. 3

Example A = 3 3 D = 2 4 4 v M = MM T = 2 4 3 3 4 = A + D Multiplying by s Let n denote the n n matrix with in each of its cells. Problem. Let G = V, E be a graph with adjacency matrix A. Describe the values in the cells of B = A V. Answer. It is a V V matrix. The column vectors of B are identical. The i th element of each column is the degree of v i. 4

Playing with an Adjacency Matrix Let A be the adjacency matrix of a simple graph G = V, E, and let M = A 2. What is the value of M ii? The degree of v i in G. What is the value of M ij for i j? The number of vertices that are adjacent to both v i and v j. A = v 5 v 4 v What about M 3? Let A be the adjacency matrix of a simple graph G = V, E. For i j: A ij tells us if there is an edge v i, v j E. A 2 ij tells us how many vertices are adjacent to both v i and v j. What is A 3 ij? It is the number of paths of length three between v i and v j. In fact, A 2 ij is the number of paths of length two between v i and v j. 5

The Meaning of M k Theorem. Let A be the adjacency matrix of a (not necessarily simple) graph G = V, E. Then A k is the number of ij (not necessarily simple) paths between v i and v j. An Example a b d c A = A 2 = AA = = 2 2 2 2 2 2 2 2 A 3 = A 2 A = 2 2 2 2 2 2 2 2 = 4 4 4 4 4 4 4 4 6

The Meaning of M k Theorem. Let M be the incidence matrix of a (not necessarily simple) graph G = V, E. Then M k is the number ij of (not necessarily simple) paths between v i and v j. Proof. By induction on k. Induction basis. Easy to see for k = and k = 2. The Induction Step We have A k = A k A. That is V A k ij = Ak im A mj m= By the induction hypothesis, A k is the im number of paths of length k between v i and v m. A mj is the number of edges between v m, v j. 7

The Induction Step (cont.) V A k ij = Ak im A mj m= For a fixed m, A k A im mj is the number of paths from v i to v j of length k with v m as their penultimate vertex. Thus, summing over every m V results in the number of paths from v i to v j of length k. Which Classic English Rock Band is More Sciency? 8

Computing the Number of Paths of Length k Problem. Consider a graph G = V, E, two vertices s, t V, and an integer k >. Describe an algorithm for finding the number of paths of length k between s and t. Let A be the adjacency matrix of G. We need to compute A k, which involves k matrix multiplication. Matrix Multiplication: A Brief History We wish to multiply two n n matrices. Computing one cell requires about n multiplications and additions. So computing an entire matrix takes cn 3 (for some constant c). In 969 Strassen found an improved algorithm with a running time of cn 2.87. In 987, Coppersmith and Winograd obtained an improved cn 2.376. After over 2 years, in 2, Stothers obtained cn 2.374. Williams immediately improved to cn 2.3728642. In 24, Le Gall improved to cn 2.3728639. 9

A More Efficient Algorithm To compute A k, we do not need k matrix multiplications. If k is a power of 2: A 2 = AA, A 4 = A 2 A 2,, A k = A k/2 A k/2. Only log 2 k multiplications! If k is not a power of 2: We again compute A, A 2, A 4,, A k. We can then obtain A k by multiplying a subset of those. For example, A 57 = A 32 A 6 A 8 A. At most 2log k multiplications! Connectivity and Matrices Problem. Let G = V, E be a graph with an adjacency matrix A. Use M = I + A + A 2 + A 3 + + A V to tell whether G is connected. Answer. G is connected iff every cell of A is positive. The main diagonal of A is positive due to I. A cell A ij for i j contains the number of paths between v i and v j of length at most k. If the graph is connected, such paths exist between every two vertices.

And Now with Colors Problem. Consider a graph G = V, E, two vertices s, t V, and an integer k >. Moreover, every edge is colored either red or blue. Describe an algorithm for finding the number of paths of length k between s and t that have an even number of blue edges. Solution We define two sets of matrices: Cell ij of the matrix E m contains the number of paths of length m between v i an v j using an even number of blue edges. Cell ij of the matrix O m contains the number of paths of length m between v i an v j using an odd number of blue edges. What are E and O ()? E is the adjacency matrix of G after removing the blue edges. Similarly for O after removing the red edges.

Solution (cont.) We wish to compute E k. We know how to find E and O. How can we compute E m and O (m) using E m and O (m )? E m = E m E + O (m ) O (). E m E is the number of paths of ij length m between v i and v j with an even number of blue edges and whose last edge is red. Similarly for O m O last edges of the paths is blue. ij except that the Solution (cont.) How can we similarly compute O m using E m and O m? O m = E m O + O (m ) E (). Concluding the solution. We compute about 2k matrices. Each computation involves two matrix multiplications and one addition. 2

Identical Graphs? Are the following two graphs identical? v v Possible answers: No, since in one v has degree 2 and in the other degree. Yes, because they have exactly the same structure. Graph Isomorphism An isomorphism from a graph G = V, E to a graph G = V, E is a bijection f: V V such that for every u, v V, E has the same number of edges between u and v as E has between f u and f v. We say that G and G are isomorphic if there is an isomorphism from G to G. In our example, the graphs are isomorphic (f v = u 2, f = u, f = u 3 ). v u 2 u 3 u 3

Uniqueness? Question. If two graphs are isomorphic, can there be more than one isomorphism from one to the other? Yes! a w, b z, c x, d y. a y, b z, c x, d w. a b w x c d y z Isomorphisms and Adjacency Matrices What can we say about adjacency matrices of isomorphic graphs? c a b d w y z x 4

Answer Two graphs G, G are isomorphic if and only if the adjacency matrix of G is obtained by permuting the rows and columns of the adjacency matrix of G. (The same permutation should apply both to the rows and to the column)., 2 4, 4 3, 3 2: Incidence Matrix of a Directed Graph Consider a directed graph G = V, E. We order the vertices as V = v,,, v n and the edges as E = e, e 2,, e m The incidence matrix of G is an n m matrix M. The cell M ij contains - if e j is entering v i, and if e j is leaving v i. v v 5 e 4 v 4 e e 2 e 3 e 5 e 6 5

The End: Queen Ph.D. in astrophysics Degree in Biology Electronics engineer Freddie Mercury 6