Graph fundamentals Matrices associated with a graph Drawing a picture of a graph is one way to represent it. Another type of representation is via a matrix. Let G be a graph with V (G) = {v1, v2, . . . , vn} and E(G) = {e1, e2, . . . , em}. Definition The adjacency matrix A = [aij ] of G is the n ⇥ n matrix such that ( 1 if vi ⇠ vj , aij = 0 otherwise. The incidence matrix M = [mij ] of G is the n ⇥ m matrix such that ( 1 if vi 2 ej , mij = 0 otherwise. The matrix L = D A is called the Laplacian matrix of G, where D is the n ⇥ n diagonal matrix of vertex degrees. Most graphs have many more edges than vertices, so the adjacency matrix is generally much smaller than its incidence matrix and thus requires less storage space on a computer. Simple graphs are also stored in computers in a sometimes more compact representation known as an adjacency list. (For each vertex v, we have a list of its neighbors.) Problem Write down an adjacency matrix for Ka,b that has rectangular blocks whose entries are all equal. Math 104 - Prof. Kindred - Lecture 2 Page 1 Remarks • The matrices depend on the ordering of vertices. • The sum of each row in A or M is the degree of the corresponding vertex. • A is a real, symmetric matrix, and so it has real eigenvalues and a set of orthonormal eigenvectors. • L is a positive semidefinite matrix, so it has real, nonnegative eigenvalues and a set of orthonormal eigenvectors. • Depending on the situation, the eigenvalues of the graph G can refer either to the eigenvalues of A or the eigenvalues of L. Spectral graph theory is the study of the connections between the structure of a graph and the characteristic polynomial, eigenvalues and eigenvectors of the graph. Vertex degrees and counting The first theorem in almost any graph theory course.... Theorem (degree-sum formula or the handshaking lemma). If G = (V, E) is a graph, then X d(v) = 2|E|. v2V Proof. Sum the entries of the incidence matrix M of G in two ways. • By rows: each row of M corresponds to a vertex and the sum of the entries of a row is d(v), so X total sum = d(v). v2V Math 104 - Prof. Kindred - Lecture 2 Page 2 • By columns: each column of M corresponds to an edge and the sum of the entries of a column is 2, so X total sum = 2 = 2|E|. e2E Thus, P v2V d(v) = 2|E|. ⌅ Summing entries of the incidence matrix gives us a relationship between vertex degrees and edges. Looking at powers of the adjacency matrix gives us information about...the number of walks in a graph between a given pair of vertices. Definition A walk W in graph G = (V, E) is a sequence of vtcs. v0, v1, . . . , vk such that vi 1vi 2 E for all 1 i k. The length of W is k, the # of edges in W . Theorem. Let G = (V, E) be a graph with V = {v1, . . . , vn}. For any nonnegative integer k, [ Ak ]ij = # of walks from vi to vj in G of length k where 1 i, j n. Proof. Proof by induction on k. Base case (k = 0): We have ( [ A0 ]ij = [ I ]ij = 1 if i = j 0 otherwise = # of walks from vi to vj of length 0. Math 104 - Prof. Kindred - Lecture 2 Page 3 Induction hypothesis: Assume result is true for nonnegative integer k. Consider the k + 1 case. Partition the walks of length k + 1 from vi to vj by the next to last vertex in the walk, which we label v`. Thus, # of walks from vi to vj of length k + 1 X = # of walks from vi to v` of length k v` :v` ⇠vj X = [ Ak ]i` v` :v` ⇠vj = = X v` :v` ⇠vj n X k [ A ]il · 1 + by induction hypothesis X v` :v` 6⇠vj [ Ak ]il · 0 [ Ak ]il [ A ]lj = [ Ak+1 ]ij . `=1 Therefore, by induction, the result holds. ⌅ Walks, paths, and cycles Recall our def’n of a walk. We expand on this def’n now. Definitions A walk W in graph G = (V, E) is a sequence of vtcs. v0, v1, . . . , vk such that vi 1vi 2 E for all 1 i k. • W is closed if v0 = vk . • W is a path if all vtcs. are distinct. • W is a trail if all edges are distinct. • W is a cycle if it is closed, k first/last one (i.e., v0, . . . , vk Math 104 - Prof. Kindred - Lecture 2 1 3, and the only repeated vertex is the is a path). Page 4 Notation A u, v-walk is a walk that begins at vertex u and ends at v. Question Does concatenation of a u, v-path and a v, w-path yield a u, w-path? Not necessarily. Lemma. Let G = (V, E) be a graph. Let u, v 2 V . Then any u, vwalk contains a u, v-path. How can we prove this? • Remove portion between repeated vertices over and over again, until no repeated vertices remain. Can be formulated into a proof by induction on length of a u, v-walk. Most crisp way is via proof by extremality. So we consider a shortest u, v-walk. Proof. Consider a u, v-walk in G. Let W be a shortest u, v-walk contained in this walk, say u = v0, v1, . . . , vk = v. (We know there are u, v-walks by hypothesis, so there must be a shortest such walk by the Well-Ordering Principle.1) We claim that W is a path. BWOC, suppose that W contains a repeated vertex. So there exists i < j such that vi = vj , but then v0, v1, . . . , vi, vj+1, . . . , vk is a shorter u, v-walk than W . )( Thus, W is a path between u and v. vi+1 v0 1 Every nonempty set of N has a least element. Math 104 - Prof. Kindred - Lecture 2 vj vi = vj 1 vj+1 vk ⌅ Page 5 Definitions Let u, v 2 V (G). We say u is connected to v if 9 a u, vpath. A graph G is connected if 8 u, v 2 V (G), u is connected to v. The maximal connected subgraphs of G are the components of G. Example components of G: 2 1 6 3 5 7 8 4 G[{1, 2, 3, 4}] G[{5, 6, 7}] G[{8}] trivial component Remarks • The is-connected-to relation is an equivalence relation on V (G). • The equivalence classes of this relation are the vertex sets of components of G. Definitions A vertex v is a cut vertex if G v has more components than G. An edge e is a cut edge if G e has more components than G. Example Using graph from previous example, vertex 6 is a cut vertex and edges {5, 6} and {6, 7} are cut edges. For a cut edge e, G e always has exactly one more component than G. How can we characterize the cut edges of a graph? Theorem. An edge is a cut edge if and only if it belongs to no cycle. Proof sketch. Let H be component of G that contains edge e. • Equivalent statements of theorem: H e is disconnected if and only if e is not in a cycle of H, which is also equivalent to H e is connected if and only if e is in a cycle of H. Math 104 - Prof. Kindred - Lecture 2 Page 6 • ()) Exhibit a cycle containing e = xy using an x, y-path from H e. • (() Let C be a cycle in H containing e. Between any two vtcs u, v in H e, we need to find a u, v-walk. Consider a u, v-path P in H. If e is not in P , then P exists in H e. Otherwise, concatenate 1. path from u to one endpoint of e, 2. path around C from one endpoint of e to the other endpoint (namely C e), 3. and path from other endpoint of e to v. ⌅ Math 104 - Prof. Kindred - Lecture 2 Page 7 Matrices associated with a graph 2 v11 More graph fundamentals e1 Math 104, Graph Theory Thursday, January 24, 2013 v22 e2 v3 Laplacian eigenvalues e5 e6 e7 e8 e3 3 5v5 e4 v4 4 0 61 6 A=6 61 41 1 2 1 61 6 M =6 60 40 0 0 1 1 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 1 1 0 0 0 1 1 3 1 17 7 17 7 15 0 0 1 1 0 1 1 0 0 0 1 0 1 0 0 1 Walks and powers of adjacency matrix 2 6 6 L=6 6 4 2 1 1 0 0 1 2 1 0 0 1 1 2 0 0 0 0 0 1 1 3 0 07 7 07 7 15 1 eigenvalues are 0, 0, 2, 3, 3 2 0 61 6 A=6 60 40 0 v1 v2 v3 v5 v4 2 1 60 6 A2 = 6 61 40 1 1 0 1 0 1 0 1 0 1 0 0 0 1 0 1 3 0 17 7 07 7 15 0 0 3 0 2 0 1 0 2 0 2 0 2 0 2 0 3 1 07 7 27 7 05 2 0 1 0 1 0 3 0 07 7 17 7 05 1