5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014

Schedule

5th Lecture : Modular decomposition Introduction MPRI 2013–2014 Graph searches

Michel Habib Applications of LBFS on structured graph classes [email protected] http://www.liafa.univ-Paris-Diderot.fr/~habib Chordal graphs

Cograph recognition Sophie Germain, 22 octobre 2013 A nice conjecture

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Introduction

A hierarchy of graph models 1. Undirected graphs (graphes non orient´es) 2. Tournaments (Tournois), sometimes 2-circuits are allowed. 3. Signed graphs (Graphes sign´es) each edge is labelled + or - (for example friend or enemy) Examen le mardi 26 novembre de 9h `a12h 4. Oriented graphs (Graphes orient´es), each edge is given a Salle habituelle unique direction (no 2-circuits) An interesting subclass are the DAG Directed Acyclic Graphs (graphes sans circuit), for which the transitive closure is a partial order (ordre partiel) 5. Partial orders and comparability graphs an intersting particular case. Duality comparability – cocomparability (graphes de comparabilit´e– graphes d’incomparabilit´e) 6. Directed graphs or digraphs (Graphes dirig´es)

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Introduction Introduction

The problem has to be defined in each model and sometimes it could be hard. ◮ What is the right notion for a coloration in a directed graph ? For partial orders, comparability graphs or uncomparability graphs ◮ No directed cycle unicolored, seems to be the good one. the independant set and maximum clique problems are polynomial. ◮ It took 20 years to find the right notion of oriented matro¨ıd ◮ What is the right notion of treewidth for directed graphs ? ◮ Still an open question. It seems that all tentative definitions loose many properties of the undirected case treewidth.

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Introduction Introduction

http ://math.nie.edu.sg/fmdong/Research/articles/beautiful Second Neighbourhoods Conjecture P.D. Seymour 1990 ◮ If G has a sink then the results is true. Every digraph without 2-circuits has a with at least as many ◮ So the conjecture is true for DAGs. second neighbours as first neighbours. ◮ The interesting case is for strongly connected graphs. Second neighbours, SN (x) is the set of vertices at exact distance 2 of x. Therefore we are looking for x such that |SN (x)| ≥ | N(x)|. 5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Introduction Introduction

Another nice result on degrees : the politician’s theorem Paul Erd¨os, Alfred R´enyi and Vera S`os’ proof

Characterization ◮ |V (G)| = 3, only the triangle which is a windmill graph Let G a connected undirected graph |G| ≥ 3 such that for every satisfies the degree condition. ◮ x, y ∈ N(G), we have |N(x) ∩ N(y)| = 1 G has no induced C4. then G is a of triangles (a windmill graph). ◮ For every pair x, y of non universal vertices, necessarily d(x) = d(y) = k. The politician version ◮ Using some argument from algebra, we obtain k = 2 and the Suppose in a group of at least three people we have the situation existence of an . that any pair of persons have precisely one common friend. Then ◮ For the complete proof, see : ”Proofs from the BOOK”, by there exists always a person (the politician) who is everybody Martin Aigner and G¨unter M. Ziegler, Springer-Verlag, ≥ friend. Second Edition.

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Graph searches Graph searches

Some definitions Graph searches are very well known and often used : 1. ”Fil d’ariane” in the Greek mythology. Graph Search 2. Euler (1735) for solving the famous walk problem in Kœnisberg The graph is supposed to be connected so as the set of visited vertices. After choosing an initial vertex, a search of a connected 3. Tremaux (1882) and Tarry (1895) introducing DFS to solve graph visits each of the vertices and edges of the graph such that a maze problems new vertex is visited only if it is adjacent to some previously visited 4. Fleury, proposed a nice algorithm to compute an Euler Tour, vertex. cited in E. Lucas, R´ecr´eations math´ematiques, Paris, 1891. At any point there may be several vertices that may possibly be 5. Computer scientists from 1950, in particular in the 70’s, R.E. visited next. To choose the next vertex we need a tie-break rule. Tarjan for new applications of DFS.... The breadth-first search (BFS) and depth-first search (DFS) 6. 4 points characterizations Corneil, Krueger (2008), and the algorithms are the traditional strategies for determining the next definition of LDFS a new interesting basic search. vertex to visit.

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Graph searches Graph searches

