Bayesian Networks, Winter 2009-2010 Yoav Haimovitch & Ariel Raviv 1 Chordal Graph Warm up Theorem 7 Perfect Vertex Elimination Scheme Maximal cliques Tree Bibliography • M.C.Golumbic Algorithmic Graph Theory and Perfect Graphs. Second edition • Pearl, J. Probabilistic Reasoning in Intelligent Systems. 2 Definition: Undirected graph G is chordal if every cycle of length greater than 3 has a chord. Remark: Chordality is a hereditary property, All induced subgraphs of a chordal graph are chordal! Chordal graphs are also called triangulated and perfect elimination graphs. 3 4 A vertex x of G is called simplicial if its adjacency set Adj(x) is a clique (not necessarily maximal) Lemma 1[Dirac 1961]: Each chordal graph has a simplicial vertex and if G is not a clique it has two non adjacent simplicial vertices. 5 If G is a clique, done. If not, assume that be has two non-adjacent nodes a and b and that the lemma is true to all graphs with fewer vertices than G. Let S be a minimal vertex separator for a and b. Let Ga and Gb be the connected components of a and b respectively. 6 S is a clique – if not, then there exists x and y such that there is no edge between them, and because S is minimal vertex separator there is a cycle <a,…,x,…,b,…,y,…,a>. It is easy to show that there exist a minimal cycle with length no less then 4 with no chords in it, contradiction. 7 S is a clique. GA+S is smaller than G therefore by induction the lemma holds, i.e. GA+S is a clique or has two non adjacent simplicial vertices, one of each must be in GA. Any simplicial vertex in GA is a simplicial vertex in G because all elements of Adj(A) are inside GA+S. Thus from GA and GB we get two simplicial vertices in G. 8 Definition: The following are equivalent: 1. G is chordal 2. The edges of G can be directed acyclically so that every pair of converging arrows comes from two adjacent vertices. 3. G has a perfect vertex elimination scheme. 4. There is a tree T with maximal cliques of G as vertices. Any two cliques containing v are either adjacent in T or connected by a path of cliques that contain v. 9 By lemma 1 every chordal graph has a simplicial vertex Direct all of its edges to it Repeat the process with the rest of the graph (can be done because being chordal is hereditary) From the definition of simplicial vertex corollary that each two converging edges coming from adjacent vertices. 10 Let there be a cycle of size larger than 3. There exist a valid direction which is acyclic There are two converging edges, which come from two adjacent vertices The cycle has a chord. 11 Given a Markov network, we would like to calculate a probability function over it’s variables What if we want to calculate the probability of one variable? 12 P(X1,X2,X3,X4,X5)=K∙f1(X1,X2)f2(X2,X3)f3(X3,X4)f4(X4,X5)f5(X5,X1) P(X1,X2,X3,X4)=ΣX5K∙f1(X1,X2)f2(X2,X3)f3(X3,X4)f4(X4,X5)f5(X5,X1)= =K∙f1(X1,X2)f2(X2,X3)f3(X3,X4) ΣX5f4(X4,X5)f5(X5,X1) = K`∙f1(X1,X2)f2(X2,X3)f3(X3,X4) F(X4, X1) Explanation: Each time we sum over a variable we automatically add edges between all it’s adjacent vertices (creating a clique) 13 Here is an example of how bad (i.e. big cliques) things can happen with incorrect order of summing P(X1,X2,X3,X4,X5)=ΣX0K∙f1(X0,X1)f2(X0,X2)f3(X0,X3)f4(X0,X4)f5(X0,X5) = K`∙F(X1,X2,X3,X4,X5) Explanation: For wrong order of summing we get big cliques and thus huge tables of probabilities to store, which are exponential in number of variables. 14 Let G=(V,E) be an undirected graph and let σ=[v1,v2,…,vn] be an ordering of the vertices. We say that σ is a perfect vertex elimination scheme if for each i: Xi = { vj in Adj(vi) | j>I } is complete. 15 Definition: The following are equivalent: 1. G is chordal 2. The edges of G can be directed acyclically so that every pair of converging arrows comes from two adjacent vertices. 3. G has a perfect vertex elimination scheme. 4. There is a tree T with maximal cliques of G as vertices. Any two cliques containing v are either adjacent in T or connected by a path of cliques that contain v. 16 By lemma 1, G has a simplicial vertex. The subgraph induced after removing this vertex is also chordal. By induction, there is an elimination order. 17 Let us assume a cycle of length 4 or greater. Let x be the first vertex on the elimination scheme of this cycle. x is simplicial at this point. Two vertices adjacent to x from the cycle are also adjacent between themselves. 18 3. All vertices of G can be deleted by arranging them in separate piles, one for each clique, and then repeatedly applying the following two operations: Delete a vertex that occurs in only one pile. Delete a pile if all its vertices appear in another pile. 19 A B C D B A C C B D D E E 20 A B A C B A C D B D C D D E E 21 Definition: The following are equivalent: 1. G is chordal 2. The edges of G can be directed acyclically so that every pair of converging arrows comes from two adjacent vertices. 3. G has a perfect vertex elimination scheme. 4. There is a tree T with maximal cliques of G as vertices. Any two cliques containing v are either adjacent in T or connected by a path of cliques that contain v. 22 a a b C1 b C1 c c C2 C2 b C3 e d c d C3 b e d 23 C1 a a C1 b C2 C2 C4 c C3 d b C4 a b c d c d C3 24 Lemma 2: A vertex is simplicial iff it belongs to exactly one clique. Let G =(V,E) be a chordal graph and |V|=k Proof by induction: Assume the claim holds for all graphs of size < k. By Lemma 1 G has a simplicial vertex v. By Lemma 2 v belongs to exactly one clique C. 25 For G’ =(V\{v},E’) there exists a tree T’ which satisfies the claim. Split into two cases: ◦ C’ = C – {v} is maximal in G’. Add v to C’ to build T from T’. T is a Clique-Tree as needed. a C1 b C1 a c b e C2 C2 b c e d d 26 ◦ C’ = C – {v} is not maximal in G’. There is a maximal clique P in G’ such that C’⊂P. Add C and (C, P) to T’ to build T. T is a CliqueTree as needed. a c C2 C1 b d C1 a c C2 a d b d 27 Let T be a Clique-Tree of graph G=(V,E) and |V|=k. Proof by induction: Assume the claim holds for all graphs of size < k. Let L be a leaf in T, and P its parent in T. Let v∈L\P (exists from maximality). v cannot be in any other clique. by Lemma 2, v is simplicial. 28 Let T’ be T with v removed. T’ is a CliqueTree. By assumption G’ =(V\{v},E’) is chordal. By part 3 of Theorem 7, there exists σ’, a Perfect Elimination Order for G’. Let σ = [v, σ’] be a perfect elimination order for G. By the converse of part 3, we can conclude that G is chordal 29