Variations Our main question Main Problem What kind of knowledge can we learn about the structure of a Graph Traversal more or less equivalent to graph search given graph via graph searching (i.e. with one or a series of The set of visited vertices is not supposed to be connected (used successive graph searches) ? for computing connected components for example) Goals Graph Searching for cops and robbers games on a graph ◮ Building bottom up graph algorithms from well-known graph The name Graph searching is also used in this context, with a searches slightly different meaning. Relationships with width graph ◮ Develop basic theoretic tools for the structural analysis of parameters such as treewidth. graphs ◮ Applications on huge graphs : No need to store sophisticated data structures, just some labels on each vertex,

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Applications of LBFS on structured graph classes Applications of LBFS on structured graph classes

Lexicographic Breadth First Search (LBFS)

Data : a graph G = ( V , E) and a start vertex s Result : an ordering σ of V 3 5 1 Assign the label ∅ to all vertices label (s) ← { n} for i ← n `a 1 do Pick an unumbered vertex v with lexicographically largest label 2 6 7 4 σ(i) ← v foreach unnumbered vertex w adjacent to v do label (w) ← label (w).{i} end end 5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Applications of LBFS on structured graph classes Applications of LBFS on structured graph classes

Algorithm LexBFS (G, τ ) Input : A graph G = ( V , E) and an initial ordering τ of the vertices. Output : An ordering σ of the vertices of G. It is just a breadth first search with a tie break rule. 1. L ← (V ) ; i ← 1 ; 2. while ∃P 6= ∅ in L = ( P ,..., P ) do We are now considering a characterization of the i 1 k 3. Let Pl be the leftmost nonempty cell order in which a LBFS explores the vertices. 4. Remove the first vertex x (smallest with respect to τ) from Pl Before let us implement it using partition refinement 5. σ(x) ← i ; i ← i + 1 ; 6. for each cell Pj , j ≥ l do in linear time. ′ 7. Let P = {v|v ∈ N(x) ∩ Pj }; ′ ′ 8. if P is nonempty and P 6= Pj , then ′ 9. Remove P from Pj ′ 10. Insert P to the left of Pj in L 11. end for 12. end while 13. return (σ)

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Applications of LBFS on structured graph classes Applications of LBFS on structured graph classes

An example Table : Step by step LexBFS of G. The resulting ordering is σ : xywzuvadcbe . ′ σ(α) α N (α) Cells b u Série xdyuevwcazb d 1 x {y uv wz } y uv wz d e c a b Parallèle Parallèle v 2 y {wzdecab } w z u v d e c a b c 3 w {zdecab } z u v d e c a b e Série Série e Série Série 4 z {u v a } u v a d e c b a 5 u {vadecb } v a d e c b w Parallèle z dParallèle wy u v 6 v {a d e c b } a d e c b z 7 a { } d e c b y x a c b x 8 d {c b } c b e 9 c { } b e 10 b { } e 11 e { }

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Applications of LBFS on structured graph classes Applications of LBFS on structured graph classes

Consequences LBFS orderings of the vertices Property (LexB) For an ordering σ on V , if a <σ b <σ c and ac ∈ E and ab ∈/ E, then it must exist a vertex d such that d <σ a et db ∈ E et ◮ Using partition refinement allows to avoid the managment of dc ∈/ E. the labels The vertices with lexicographic maximum labels belongs necessarily to the right most part. ◮ LBFS can be implemented in O(|V (G)| + |E(G)|) d a b c

Theorem For a graph G = ( V , E), an ordering σ sur V is a LBFS of G iff σ satisfies property (LexB).

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Applications of LBFS on structured graph classes Applications of LBFS on structured graph classes

Importance of 4 points conditions for graph classe Forbidden 3 points suborderings recognition

Many classes of graphs or partial orders can be characterized by the existence of a particular ordering of the vertices with some forbidden configuration on three points. Examples with forbidden configuration on three points : 1. Interval graphs : ordering of the left ends of the intervals. 2. Chordal : simplicial elimination ordering. 3. Co-comparability : transitivity violation of the 4. Permutation : transitivity violation of the graph and its complement. 5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Applications of LBFS on structured graph classes Applications of LBFS on structured graph classes

Consequences

LexBFS is involved in many recognition algorithms for these classes Seminal paper of graphs. D.G. Corneil et R. M. Krueger, A unified view of graph searching, ◮ Apply a LexBFS on G giving an ordering σ SIAM J. Discrete Math, 22, Num 4 (2008) 1259-1276 In which characterizations of the orderings yielded by wel-known ◮ If G is a the last vertex of σ, can be graph searches are provided. taken as a source in a transitive orientation of G. Namely : Generic Search, DFS, BFS, LBFS, LDFS ◮ The starting point for comparability and recognition algorithms.

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Applications of LBFS on structured graph classes Applications of LBFS on structured graph classes

Why LBFS behaves so nicely on well-structured graphs LexBFS versus LBFS! Google Images query : LBFS (thanks to Fabien) A nice recursive property yields : On every tie-break set S, LBFS operates on G(S) as a legitimate LBFS. First Answer

proof Consider a, b, c ∈ S such that a <σ b <σ c and ac ∈ E and ab ∈/ E, then it must exist a vertex d such that d <σ a et db ∈ E et dc ∈/ E. But then necessarily d ∈ S.

Remark Analogous properties are false for other classical searches.

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Chordal graphs Chordal graphs

Definition Two Basic facts

A graph is a if every cycle of length ≥ 4 has a chord. Also called triangulated graphs, (cordaux in french) 1. First historical application : perfect phylogeny. 1. Chordal graphs are hereditary 2. Many NP-complete problems for general graphs are 2. Interval graphs are chordal polynomial for chordal graphs. 3. Second application : . Treewidth (resp. pathwidth) are very important graph parameters that measure distance from a chordal graph (resp. ).

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Chordal graphs Chordal graphs

Chordal graph A characterization theorem for chordal graphs 5 6 7 2 1 4 8 3 Theorem Dirac 1961, Fulkerson, Gross 1965, Gavril 1974, Rose, Tarjan, A vertex is simplicial if its neighbourhood is a clique. Lueker 1976. For a connected graph G the following items are equivalent : Simplicial elimination scheme (0) G is chordal (every cycle of length ≥ 4 has a chord). σ = [ x1 . . . xi . . . xn] is a simplicial elimination scheme if xi is simplicial in the subgraph Gi = G[{xi . . . xn}] (i) G has a simplicial elimination scheme (ii) Every minimal separator is a clique

a b c 5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Chordal graphs Chordal graphs

Minimal Separators An example

a A subset of vertices S is a minimal separator if G if there exist a, b ∈ G such that a and b are not connected in f b c e G − S. and S is minimal for inclusion with this property . d

3 minimal separators {b} for f and a, {c} for a and e and {b, c} for a and d.

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Chordal graphs Chordal graphs

If G = ( V , E) is connected then for every a, b ∈ V such that ab ∈/ E then there exists at least one minimal separator. Proof of the theorem But there could be an exponential number of minimal separators . Consider 2 stars a, x1,..., xn (centered in a) and b, y1,..., yn (centered in b) and then add all the edges xi yi for 1 ≤ i ≤ n. There exist 2 n minimal separators for the vertices a and b.

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Chordal graphs Chordal graphs

Theorem [Tarjan et Yannakakis, 1984] G is chordal iff every LexBFS ordering yields a simplicial 3 5 1 elimination scheme.

Proof : Let c be a non simplicial vertex. There exist a < b ∈ N(c) avec ab ∈/ E. Using characterization of LexBFS orderings, it exists d < a with db ∈ E and dc ∈/ E. Since G is chordal, necessarily ad ∈/ E. 2 6 7 4 d a b c

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Chordal graphs Chordal graphs

Chordal graphs recognition so far

d a b c Chordal graph recognition 1. Apply a LexBFS on G O(n + m) But then from the triple d, a, b, it exists d ′ < d with d ′a ∈ E and 2. Check if the reverse ordering is a simplicial elimination scheme d ′b ∈/ E. Furthermore d ′d ∈/ E . . . O(n + m) And using the triple d’, d, a , we start an infinite chain ..... 3. In case of failure, exhibit a certificate : i.e. a cycle of length ≥ 4, without a chord. O(n) Remark Most of the proofs based on some characteristic ordering of the vertices are like that, with no extra reference to the algorithm itself. 5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 recognition Cograph recognition

The ultimate Algorithm Using LexBFS?

b u 1

0 0 A cograph recognition algorithm [BCHP03] d v

1 1 e 1 1 1. σ ← LexBFS( G) c − e 2. σ ← LexBFS (G, σ ) wy u v a 0 z d 0 3. If σ and σ both have the NS-property then x a c b 3.1 Answer ” G is a cograph” z w 3.2 Build MD (G) x y 4. Else Output a P4

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Cograph recognition Cograph recognition

Computing a LexBFS ordering σ Computing σ=LexBFS −(G, σ ) u b xywzuvadcb e b u xywzuvadcbe

d v d v x adcbeywzu v

c c e e a a

z w z w

x y x y

u b xywzuvadcb e b u x y w z uvadcbe

d v xywzuvadcbe d v x a d c b e y w z u v

c c x a d c b e y w z u v e e a a

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 Cograph recognition Cograph recognition

b u 1 Some research problems 0 0 d v

1 1 e 1 1 c Generalization to arbitrary graphs ? e wy u v 1. There are many similarities between two-LexBFS-sweep a 0 z d 0 algorithm and the linear implementation of Ehrenfeucht et x a c b z w al.’s algorithm [DGM01] 2. LexBFS is useful for the transitive orientation problem. Could x xywzuvad bc e y it lead to a simple linear time algorithm for this problem? xadecbzyuv w 3. Or another graph search, for example acting symmetrically on G and G. Lemma 4. Certifying algorithms ? M(G, x) is composed by the slices S (x) of σ and S (x) of σ. i j 5. Generalizations of modular decomposition ( with some errors for real world graphs) Theorem If G is a cograph, then MD (G) can be retrieved from the slice structure of σ and σ. 5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 A nice conjecture A nice conjecture

Definition Characterization : A cocomparability graph G is the complement of a comparability A graph is a cocomparability graph iff it admits a cocomp ordering. graph, i.e., G admits a transitive orientation.

Definition : Recognition status : For a total ordering τ of the set of vertices, an umbrella is a triple There exists a linear time algorithms which computes a cocomp ordering (McConnell and Spinrad). of vertices a, b, c ∈ X such that : a <τ b <τ c and ac ∈ E and ab , bc ∈/ E. A co-comparability (co-comp for short) ordering is an But the certifying step needs more O(mn ) or O(MM ). umbrella-free total ordering of the vertices of G. Linear-time particular case for permutation graphs Forbidden triple 1. Compute cocomp orderings σ and τ for G and G. 2. Compute a representation of G as a permutation graph using σ and τ. a b c 3. Certify the representation. This certifying step is also linear, An umbrella using the geometric representation. 5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 A nice conjecture A nice conjecture

Since we focus on the ordering of the vertices as the result of a graph search, now we can compose graph searches in a natural way. Therefore we can denote by M(G, x0) the order of the vertices obtained by applying M on G starting from the vertex x0. Why this Rule? Definition of the + Rule The + Rule forces to keep the ordering of the previous sweep in case of tie-break Let M be a graph search and σ an ordering of the vertices of G, M+(G, σ ) be the ordering of the vertices obtained by applying M on G starting from the vertex σ(1) and tie-breaking using σ in decreasing order.

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 A nice conjecture A nice conjecture

◮ Graph searches operate on total orderings : Step 0 : σ = M(G, x0) 1. Such an idea was already used for planarity testing in some Step 1 : M(G, σ ) algorithm (de Fraysseix and Rosentiehl 1980) with 2 Step 2 : M2(G, σ ) = M(G, M(G, σ )) consecutive DFS. . . . 2. Algorithms for strongly connected components by Kosaraju i i−1 Step i : M (G, σ ) = M(G, M (G, σ )) 1978, Sharir 1981 . . . In our framework, ◮ For which search M and graph G does there exist fixed 1) DFS (G) − points ? 2) DFS (G , post d ) ◮ Unfortunately a formal study of this composition remains to 3. To compute efficiently the diameter of a graph using be done ! successive BFS ◮ Also called multisweep algorithms.

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 A nice conjecture A nice conjecture

REPEATED LBFS

v6

v3

v1 v2 v7 v5

v4 v11

Require: G = ( V , E) v8

Ensure: an ordering σ v10 σ ← LBFS(G) v9 for i = 2 to |V | do σ ← LBFS +(G, σ) end for Example Algorithm 1: LBFS + multi-sweep ◮ τ := LBFS (G) : v5, v4, v3, v2, v6, v7, v8, v9, v10 , v11 , v1 ◮ + π = LBFS (G, τ ) : v1, v2, v9, v8, v7, v6, v4, v5, v3, v10 , v11 ◮ + θ = LBFS (G, π ) : v11 , v5, v10 , v8, v7, v4, v2, v6, v9, v3, v1 ◮ + σ = LBFS (G, θ ) : v1, v2, v3, v4, v5, v6, v7, v8, v9, v10 , v11

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 A nice conjecture A nice conjecture

Known results about cocomparability and LBFS

v6 Property (Korte, Mohring 1981) v 3 If G is a cocomparability graph, then the last vertex of LBFS (G) v1 v2 v7 v5

v4 v11 can be taken as a source in some transitive orientation of G.

v8 Leads to good transitive orientation and interval recognition v10 algorithms. v9 Property (Corneil, Olariu, Stewart 1999) If G is an AT-free graph, 2 consecutive LBFS computes a Example dominating path.

◮ + Property (Corneil 1999) σ = LBFS (G, θ ) : v1, v2, v3, v4, v5, v6, v7, v8, v9, v10 , v11 ◮ + For every cocomp graph G, it exists a cocomp ordering which is a θ = LBFS (G, σ ) : v11 , v5, v10 , v8, v7, v4, v2, v6, v9, v3, v1 LBFS ordering. ◮ . . . 5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 A nice conjecture A nice conjecture

The particular case of interval graphs

Property (Corneil, K˝ohler 2010) If G = ( V , E) is an interval graph, that REPEATED LBFS finds a Property (Corneil, MH., K˝ohler 2011) interval ordering in less than |V | iterations If G is a cocomparability graph and σ a cocomp ordering then LBFS +(G, σ ) is also a cocomp ordering. Theorem (Corneil, Olariu and Stewart 2010) For an interval graph, a series of 5+1 special consecutive LBFS + produces an interval ordering.

Theorem (Li, Wu 2012) For an interval graph, a series of 4 searches produces an interval ordering.

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 A nice conjecture A nice conjecture

Our Results 2013 Theorem (Dusart, MH. 2013) LBFS + applied on a cocomparability graph produces in O(n) steps a cocomp ordering.

Cocomp orders Best possible LBFS Orderings Using a Ma’s family of interval graphs (2000), this result is best possible, i.e., a constant number of LBFS would not be enough for all graphs.

Consequences Since for interval graphs a MNS ordering which is a cocomp ordering is also an interval ordering it gives the Corneil and Landscape for interval graphs K˝ohler’s unpublished result.

5th Lecture : Modular decomposition MPRI 2013–2014 5th Lecture : Modular decomposition MPRI 2013–2014 A nice conjecture A nice conjecture

Consequences

Dusart, MH 2013 It gives a very easy to program, O(nm ) cocomparability graph Conjecture recognition. Repeated LBFS + on a cocomp always reaches in O(n) a quasi-fixed point (i.e., a 2-loop), going back and forth on one Quasi fixed point cocomp ordering and its dual (reverse). In all examples so far, Repeated LBFS + on a cocomp always This can the subject of a MPRI internship reaches in O(n) a quasi-fixed point (i.e., a 2-loop), going back and forth on one cocomp ordering and its dual (reverse). Is this always true? Even for interval graphs it is still a conjecture.