advanced topics in algorithms shamir

153

Upload: avi1922

Post on 29-Nov-2014

71 views

Category:

Documents


8 download

TRANSCRIPT

Page 1: Advanced Topics in Algorithms Shamir

Advanced Topics in Graph Algorithms

Technical Report

Lecturer� Ron Shamir

Edited by� Sariel Har�Peled

Based on Notes from the CourseAdvanced Topics in Graph Algorithmsc�Tel�Aviv University� Spring �����

Page 2: Advanced Topics in Algorithms Shamir

Page 3: Advanced Topics in Algorithms Shamir

Contents

� Lecture � ����� Introduction to Graph Theory � � � � � � � � � � � � � � � � � � � � � � � � � � ��

����� Basic De�nitions and Notations � � � � � � � � � � � � � � � � � � � � � ������� Intersection Graphs � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Circular�arc Graphs � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Interval Graphs � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Line graphs of bipartite graphs � � � � � � � � � � � � � � � � � � � � � �

� Lecture � ����� Perfect Graphs � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

����� De�nition of perfect graph � � � � � � � � � � � � � � � � � � � � � � � � ������� Some De�nitions and Properties � � � � � � � � � � � � � � � � � � � � � ����� Perfect Graph Theorem � � � � � � � � � � � � � � � � � � � � � � � � � ��

� Lecture � ���� Perfect Graphs � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

���� p�Critical Graphs � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� A Polyhedral Characterization of Perfect Graphs � � � � � � � � � � � ��� The Strong Perfect Graph Conjecture � � � � � � � � � � � � � � � � � �

�� Triangulated Graphs � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� Introduction � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� Characterizing Triangulated Graphs � � � � � � � � � � � � � � � � � � � ���� Recognizing Triangulated Graphs � � � � � � � � � � � � � � � � � � � � ��

� Lecture � ����� Recognizing Triangulated Graphs � � � � � � � � � � � � � � � � � � � � � � � � �

����� Generating a PEO � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Testing an Elimination Scheme � � � � � � � � � � � � � � � � � � � � � �

��� Triangulated Graphs as Intersection Graphs � � � � � � � � � � � � � � � � � � ������� Evolutionary Trees � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

Page 4: Advanced Topics in Algorithms Shamir

� CONTENTS

����� Triangulated Graphs as Intersection Graphs � � � � � � � � � � � � � � ��

� Lecture � ��

��� Triangulated Graphs Are Perfect � � � � � � � � � � � � � � � � � � � � � � � � ������� Proving This Property � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Other Results � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

��� Computing the Minimum Fill In � � � � � � � � � � � � � � � � � � � � � � � � � ������ The Problem � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Fill In is NP�Hard � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� Problems � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

� Lecture � ��

�� Some Optimization Algorithms on Triangulated Graphs � � � � � � � � � � � ����� Computing the chromatic number and all maximal cliques � � � � � � ����� Finding � and k � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

�� Comparability Graphs � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Some De�nitions � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Implication Classes � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� The Triangle Lemma � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� Decomposition of Graphs � � � � � � � � � � � � � � � � � � � � � � � � � ��

� Lecture � ��

��� Uniquely Partially Orderable Graphs � � � � � � � � � � � � � � � � � � � � � � ����� Characterizations and Recognition Algorithms � � � � � � � � � � � � � � � � � �

� Lecture � ��

�� Some interesting graph families characterized by intersection � � � � � � � � � � ���� Introduction � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���� Permutation graphs � � � � � � � � � � � � � � � � � � � � � � � � � � � � �� ��� F �Graphs � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���� Tolerance graphs � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �� ���� Bounded and unbounded tolerance graphs� � � � � � � � � � � � � � � � ���

� Lecture � ����� Comparability Graph Recognition � � � � � � � � � � � � � � � � � � � � � � � � ����� The Complexity of Comparability Graph Recognition � � � � � � � � � � � � � ���

����� Implementation � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �������� Complexity Analysis � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

�� Coloring and Other Problems on Comparability Graphs � � � � � � � � � � � � ������� Comparability Graphs Are Perfect � � � � � � � � � � � � � � � � � � � ���

Page 5: Advanced Topics in Algorithms Shamir

CONTENTS �

���� Maximum Weighted Clique � � � � � � � � � � � � � � � � � � � � � � � ������ Calculating ��G� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���

��� The Dimension of Partial Orders � � � � � � � � � � � � � � � � � � � � � � � � ��

� Lecture � ������� Comparability invariants � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Interval graphs � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���

�� Lecture �� ������� Preference and Indi�erence � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Recognizing interval graphs � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

������ A quadratic algorithm � � � � � � � � � � � � � � � � � � � � � � � � � � �������� A Linear Algorithm � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

��� More about the consecutive ��s property � � � � � � � � � � � � � � � � � � � � ��

�� Lecture �� ������� Temporal Reasoning and Interval algebras � � � � � � � � � � � � � � � � � � � ������ Interval satis�ability problems � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Interval sandwich problems and ISAT � � � � � � � � � � � � � � � � � � � � � � ������ A linear time algorithm for ISAT���� � � � � � � � � � � � � � � � � � � � � � ������� Bandwidth� Pathwidth and Proper Pathwidth � � � � � � � � � � � � � � � � � ��

Page 6: Advanced Topics in Algorithms Shamir

CONTENTS

Page 7: Advanced Topics in Algorithms Shamir

List of Figures

��� Three pictures of the same graph� � � � � � � � � � � � � � � � � � � � � � � � � ����� Some orientations of a triangle� � � � � � � � � � � � � � � � � � � � � � � � � � ���� �a� The graph K���b� is the complement of �c� and vice versa� � � � � � � � � ���� Examples of subgraphs� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���� �a� A graph G��b� A maximal clique in G��c� A maximum clique of G��d� A

��clique� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���� Graph examples� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���� �a� A graph G��b� An interval representation of G��c� A proper interval rep�

resentation for P���d� A unit interval representation for P�� � � � � � � � � � � ��� �a� A graph G��b� A circular�arc representation of G� � � � � � � � � � � � � � ����� �a� The tra�c �ow� �b� The intersection graph of the arcs� �c� The clock cycle� � ���� The matching diagram of ������������ and the corresponding permutation

graph� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ A triangulated graph which is not an interval graph� � � � � � � � � � � � � � � ������ Transitive orientations of Three comparability graphs� � � � � � � � � � � � � � ����� Two graphs which are not transitively orientable� � � � � � � � � � � � � � � � ������ �a� A graph G��b� The line graph of G� � � � � � � � � � � � � � � � � � � � � � �

��� The matrix M� each row correspond to a vertex in V � and each column to an��clique K�S� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

�� A graph and its clique matrix � � � � � � � � � � � � � � � � � � � � � � � � � � �� Two graphs� the left one is triangulated� and the right one is not� � � � � � � �� Code for MCS algorithm � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���� Two di�erent possible running of the MCS algorithms� � � � � � � � � � � � � ��

��� The path �� Vertices appear ordered from left to right according to the MCSalgorithm output� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

��� The vertices x and vj � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���� The path �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� The path ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

Page 8: Advanced Topics in Algorithms Shamir

LIST OF FIGURES

��� A forbidden structure in a chordal graph � � � � � � � � � � � � � � � � � � � � ���� Code for PEO testing algorithm � � � � � � � � � � � � � � � � � � � � � � � � � ���� An input chordal graph and elimination order � � � � � � � � � � � � � � � � � ���� Xv n fug is a clique � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��� The intersection graph of a set of subtrees of a host tree is triangulated � � � ������ An evolutionary tree describing the properties A�B�C�D� �� �� � and the cor�

responding triangulated intersection graph � � � � � � � � � � � � � � � � � � � ������ The left family has the Helly property� while the right family does not � � � � ������ The paths P�� P�� and P� must intersect � � � � � � � � � � � � � � � � � � � � ����� The tree T � � �K� �E� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� The paths P�� � � � � Pk�� form a cycle � � � � � � � � � � � � � � � � � � � � � � � ������ The case B �� Y � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� The case B � Y � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

��� The Graph � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��� Some examples of Meyniel graphs �which are not chordal�� � � � � � � � � � � ���� Example�A Chain Graph � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���� Ordering Q� in the same chain graph � � � � � � � � � � � � � � � � � � � � � � ���� Independent edges �broken lines denote non�edges� � � � � � � � � � � � � � � ��� Independent edges that form an induced C� � � � � � � � � � � � � � � � � � � ���� C�G� for the graph G of Figure �� � � � � � � � � � � � � � � � � � � � � � � � ��� a graph �left� with two possible layouts of cost �center� and �right� � � � ��� the graph G �left� and G� �right� � � � � � � � � � � � � � � � � � � � � � � � � ����� Example�Edges we have to add � � � � � � � � � � � � � � � � � � � � � � � � � ����� x and v � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

�� An example for maximal cliques in a graph � � � � � � � � � � � � � � � � � � � ��� Chromatic Number Calculation � � � � � � � � � � � � � � � � � � � � � � � � � �� An example for �nding maximal stable set � � � � � � � � � � � � � � � � � � � ���� some comparability graphs � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���� An example for implication classes � � � � � � � � � � � � � � � � � � � � � � � ��� The triangle lemma � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

��� The composition graph of P��K��K�� C�� � � � � � � � � � � � � � � � � � � � � � ��� The composition graph of F��F�� F�� F�� � � � � � � � � � � � � � � � � � � � � � � �� The decomposition of a graph � � � � � � � � � � � � � � � � � � � � � � � � � � ���� Module in a graph � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���� Uniquely partially orderable graph � � � � � � � � � � � � � � � � � � � � � � � ��� A graph with a color class that induce all vertices � � � � � � � � � � � � � � � ��� A graph G�decomposition � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

Page 9: Advanced Topics in Algorithms Shamir

LIST OF FIGURES �

�� Algorithm to construct G�decomposition � � � � � � � � � � � � � � � � � � � � ���� A triangle forcing the merge of two implication classes � � � � � � � � � � � � ���� The classes bF � bC must be equal� � � � � � � � � � � � � � � � � � � � � � � � � � ����� bA� cA� is an implication class in E n cD� � � � � � � � � � � � � � � � � � � � � ����� A graph G and its quasi�transitive graph G� �in G�� edges �x� y�� �y� x� are

not drawn� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

�� A permutation graph for the permutation ����������� � � � � � � � � � � � � � �� �� An orientation on a permutation graph � � � � � � � � � � � � � � � � � � � � � �� � An F�graph � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �� Not an F�graph�point A have two values of the function� � � � � � � � � � � � �� �� The air controllers strike problem� � � � � � � � � � � � � � � � � � � � � � � � � � The composition of permutation diagrams� � � � � � � � � � � � � � � � � � � ��� �� A tolerance graph� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��� � An unbounded tolerance graph� � � � � � � � � � � � � � � � � � � � � � � � � � ���

��� Code of The TRO Algorithm � � � � � � � � � � � � � � � � � � � � � � � � � � ����� Example � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� Example � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Example � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Procedure EXPLORE � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� The main procedure of the algorithm � � � � � � � � � � � � � � � � � � � � � � �� ��� Two elements for each Edge� � � � � � � � � � � � � � � � � � � � � � � � � � � � �� �� Example � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Example � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Example � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Procedure EXPLORE � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������� The main procedure of the algorithm � � � � � � � � � � � � � � � � � � � � � � ������ Example � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Example � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Example � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Example �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Example �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Example �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ Example � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������� Example �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���

���� a� not SP poset� b� � e� SP posets � � � � � � � � � � � � � � � � � � � � � � � ������� a� interval graph� b� it�s interval representation� c� chordal� but not interval

graph � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���

Page 10: Advanced Topics in Algorithms Shamir

�� LIST OF FIGURES

��� example for lemma � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������� example for theorem of Gilmore�Ho�man � � � � � � � � � � � � � � � � � � � � ������ a� interval graph� b� it�s clique matrix� � � � � � � � � � � � � � � � � � � � � � ������ Example for Lekkerkerker � Boland theorem � � � � � � � � � � � � � � � � � � ���

���� Example � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �� ���� Wegner ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ����� Example of function l� h � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ a PQ�tree� The FRONTIER here is �F J I G H A B E D C� � � � � � � � � � ������ Example of execution of CONSECUTIVE � � � � � � � � � � � � � � � � � � � �

���� A consistent scenario � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������� The ���valued interval algebra A��� Single line� x interval� Double line� y interval������� Two interval realizations for Example ���� � � � � � � � � � � � � � � � � � � � ������� �a� The ��chain �vi�� x

�i � vi�� x

�i � vi��� �b� An interval realization of the ��chain� ���

���� Algorithm to construct Delta��CONSISTENCY � � � � � � � � � � � � � � � � ������ Complexity of ISAT on all fragments ofA�� T � satis�ed by setting all intervals

disjoint or identical� The four asterisk cases were shown to be NPC by Webber������� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

Page 11: Advanced Topics in Algorithms Shamir

Chapter �

Lecture �Advanced Topics in Graph Algorithmsc�Tel�Aviv UniversitySpring Semester� ����

Lecturer � Ron Shamir

Scribe � Kahn Shaul

Lecture � � April ��

��� Introduction to Graph Theory

����� Basic De�nitions and Notations

A directed graph G consists of a �nite set V and an irre�exive binary relation on V � We callthe elements of V � vertices� The binary relation may be represented either as a collection Eof ordered pairs� or as a function from V to its power set� Adj � V � P �V ��

We call Adj�v� the adjacency set of vertex v� and we call the ordered pair �v�w� � Ean edge� Clearly � �v�w� � E � w � Adj�v�� In this case we say that w is adjacent to v�and v and w are endpoints of the edge �v�w�� The assumption of irre�exivity implies that�v� v� �� E �v � V �� or equivalently� v �� Adj�v� �v � V �� Adj�v� is sometimes denoted byN�v� and is called the open neighborhood of v� The closed neighborhood of v is de�ned �

N �v� � v �Adj�v�

We will usually drop the parentheses and the comma when denoting an edge� Thus xy � Eand �x� y� � E will have the same meaning�

In an undirected graph every edge appears in both directions�Two graphs G � �V�E� and G� � �V �� E�� are called isomorphic� denoted G �� G�� if there

is a bijection f � V � V � satisfying for all x� y � V �

�x� y� � E � �f�x�� f�y�� � E�

��

Page 12: Advanced Topics in Algorithms Shamir

�� CHAPTER �� LECTURE �

d

a

c

b a

b

d

c

a b

c d

Figure ���� Three pictures of the same graph�

Let G � �V�E� be a graph with vertex set V and edge set E� The graph G�� � �V�E��� issaid to be the reversal of G� where E�� � f�x� y� j �y� x� � Eg� that is�

xy � E�� � yx � E �x� y � V ��

We de�ne symmetric closure of G to be the graph �G � �V� �E�� where �E � E � E���A graph G � �V�E� is called undirected if its adjacency relation is symmetric i�e�� if

E � E�� or E � �E�A graph is called an oriented graph if E � E�� � �Orientation of an undirected graph is a choice of a direction on every edge in it�For example � see Figure ����

b

c aa

b b

cac

Figure ���� Some orientations of a triangle�

Let G � �V�E� be an undirected graph� We de�ne the complement of G to be the graphG � �V�E�� where

E � f�x� y� � V V j x �� y and �x� y� �� EgA graph is complete if every two distinct vertices are adjacent� The complete graph on nvertices is usually denoted by Kn� and is called a clique of size n�

A �partial� subgraph of a graph G � �V�E� is de�ned to be any graph H � �V �� E��satisfying V � � V and E� � E�

Given a subset A � V of the vertices� we de�ne the subgraph induced by A to be GA ��A�EA�� where EA � fxy � E j x � A and y � Ag�

Page 13: Advanced Topics in Algorithms Shamir

���� INTRODUCTION TO GRAPH THEORY �

(c)(b)(a)

Figure ��� �a� The graph K���b� is the complement of �c� and vice versa�

a

b

c d

e

fa graph G

a

b

c d

e

a (partial) subgraph of Ga

c

f

d

the induced subgraph

G {a,c,d,f}

Figure ���� Examples of subgraphs�

Page 14: Advanced Topics in Algorithms Shamir

�� CHAPTER �� LECTURE �

Let G � �V�E� be an undirected graph� Consider the following de�nitions �A subset A � V of r vertices is an r�clique�r�clique if it induces a complete subgraph�

i�e�� if GA�� Kr� A single vertex is a ��clique�

A clique K in G is maximal if there is no clique of G which properly contains K as asubset�

A clique is maximum if there is no clique of G of larger cardinality���G� is the number of vertices in a maximum clique of G� and is called the clique number

of G�A clique cover of size k is a partition of the vertices V � A� � A� � ���� Ak such that

each Ai is a clique�k�G� is the size of a smallest possible clique cover of G� It is called the clique cover

number of G�A stable set or independent set is a subset X of vertices no two of which are adjacent���G� is the number of vertices in an independent set of maximum cardinality� It is called

the stability number of G�

a

(a)

b c

d a

b

(b) (c)

c

d

b a

(d)

Figure ���� �a� A graph G��b� A maximal clique in G��c� A maximum clique of G��d� A��clique�

A proper ccoloring�c�coloring is a partition of the vertices V � X� �X� � ����Xc suchthat each Xi is an independent set� In such a case� the vertices of Xi are �painted� with thecolor i and adjacent vertices will receive di�erent colors� If G has a proper c�coloring� wesay that G is ccolorable�c�colorable�

��G� is the smallest possible c for which there exist a proper c�coloring of G� it is calledthe chromatic number of G�

In the graph G of �gure ��� �a� � fb� c� dg and fag are a clique cover of size �� fa� cg isan independent set in G�

Hence� ��G� � � k�G� � � � ��G� � � � ��G� � It is always true that�

��G� � ��G� and ��G� � k�G�

Since every vertex of a maximum clique must be contained in a di�erent color class inany minimum proper coloring� and every vertex of a maximum stable set must be containedin a di�erent clique in any minimum clique cover�

Page 15: Advanced Topics in Algorithms Shamir

���� INTRODUCTION TO GRAPH THEORY ��

The following relations are sometimes called duality�

��G� � ��G� and ��G� � k�G��

Let G � �V�E� be an arbitrary graph� consider the following de�nitions �Chain� A sequence of vertices �v�� v�� v�� ���vl� is a chain of length l in G if

vi��vi � E or vivi�� � E for i � ����l�

Path� A sequence of vertices �v�� v�� v�� ���vl� is a path from v� to vl in G provided thatvi��vi � E for i � ���l� A path or a chain in G is called simple if no vertex occurs more thanonce in the sequence� It is called trivial if l � �� It is called chordless if the graph inducedby fv�� ���vlgis a path of length l� We denote the chordless path on n vertices by Pn�

Connected graph� A graph G is connected if between any two vertices there exists a chainin G joining them�

Strongly connected graph � A graph G is strongly connected if for any two vertices x and ythere exists a path in G from x to y�

Cycle � A sequence of vertices �v�� v�� v�� ���vl� v�� is called a cycle of length l�� � or closedpath � if vi��vi � E for i � ����l and vlv� � E�

Simple cycle� A cycle �v�� v�� v�� ���vl� v�� is a simple cycle if vi �� vj for i �� j�Chordless cycle� A simple cycle �v�� v�� v�� ���vl� v�� is chordless if vivj �� Efor every i� j such that f�i� j� � ��mod l�g� A chordless cycle on n vertices is denoted

by Cn�Bipartite graph� An undirected graph G � �V�E� is bipartite if its vertices can be parti�

tioned into two disjoint independent sets V � S� � S� i�e�� every edge has one endpoint inS� and one in S�� We usually denote such graphs by �S�� S�� E� to distinguish the two parts�

Complete bipartite graph� A bipartite graph G � �S�� S�� E� is complete if for everyx � S� and y � S� we have xy � E� We denote by Km�n the complete bipartite graph�S�� S�� E� with j S� j� m and j S� j� n�

Examples for using the above notation � K� � C� is called a triangle � C� � �K� � Kn�n ��Kn �C� � C��

����� Intersection Graphs

Let F be a family of nonempty sets� The intersection graph of F is obtained by representingeach set in F by a vertex and connecting two vertices by an edge i� their corresponding setsintersect� Examples �

�� Interval graph � The intersection graph of a family of intervals on a linearly orderedset �like the real line� is called an interval graph� If these intervals have a unit length�then we call the graph a unit interval graph�

Page 16: Advanced Topics in Algorithms Shamir

� CHAPTER �� LECTURE �

5P

C 6K

1,6 2K2

K4,3

Figure ��� Graph examples�

�� Proper interval graph � A proper interval graph is constructed from a family of intervalson a line such that no interval properly contains another�

In ��� Roberts showed that a graph is a unit interval graph i� it is a proper intervalgraph�

(d)(c)

43

5

6

21

(a)

(b)

5

36

2

4

1

Figure ���� �a� A graph G��b� An interval representation of G��c� A proper interval repre�sentation for P���d� A unit interval representation for P��

����� Circular�arc Graphs

Consider the following generalization of the notion of intervals on a line� If we join the twoends of our line� thus forming a circle� the intervals will become arcs on the circle� Allowingarcs to slip over and include the point of connection� we obtain a class of intersection graphscalled the circular�arc graphs� which properly contains the interval graphs� In other words �a graph is a circulation arc�graph if it is the intersection graph of a family of arcs on a circle�

Page 17: Advanced Topics in Algorithms Shamir

���� INTRODUCTION TO GRAPH THEORY ��

4 5

2

3 1

(a)

4

(b)

5

1

3

2

Figure �� � �a� A graph G��b� A circular�arc representation of G�

Example �� The tra�c �ow at the corner of Holly� Wood and Vine is pictured in the nextpage in �gure ��� a� Two lanes are called compatible if tra�c can �ow on both of themsimultaneously without collisions� Certain lanes are compatible with one another� such as cand j or d and k� while others are incompatible� such as b and f� In order to avoid collisions�we wish to install a tra�c light system to control the �ow of vehicles� Each lane will beassigned an arc on a circle representing the time interval during which it has a green light�Incompatible lanes must be assigned disjoint arcs� The circle may be regarded as a clockrepresenting an entire circle which will be continually repeated�

An arc assignment for our example is given in �gure ��� c� In general if G is theintersection graph of the arcs of such an assignment see the �gure ��� b � and if H is thecompatibility relation de�ned on the pairs of lanes� then clearly G is a partial subgraph ofH� In our example� the compatible pairs �d� k�� �h� j�� and �i� j� are in H but are not in G�

A proper circular arc graph is the intersection graph of a family of arcs none of whichproperly contains another� In a di�erent generalization of interval graphs Renz ������ char�acterized the intersection graphs of paths in a tree� Walter ������� Buneman ������� andGavril ������ carried this idea further and showed that the intersection graphs of subtrees ofa tree are exactly the triangulated graphs �the graphs with no induced Ck for k ���

A permutation diagram consists on n points on each of two parallel lines� and n straightline segments matching the points� The intersection graph of the line segments is called apermutation graph�

If the �n points are located randomly around a circle� then the matching segments willbe chords of the circle� and the resulting class of intersection graphs properly contains thepermutation graphs� This class is called the class of circle graphs�

A simple argument shows that every proper circular�arc graph is also a circle graph� Wemay assume that no pair of arcs together covers the entire circle� For each arc on the circle

Page 18: Advanced Topics in Algorithms Shamir

� CHAPTER �� LECTURE �

c

l

b

i

a

g

e

j

d

c

fk

h

g

jd

b

h

i

ef

k

l

a

G , the circular-arc graph.

(b)

Wood Street

-----------

k-----------

a b c

l

i hj

---------------

---------------fg

d

e

Holly Street

Vine Avenue

(c)

(a)

Figure ���� �a� The tra�c �ow� �b� The intersection graph of the arcs� �c� The clock cycle�

Page 19: Advanced Topics in Algorithms Shamir

���� INTRODUCTION TO GRAPH THEORY ��

draw the chord connecting its two endpoints� Clearly two arcs overlap i� their correspondingchords intersect�

24

3

1 6 5

4 23 6 1 5

1 2 3 4 5 6

Figure ����� The matching diagram of ������������ and the corresponding permutationgraph�

����� Interval Graphs

An undirected graph G is called an interval graph if its vertices can be put into one�to�onecorrespondence with a set of intervals f of a linearly ordered set �like the real line� such thattwo vertices are connected by an edge of G i� their corresponding intervals have nonemptyintersection� We call f an interval representation for G�

Application to scheduling �Consider a collection c � ci of courses being o�ered by a major university� Let Ti be

the time interval during which course ci is to take place� We would like to assign courses toclassrooms so that no two courses meet in the same room at the same time� This problemcan be solved by properly coloring the vertices of the graph G � �C�E� where �

cicj � E � Ti � Tj �� �Each color corresponds to a di�erent classroom� The graph G is obviously an interval graph�since it is represented by time intervals� This example is especially interesting because e��cient linear�time algorithms are known for coloring interval graphs with a minimum numberof colors� �The minimum coloring problem is NP�complete for general graphs��

An application of interval GraphSuppose c�� c�� ���� cn are chemical compounds which must be refrigerated under closely

monitored conditions� If compound ci must be kept at a constant temperature between tiand t�i degrees� how many refrigerators will be needed to store all the compounds �

Let G be the interval graph with vertices c�� c�� ���� cn and connect two vertices wheneverthe temperature intervals of their corresponding compounds intersect� Intervals on a linesatisfy the Helly property � if a set S � fTi���Tkg of intervals such that� Ti � Tj �� forevery i �� j then

Tti�S Ti �� � Hence� if fci�� ci�� ���� cikg is a clique of G� then the intervals

Page 20: Advanced Topics in Algorithms Shamir

�� CHAPTER �� LECTURE �

f�tij� t�ij� j j � �� �� ���� kg will have a common point of intersection� say t� A refrigerator setat a temperature of t will be suitable for storing all of them� Thus� a solution to the problemwill be obtained by �nding a minimum clique cover of G� This is a polynomial problem oninterval graph� although it is NP�hard for arbitrary graphs�

Interval graphs satisfy many interesting properties� one of them is that interval graph isan hereditary property� An induced subgraph of an interval graph is an interval graph�

a

d

zy

b c

x

Figure ����� A triangulated graph which is not an interval graph�

Hereditary properties abound in graph theory� such as planarity and bipartiteness� Thenext property of interval graphs is also an hereditary property�

Triangulated graph property �Every simple cycle of length strictly greater than possesses a chord� Graphs which

satisfy this property are called triangulated graphs�

Theorem �� Haj os���� � An interval graph satis�es the triangulated graph property�

Proof� Suppose the interval graph G contains a chordless cycle �v�� v�� v�� ���vl��� v�� withl � � Let Ik denote the interval corresponding to Vk� For i � �� �� ���� l� � choose a pointpi � �Ii�� � Ii�� Since Ii�� and Ii�� do not overlap� the Pi constitute a strictly increasingor strictly decreasing sequence� Therefore� it is impossible for I� and Il�� to intersect�contradicting the criterion that V�Vl�� is an edge of G�

Not every triangulated graph is an interval graph� Consider the tree T given in �gure����� which certainly has no chordless cycles� The intervals Ia� Ib� and Ic of a representationfor T would have to be disjoint� and Id would properly include the middle interval� say Ib�Where� then could we put Iy so that it intersects Ib but not Id � Clearly we would be stuck�

Transitive orientation propertyEach edge can be assigned a one�way direction� in such a way that the resulting oriented

graph G � �V�E� satis�es the following condition �

� ab � E and bc � E �imply ac � E ��a� b� c � V � �

Page 21: Advanced Topics in Algorithms Shamir

���� INTRODUCTION TO GRAPH THEORY ��

The suspension bridge graph The house graphThe A graph

Figure ����� Transitive orientations of Three comparability graphs�

An undirected graph which is transitively orientable is sometimes called a comparabilitygraph� Figure ���� shows a transitive orientation of the A graph and of the suspension bridgegraph� The odd length chordless cycles C�� C�� C���� and the bull�s head graph � see Figure��� � cannot be transitive oriented�

5C The bull’s head graph

Figure ���� Two graphs which are not transitively orientable�

Theorem �� Ghouila � Houri ������� The complement of an interval graph satis�es thetransitive orientation property�

Proof� Let fIv j v � V g be an interval representation for G � �V�E�� De�ne anorientation F of the complement G � �V�E� as follows �

Page 22: Advanced Topics in Algorithms Shamir

�� CHAPTER �� LECTURE �

xy � F � Ix Iy ��xy � E��

Here Ix Iy means that the interval Ix lies entirely to the left of the interval Iy� �Remember�they are disjoint�� Clearly ��� is satis�ed� since Ix Iy Iz implies Ix Iz� Thus� F is atransitive orientation of G�

Page 23: Advanced Topics in Algorithms Shamir

���� INTRODUCTION TO GRAPH THEORY �

Theorem �� �Gilmore and Ho man ����� An undirected graph G is an interval graphi� G is a triangulated graph and its complement G is a comparability graph�

We will see the proof in a later lecture�We have seen already that every interval graph satis�es the two conditions� Looking

back each of the graph in Figure ���� can be properly colored using three colors and eachcontains a triangle� Therefore for these graphs� their chromatic number equals their cliquenumber� We will see later in the course that any triangulated graph and any comparabilitygraph also satis�es the following properties �

��Perfect propertyFor each induced subgraph GA of G� ��GA� � ��GA��The chordless cycles C�� C�� C� are not � � perfect� A dual notion of � � perfection is the

following�alphaperfect���Perfect propertyFor each induced subgraph GA of G� ��GA� � k�GA��

Theorem �� The perfect graph theorem Lov!asz �������A graph is ��perfect i� it is ��perfect�We will prove this theorem in lecture ��

����� Line graphs of bipartite graphs

Let G � �V�E�� The line graph or the edge graph of G denoted L�G� is the graph withV �L�G�� � E�G� and

�e�� e�� � E�L�G��� e� and e� have a common endpoint in G�

3

5

1 2

4G

12

43

45

25

L(G)

14

Figure ����� �a� A graph G��b� The line graph of G�

Being a line graph of a bipartite graphs is an hereditary property� �Removing a vertexin L�G� is the same as removing the corresponding edge in G� which remains bipartite��

An Independent set in L�G� corresponds to a matching � a set of independent edges� inG� A Clique in L�G� corresponds to a set of pairwise adjacent edges in G� If G is bipartite

Page 24: Advanced Topics in Algorithms Shamir

�� CHAPTER �� LECTURE �

it contains no triangles� so every set of pairwise adjacent edges in G� is a star� Therefore� ifG is bipartite� a clique cover of L�G� corresponds to a vertex cover of G�

Let us call a graph LGBG if it is the line graph of a bipartite graph� K onig �����proved that the edge chromatic number of a bipartite graph equals its maximum degree�By the above� this is equivalent to saying that if G is LGBG then ��G� � ��G�� TheK onig�Hall theorem ����� states that the size of a maximal matching in a bipartite graphequals its minimum vertex cover� This is equivalent to saying that ��G� � K�G� if G isLGBG� Together with the fact that being LGBG is hereditary� any of these two statementsimply that LGBG�S are perfect� From the perfect graph theorem the two statements areequivalent�

Page 25: Advanced Topics in Algorithms Shamir

Chapter �

Lecture �

Advanced Topics in Graph Algorithmsc�Tel�Aviv UniversitySpring Semester� ����

Lecturer � Ron Shamir

Scribe � Erez Hartuv

Lecture � � April ��

��� Perfect Graphs

In this lecture the graphs we consider are undirected� When we refer to a graph G we meanthe Graph G�V�E�� with vertex set V and edge set E�

����� De�nition of perfect graph

The following three conditions de�ne perfection properties of a graph G�V�E��

� �P�� ��GA� � ��GA�� �A � V

� �P�� ��GA� � k�GA�� �A � V

� �P� ��GA���GA� jAj� �A � V

By duality� a graph G satis�es �P�� i� its complement G satis�es �P���In this lecture we�ll prove the perfect graph theorem which says that �P����P�� and �P�

are equivalent� A graph which satis�es one of the perfection properties satis�es all �by thetheorem� and is called perfect graph�

Remark� The equivalence holds for �nite graphs only�

��

Page 26: Advanced Topics in Algorithms Shamir

� CHAPTER �� LECTURE �

Lemma �� Let the graph G�V�E� satisfy� ��G� � k�G�� If K is a minimum clique cover�and S is a maximum independent set� then each clique in K has exactly one vertex in commonwith S�

Proof� By de�nition� no clique can intersect an independent set in more than one ele�ment� Therefore the intersection of S and each clique in K may be empty� or one element�Remember that each vertex is contained in some clique� If there is a clique whose intersectionwith S is empty then� jKj � jSj� contradiction to the assumption of equality�

Lemma �� Let G be an induced subgraph of H then�

�� ��H� ��G�

�� ��H� ��G�

�� ��H� ��G�

�� k�H� k�G�

Lemma �� If D � V intersects every maximum independent set of G in exactly one vertexthen� ��GV�D� � ��G� � �

Proof� Denote � � ��G�� Let U be a maximum independent set of G� By the assumptionU �D � fig� Therefore U�fig is an independent set of GV�D� Therefore ��GV�D� ����If ��GV �D� � �� � then ��GV�D� � � �because of the monotonicity shown in Lemma �����It follows that GV�D contains a maximum independent set of size �� therefore G containsthis maximum independent set of size �� which does not intersect D� contradiction�

����� Some De�nitions and Properties

Given two graphs G� � �V�� E��� G� � �V�� E�� � we de�ne their union and join�

De�nition Union� G� �G� � �V� � V�� E� � E��

De�nition Join� G� �G� � �V� � V�� E � E� � E� � fuvju � V�� v � V�g�

Lemma �� if G�� G� are perfect� then their union and join are perfect�

Proof� Denote the parameters of each graph Gi as� �i� �i� �i� ki i � �� �The parameters value for G� � G� are�

� � max���� ��� � � max���� ���

Page 27: Advanced Topics in Algorithms Shamir

���� PERFECT GRAPHS ��

k � k� � k� � � �� � ��

The parameters value for G� �G� are�

� � �� � �� � � �� � ��

k � max�k�� k�� � � max���� ���

These relations together with the perfection of G�� G� imply the claim�

De�nition G � x� Let G�V�E� be an undirected graph with vertex x � V � The graphG � x is obtained from G by adding a new vertex x� which is connected to all the neighborsof x� G � x � �V � fx�g� E� � E � fx�uju � Adj�x�g��

Lemma �� �x �� y �G � x�� y � �G � y� � x

Proof� Let x� denote the new vertex �the copy of x�� Both graphs has the same vertexset� V � x� � y� In both graphs� uv is an edge i� one of the following exist�

�� uv � E� u �� y� v �� y

�� v � x�� ux � E� u �� y

De�nition More generally� if x�� � � � � xn are the vertices of G and h � �h�� � � � � hn� is avector of non�negative integers� then H � G � h is constructed by substituting for each xia stable set of hi vertices x�i � � � � � x

hii and joining xsi with xtj i� xi and xj are adjacent in G�

We say that H is obtained from G by multiplication of vertices�

Remark� The de�nition allows hi � �� in which caseH includes no copy of xi� Thus� everyinduced subgraph of G can be obtained by multiplication of G by appropriate ������valuedvector� For example G � G � ��� � � � � ���

����� Perfect Graph Theorem

We now reach the main part of the lecture� in which we prove two lemmas that will help toprove the perfect graph theorem�

Lemma �� Berge������� Let H be obtained from G by multiplication of vertices�

�� If G satis�es P�� then H satis�es P��

�� If G satis�es P�� then H satis�es P��

Page 28: Advanced Topics in Algorithms Shamir

� CHAPTER �� LECTURE �

Proof� The proof is by induction on the number of vertices in G� The lemma is true ifG has only one vertex� We shall assume that ��� and ��� are true for all graphs with fewervertices than G� Let H � G � h� If one of the coordinates of h equals zero� say hi � �� thenH can be obtained from G � xi by multiplication of vertices�

But� if G satis�es �P�� �respectively �P���� then G � xi also satis�es �P�� �respectively�P��� �G� xi is an induced subgraph of G� therefore �P�� on G implies �P�� on all inducedsubgraphs of G�� Then by the induction hypothesis H satis�es �P�� �respectively �P����

Thus� we may assume that each coordinate hi �� and since H can be built up from asequence of single�copy multiplications� it is su�cient to prove the result for H � G �x� Letx� denote the added �copy� of x�

Assume that G satis�es �P��� Since x and x� are nonadjacent� ��G � x� � ��G�� Let Gbe colored using ��G� colors� Color x� the same color as x� This will be a coloring of G � xin ��G � x� colors� Hence� G � x satis�es ����

Next assume that G satis�es �P��� We must show that ��G � x� � k�G � x�� Let K bea �minimum� clique cover of G with jKj � k�G� � ��G�� and let Kx be the clique in Kcontaining x� There are two cases�

Case �� x is contained in a maximum stable set S of G� i�e�� jSj � ��G�� In this caseS � fx�g is a stable set of G � x� so

��G � x� � ��G� � �� �����

Since K � ffx�gg covers G � x� we have that

k�G � x�K�ffx�gg covers G�x

� k�G� � �P�� ��G� � �

equation ���� ��G � x� always� k�G � x��

Thus� ��G � x� � k�G � x��Cases �� No maximum stable set of G contains x� In this case�

��G � x� � ��G�� �����

�G is an induced subgraph of G � x� therefore ��G � x� ��G�� If ��G � x� � ��G� itmeans that we switched one vertex from a maximum stable set in G with x� x�� to obtain amaximum stable set in G � x with cardinality greater by one� But that means x must be anelement in a maximum stable set in G� contradicting case � assumption��

Since each clique of K intersects a maximum stable set exactly once �Lemma ����� thisis true in particular for Kx� But x is not a member of any maximum stable set� Therefore�D � Kx � fxg intersects each maximum stable set of G exactly once� so by Lemma ��

��GV�D� � ��G� � �� ����

This implies that

Page 29: Advanced Topics in Algorithms Shamir

���� PERFECT GRAPHS ��

k�GV�D�induction

� ��GV�D�equation ���

� ��G� � �equation ���

� ��G � x�� ��

Taking a clique cover of GV�D of cardinality ��G � x� � � along with the extra cliqueD�fx�g� we obtain a cover of G�x of cardinality ��G�x�� Therefore we have a clique coverwith the lowest possible number of cliques� because always k �� so

k�G � x� � ��G � x��

Lemma �� Fulkerson������� Lov�asz������� Let G be an undirected graph each of whoseproper induced subgraphs satis�es P�� and let H be obtained from G by multiplication ofvertices� If G satis�es P�� then H satis�es P��

Proof� Let G satisfy �P� and choose H to be a graph having the smallest possiblenumber of vertices which can be obtained from G by multiplication of vertices but whichfails to satisfy �P� itself� Thus�

��H���H� jXj� �����

where X denotes the vertex set of H� yet �P� does hold for each proper induced subgraphof H�

As in the proof of the preceding lemma� we may assume that each vertex of G wasmultiplied by at least � and that some vertex u was multiplied by h �� Let U � fu�� � � � uhgbe the vertices of H corresponding to u� The vertex u� plays a distinguished role in the proof�By the minimality of H� �P� is satis�ed by HX�u� � which gives

jXj � � � jX � u�jP�

� ��HX�u� ���HX�u��

� ��H���H�

equation ���� jXj � �

Thus� equality holds throughout� and we can de�ne

p � ��HX�u� � � ��H��

q � ��HX�u� � � ��H��

andpq � jXj � �� �����

SinceHX�U is obtained from G�u by multiplication of vertices� and using the assumptionthat every proper induced subgraph of G satis�es �P��� Lemma �� �Berge� implies thatHX�U satis�es �P��� Thus� k�HX�U � � ��HX�U � � ��HX�u� � � q� Therefore� HX�U can

Page 30: Advanced Topics in Algorithms Shamir

� CHAPTER �� LECTURE �

be covered by a set of q complete subgraphs of H� say K�� � � � �Kq �this is not necessarily aminimum cover�� Without lost of generality we may assume that these q cliques are pairwisedisjoint and that jK�j jK�j � � � jKqj� Obviously�

qXi��

jKij � jX � U j � jXj � hequation ���

� pq � �h� ��

Since jKij � p� at most h � � of the cliques fail to contribute p to the sum� Hence�

jK�j � jK�j � � � � � jKq�h��j � p�

Let H � be the subgraph of H induced by X � � K� � � � � �Kq�h�� � fu�g� Thus

jX �j � p�q � h� �� � �h�� pq � �

equation ���� jXj� ����

Therefore H � is a proper induced subgraph of H� So by the minimality of H� H � satis�es�P��

��H ����H �� jX �j� �����

But p � ��H� ��H ��� so

��H ��equation ��� jX �j�p equation ���

� q � h� �

Let S � be a stable set of H � of cardinality q � h � �� Certainly u� � S�� for otherwise S�

would contain two vertices of a clique �by the de�nition of H ��� Therefore� S � S� � U �S� � �U �fu�g� is a stable set of H with �q� h���� �h� �� � q�� vertices� contradictingthe de�nition of q�

Theorem �� The Perfect Graph Theorem Lov�asz ������� For an undirected graph G ��V�E�� the following statements are equivalent�

� P� ��GA� � ��GA�� �A � V

� P� ��GA� � k�GA�� �A � V

� P� ��GA���GA� jAj� �A � V

Proof� The three statements hold for a one vertex graph� We may assume that thetheorem is true for all graphs with fewer vertices than G�

�P�� � �P�� Suppose we can color GA in ��GA� colors� Every optimal coloring �apartition to stable sets� C�� � � � � Cm satis�es�

jAj �mXi��

jCij � mmaxijCij

at most �GA vertices of a given color

� ��GA���GA�P�� ��GA���GA�

Page 31: Advanced Topics in Algorithms Shamir

���� PERFECT GRAPHS �

Therefore�

jAj � ��GA���GA�

�P� � �P��� Let G � �V�E� satisfy �P�� Then each proper induced subgraph of Gsatis�es �P�� and by induction satis�es �P�� �and also �P���� It is su�cient to show that��G� � ��G��

If we had a stable set S of G such that ��GV�S� ��G�� we could then paint S in onecolor and paint GV�S in ��G� � � other colors� and we would have ��G� � ��G��

Now let�s assume that such S does not exist� It means that for every stable set S of GGV�S has a clique K�S� of size ��G�� Let I be the collection of all stable sets of G� Keepin mind that �S�I ���clique K�S� in GV�S and in particular S �K�S� � �

Construct a ������matrix M with rows corresponding to vertices� and a column i corre�sponding to each independent set S�� � � � � SjIj� Mij � � i� vertex i belongs to K�Sj�� Thematrix is illustrated in �gure ����

1

n hn

T 000

00

01

1

In each column at most

one 1. all other 0.

In the column of T

all 0.

00

0

0...

1h

K(S|I| )) )K(S2K(S1

Figure ���� The matrix M� each row correspond to a vertex in V � and each column to an��clique K�S�

For each xi � V � let hi denote the number of cliques K�S� which contain xi��the numberof ones in the i�th row�� Let H � �X�F � be obtained from G by multiplying each xi by hi�if h � �h�� � � � � hn�� then H � G � h�� On the one hand� by Lemma ����

��H���H� jXj� ��� �

Page 32: Advanced Topics in Algorithms Shamir

� CHAPTER �� LECTURE �

On the other hand�

jXj � Xxi�V

hi

summing the matrix M

over rows and columns��

XS�I

jK�S�jevery clique in I

is of size ��� ��G�jIj� �����

Since every clique in G � x contains at most one �copy� of vertex x � G� we have��G � x� � ��G�� Therefore�

��H� � ��G�� ������

If a maximum stable set contain some �copy� of xi then it will contain all its �copies��i�e� all hi �copies��� To �nd ��H�� we sum up the hi�s of the vertices which induce a stableset T �in G� � and do so to all the stable sets of G which are collected in I� searching the onewith a maximum sum �note that all maximum stable sets in H are obtained in this way��Hence�

��H� � maxT�I

Xxi�T

hi

�Note that the maximum stable set in H does not necessarily correspond to the maximumstable set in G� The multiplicities may play a role too��

For each T � the sum above can be computed in two ways ��gure �����

�� Move row by row� but only for rows of vertices in T � and sum up the ones in eachrow�� hi��

�� Move column by column� and sum up the the ones in each column which correspondto vertices in T �

Hence�

maxT�I

Xxi�T

hi � maxT�I

�XS�I

jT �K�S�j��

T is a stable set and K�S� is a clique� so

T �K�S� � ��

K�T � is a clique in GV�T � so

T �K�T � � ��

In the second way of summing� at least one term will be zero� and all terms are at most one�compare �gure ����� So we conclude�

��H� � � � � � maxT�I

�XS�I

jT �K�S�j� � jIj � �� ������

Page 33: Advanced Topics in Algorithms Shamir

���� PERFECT GRAPHS

Let us summarize what we have shown�

jXj � ��G�jIj equation ���

��H� � jIj � �� equation ����

��H� � ��G�� equation ����

Then�

��H���H� � ��G��jIj � �� � jXj jIj � �

jIj jXj

contradicting equation �� �

�P�� � �P�� G satis�es �P��duality� G satis�es �P��

proved above� G satis�es �P�duality� G

satis�es �P��

Corollary �� A graph G is perfect i� its complement G is perfect�

Proof� By duality� G satis�es �P�� � G satis�es �P�� � By the Perfect Graph Theoremeach of these conditions is su�cient and necessary for perfection�

Corollary �� A graph G is perfect i� every graph H obtained from G by multiplicationof vertices is perfect�

Proof� One direction is trivial� The other direction follows immediately from Lemma ��and the Perfect Graph Theorem�

The last two corollaries are useful in checking perfection� we can choose to check thecomplement� and we can reduce non�adjacent vertices with identical neighborhoods andcheck on the resulting simpler graph�

Page 34: Advanced Topics in Algorithms Shamir

� CHAPTER �� LECTURE �

Page 35: Advanced Topics in Algorithms Shamir

Chapter �

Lecture �Advanced Topics in Graph Algorithmsc�Tel�Aviv UniversitySpring Semester� ����

Lecturer � Ron Shamir

Scribe � Dekel Tsur

Lecture � May �

��� Perfect Graphs

����� p�Crirical Graphs

De�nition An undirected graph G is called p�critical if G is not perfect� but every properinduced subgraph of G is perfect�

Note� If G is p�critical then for all vertices x of G

��G� x� � k�G � x�� w�G � x� � ��G� x�

Theorem �� If G is a p�critical graph on n vertices� then�

�� ��G�w�G� � n � �

�� for all vertices x of G� ��G� � k�G� x� and w�G� � ��G� x�

Proof� By the Perfect Graph theorem� since G is p�critical we have ��G�w�G� n and��G� x�w�G � x� n� � for all vertices x� Since � and w are monotone�

n � ��G�w�G� ��G � x�w�G� x� n� �

Hence� ��G�w�G� � n� �� ��G� � ��G� x� � k�G� x� and w�G� � w�G� x� � ��G� x�

Page 36: Advanced Topics in Algorithms Shamir

CHAPTER �� LECTURE �

����� A Polyhedral Characterization of Perfect Graphs

Let A be an m n matrix� We de�ne the two polyhedra

P �A� � fxjAx � �� x gPI�A� � convex� hull�fxjx � P �A�� x integralg�

where x is an n�vector� � is them�vector of all ones� and is the n�vector of all zeros� ClearlyPI�A� � P �A�� and for ��� �� matrix A without zero columns� P �A� and PI�A� are boundedin the unit hypercube in Rn� The clique matrix of a graph G � �V�E� is a ��� �� matrix whereif V � f�� �� � � � ng and C�� C�� � � � Cm are all the maximal cliques of G numbered arbitrarily�then Aij � � i� j � Ci� See Figure �� for an example�

1

2

3 4

5

�����������

� � � � �

� � � � �

� � � � �

�����������

Figure ��� A graph and its clique matrix

Theorem �� �Chv�atal� ��� Let A be the clique matrix of an undirected graph G� ThenG is perfect i� P �A� � PI�A��

Polyhedron P is called integral if all the coordinates of all its extreme points are integers�i�e� if P �A� � PI�A�� In other words� theorem �� is� G is perfect i� P �A� is integralpolyhedron� In particular� this implies that optimization problems which can be posed asinteger programming problems with constraints PI�A�� can be solved in polynomial time onperfect graphs� by solving the corresponding linear program�

����� The Strong Perfect Graph Conjecture

It is easy to see that the odd cycle C�k�� �for k �� is a p�critical graph� By the PerfectGraph theorem its complement C�k�� is also p�critical� C�k�� and C�k�� �called odd hole andodd anti�hole respectively� are the only known p�critical graphs� In ��� C� Berge conjecturedthat there are no other p�critical graphs� This conjecture is called the strong perfect graphconjecture �SPGC��

The strong perfect graph conjecture can be rephrased in several equivalent forms�

Page 37: Advanced Topics in Algorithms Shamir

���� TRIANGULATED GRAPHS �

��� G is perfect i� it does not contain induced subgraph isomorphic to an odd hole or anodd anti�hole�

��� G is perfect i� every cycle of length � in G or G contains a chord�

�� The only p�critical graphs are C�k�� and C�k�� �for k ���

The strong perfect graph conjecture remains an open question� However� the conjecturewas proved on several classes of graphs like planar graphs� circular arc graphs� graphs withw � � graphs with maximal degree � � and also K��� � free� K� � free� �free� and�free graphs� �a graph is X�free if it does not contains induced subgraph isomorphic to X ��

��� Triangulated Graphs

����� Introduction

De�nition An undirected graph G is called triangulated if every cycle of length � contains a chord� In other words G is triangulated if it does not contain an induced subgraphisomorphic to Cn for n � �

Being triangulated is a hereditary property� meaning that every induced subgraph of atriangulated graph is also triangulated� Triangulated graphs have also been called chordal�rigid�circuit� monotone transitive and perfect elimination graphs� For an example of trian�gulated graph see Figure ���

G1

a b c d

g f e G2

p

yx zq

r

Figure ��� Two graphs� the left one is triangulated� and the right one is not�

����� Characterizing Triangulated Graphs

De�nition A vertex x in G is called simplicial if Adj�x� induces complete graph in G �i�e��

Page 38: Advanced Topics in Algorithms Shamir

CHAPTER �� LECTURE �

Adj�x� is a clique��

We will prove that every triangulated graph has a simplicial vertex� Since being triangu�lated is a hereditary property� it gives us an iterative procedure for identifying triangulatedgraphs� Search for simplicial vertex� remove it from the graph and repeat until there is nosimplicial vertex �in that case� the graph is not triangulated� or there are no vertices left�and then the graph is triangulated��

De�nition Let G be an undirected graph and let � �v�� � � � � vn� be an ordering of thevertices� is called perfect elimination order �PEO� if every vi is a simplicial vertex in theinduced subgraph Gfvi�����vng� In other words� each set Xi � fvj � Adj�vi�jj � ig is complete�

In Figure ��� � �a� g� b� f� c� e� d� is one of the perfect elimination orders of G�� Incontrast to this� G� has no simplicial vertex� so obviously it has no perfect elimination order�

De�nition A subset S � V is called a vertex separator for nonadjacent vertices a� b �or a�bseparator�� if in GV�S a and b are in di�erent connected components� If no proper subset ofS is an a�b separator� S is called minimal vertex separator�

The example will be again on the graphs in Figure ��� In G�� the set fy� zg is a minimalvertex separator for p and q� whereas fx� y� zg is a minimal vertex separator for p and r� InG� all the minimal vertex separators have � vertices which are neighbors�

Theorem �� Dirac ��� Fulkerson and Gross ��For undirected graph G the following statements are equivalent�

� G is triangulated�

� G has a perfect elimination order� Moreover� any simplicial vertex can start a perfectorder�

� Every minimal vertex separator induces a complete subgraph of G�

Proof�

�� � ��� Let �a� x� b� y�� � � � � yk� a� �k �� be a simple cycle� Any minimal a�b separator mustcontain vertices x and yi for some i� but from �� it follows that xyi � E� which is achord of the cycle�

��� � �� Let S be an a�b separator� We will denote GA� GB the connected components of GV�S

containing a and b respectively� Since S is minimal� every vertex x � S is a neigh�bor of a vertex in A and a vertex in B� For any x� y � S there exist minimal paths�x� a�� � � � � ar� y��ai � A� and �x� b�� � � � � bk� y��bi � B�� Since �x� a�� � � � � ar� y� b�� � � � � bk� x�

Page 39: Advanced Topics in Algorithms Shamir

���� TRIANGULATED GRAPHS �

is a simple cycle of length �� it contains a chord� For every i� j aibj �� E �S is a�bseparator� and also aiaj �� E� bibj �� E �by the minimality of the paths� Necessarilyxy � E is the chord�

To prove the rest of the theorem� we will �rst prove the following lemma�

Lemma �� Dirac �� Every triangulated graph G has a simplicial vertex� If G is notcomplete then it has two nonadjacent simplicial vertices�

Proof� If G is complete the lemma is trivial� We will prove the lemma for noncompletegraphs by induction on the number of vertices in G� The lemma is trivial for graphs with� or � vertices� Assume the statement is correct for graphs with n � � vertices and let Gbe a triangulated graph with n vertices� Let a� b be two nonadjacent vertices in G� and letS be minimal a�b separator� Denote by GA� GB the connected components of GV�S whichcontain a� b respectively� We shall look at GA�S �

�� IfGA�S is complete� then each of its vertices is a simplicial vertex in GA�S � Particularly�every vertex in A which is simplicial in GA�S is also simplicial in G �as there are noedges between A and B��

�� If GA�S is not complete� by induction it contains two nonadjacent simplicial vertices�Since S is complete �we already proved � � in Theorem �� at least one of thesimplicial vertices is in A and like before this vertex is simplicial in G�

We showed that A contains a simplicial vertex in G� In the same manner� B contains asimplicial vertex in G� These two vertices are not adjacent�

Now we will continue the proof of Theorem ��

���� ��� By Lemma ��� G contains a simplicial vertex x� GV�fxg is triangulated and containsless vertices� so by induction it has a perfect elimination order �i�� � � � � in���� Since xis simplicial �x� i�� � � � � in��� is a perfect elimination order in G�

���� ��� Let C be a simple cycle in G� Let x be the �rst vertex from C to appear in the perfectelimination order� In the induced graph before eliminating x� the two neighbors of xin the cycle still exist� and since x is simplicial in that graph� these two vertices forma chord in the cycle� Hence� every cycle in G contains a chord�

Page 40: Advanced Topics in Algorithms Shamir

�� CHAPTER �� LECTURE �

�� assign label � to each vertex�� for i� n to � by �� do

� select� pick an unnumbered vertex v with largest label�� �i�� v�� update� for each unnumbered vertex w � Adj�v� do� add � to label�w� end for

�� end for

Figure �� Code for MCS algorithm

����� Recognizing Triangulated Graphs

If a graph G is triangulated and is not complete� it has two nonadjacent simplicial vertices�Also every induced subgraph of G is also triangulated� Therefore it is possible to chooseany vertex v and decide it will be last in the PEO �it is always possible to choose anothersimplicial vertex instead of v�� Afterwards� it is possible to choose a vertex u adjacent tov and put it in �n � ��st position� It is possible to continue choosing vertices backwardsto the perfect elimination order� Using the above idea will give us a linear time algorithmfor recognizing triangulated graphs� The following linear time algorithm �called MaximumCardinality Search� by Tarjan and Yannakakis ��� ��� receives a graph G given by adjacencylist for each vertex� and outputs an order of the vertices� with the property that if G istriangulated then is a PEO� We will show later how to check if this vertex order is a perfectelimination order �i�e� if the graph is triangulated� in linear time� The code is in Figure ��and a running example is given in Figure ���

3

5

6

1

2

8

9

4

7

21

5

8

9

64

7

3

Figure ��� Two di�erent possible running of the MCS algorithms�

Page 41: Advanced Topics in Algorithms Shamir

���� TRIANGULATED GRAPHS ��

Time Complexity

Let Si be the set of all vertices v that have not been numbered yet� and have label�v� � i�Each Si is represented by a doubly linked list� The set of active Si�s �all those Si�s whichwere non�empty at some point� will also be represented by a doubly linked list in increasingorder of i�with a pointer to the non�empty set with largest label� For each vertex we willstore its label i and a pointer to its position in Si� When v receives a number we take vout of its list and move each neighbor of v one list upwards� This takes O�� � degree�v���therefore the overall time complexity is O�jV j� jEj��

Page 42: Advanced Topics in Algorithms Shamir

�� CHAPTER �� LECTURE �

Page 43: Advanced Topics in Algorithms Shamir

Chapter �

Lecture �

Advanced Topics in Graph Algorithmsc�Tel�Aviv UniversitySpring Semester� ����

Lecturer � Ron Shamir

Scribe � Izik Pe�er

Lecture � � May ��

��� Recognizing Triangulated Graphs

����� Generating a PEO

In lecture we have introduced the MCS algorithm for generating a PEO for a triangulatedgraph� and proved that it is a linear time algorithm� We shall prove the correctness of thisalgorithm�

Theorem �� Tarjan and Yannakakis �A graph G � �V�E� is triangulated if and only if the MCS algorithm produces a permutation � which is a PEO�

Proof�

� Trivial�

� We shall prove the claim by induction on the number of vertices n�

�We shall refer to each permutation � simply as a one�to�one function from f�� � � � � ng to V � so that ����is the �rst vertex in the order� ���� is the second� etc� Surely� for each vertex v� ����v� is v�s serial numberin the order�

Page 44: Advanced Topics in Algorithms Shamir

�� CHAPTER �� LECTURE �

The theorem is trivially true for n � �� Assume correctness for every graph with lessthan n vertices� Let G�V�E� be a triangulated graph with n vertices� and let bethe permutation generated by the MCS algorithm with input G� According to theinduction hypothesis it su�ces to show that the vertex v � ��� is simplicial�

Claim �� G cannot contain an induced chordless path � � �u � v�� v�� � � � � vk� w� fork � so that

�i� � � i � k � ���vi� ���u� ���w� �����

Proof� Assume� by contrary� that such a path exists� Let � be a path satisfying ����such that ���u� is maximal� u was numbered before vk� despite the fact that w is aneighbor of vk and not of u� According to the maximum cardinality rule� this impliesthere exists a vertex x� such that x is a neighbor of u and not of vk� and x was numberedbefore u� as in �gure ����

v0 k

v wu

Figure ���� The path �� Vertices appear ordered from left to right according to the MCSalgorithm output�

Let j be the maximal index such that vj is a neighbor of x� Surely j is well de�ned�since u � v� is a neighbor of x� and j k� by the de�nition of x� It follows fromthe maximality of j that the induced path �� � �x� vj� � � � � vk� w� is chordless �xw �� E�otherwise �� � �x� vj� � � � � vk� w� x� is a chordless cycle of length �� contradicting G�schordality��

If ���x� ���w� �as in �gure ���� then for each j � i � k� ���vi� ���u� ���x�� so the path �� meets the condition ���� and contradicts the maximality of���u�� since ���x� � ���u�� Hence ���x� � ���w� �as in �gure ����� and thepath ��� � �w� vk� � � � � vj� x� satis�es ���� contradicting the maximality of ���u��

It follows that there is no path satisfying ����

Back to the proof of Theorem ����

Page 45: Advanced Topics in Algorithms Shamir

���� RECOGNIZING TRIANGULATED GRAPHS ��

vj

v0

vk

wu

x

Figure ���� The vertices x and vj

wu xvv j k

Figure ��� The path ��

vj

vk wu x

Figure ���� The path ���

v u w

Figure ���� A forbidden structure in a chordal graph

Page 46: Advanced Topics in Algorithms Shamir

� CHAPTER �� LECTURE �

Denote v � ������ and assume� by contrary that� v is not a simplicial vertex� Thenthere exist u�w � Adj�v� such that uw �� E� and ���u� ���w� �as in �gure ����It follows that the path �u� v� w� satis�es ��� of Claim ���� yielding a contradiction�

����� Testing an Elimination Scheme

In order to recognize whether a graph is triangulated� we can use the MCS algorithm to getan elimination scheme� but we have yet to describe how we can test whether this eliminationscheme is a PEO�

Naive Algorithm

Simulate the elimination process� and for each vertex to be eliminated� check whether itsnoneliminated neighbors are a clique� This strategy results in a total time complexity ofO�jV j � jEj��

E�cient Algorithm

We can improve complexity if we collect a list of desired neighbors for each vertex� and checkall the members in this list only once�

begin

�� for each vertex v do A�v�� �� for i� � to n� � do

� v � �i��� X � fx � Adj�v�j���v� ���x�g�� if X �� then

� u� �minf���x�jx � Xg��� concatenate X n fug to A�u�

end if

� if A�v� nAdj�v� �� then return FALSEend for

�� return TRUEend

Figure ��� Code for PEO testing algorithm

Page 47: Advanced Topics in Algorithms Shamir

���� RECOGNIZING TRIANGULATED GRAPHS ��

Example

‘24

5 7

8

1

6

3

Figure ���� An input chordal graph and elimination order

When applying the algorithm in �� to the input graph and elimination order in ���� thealgorithm does the following iterations�

Iteration � u � A�� � f�� g X � � �� Iteration � X � �� � u � � A��� � f�g A��� � Adj���Iteration X � �� �� u � � A��� � f�� �� g A�� � Adj��Iteration � X � �� �� u � � A��� � f�� g A��� � Adj���Iteration � X � � �� u � A�� � f�� g A��� � Adj���Iteration X � �� u � � A��� � f g A�� � Adj��

Correctness of the Algorithm

Theorem �� The algorithm in �gure ��� returns TRUE if and only if is a PEO�

Proof�

� Suppose the algorithm returns FALSE on iteration number ���u�� This may happenonly if in stage at that iteration there exists an unnumbered vertex w � A�u�nAdj�u��The vertex w was added to A�u� at stage � of a prior iteration� number ���v�� Itfollows that ���v� ���u� ���w�� for u�w � Adj�v�� but since uw �� E �as in�gure ����� is not a PEO�

Page 48: Advanced Topics in Algorithms Shamir

� CHAPTER �� LECTURE �

� Suppose is not a PEO� and the algorithm returns TRUE� Let v be a vertex withmaximal ���v�� such that the set Xv � fwjw Adj�v�� ���v� ���w�g does notinduce a clique� The vertex v is well de�ned� because if all of the Xv�s are cliques� then is a PEO� Let u be the vertex de�ned in stage of iteration ���v�� In stage � of thisiteration� Xv n fug is added to A�u�� Since the algorithm returns TRUE in stage ofiteration number ���u�� the condition of stage �i�e� The condition A�u� � Adj�u��is not met� so every x � Xv n fug is a neighbor of u�

Since ���v� is chosen to be the maximal vertex for which Xv is not a clique� and v isprior to u� Xu is a clique� so all u�s neighbors in Xv n fug are adjacent to each other�as in �gure �� � hence Xv is a clique� and a contradiction follows�

xvu

v u

Figure �� � Xv n fug is a clique

Complexity of the Algorithm

Theorem �� The algorithm ��� runs in time O�jV j� jEj��

Proof� We shall hold and �� as vectors� and for each v we shall hold Adj�v� and A�v�as lists� allowing duplicates to be concatenated to A�v�� Stage of iteration ���v� canbe implemented in O�jAdj�v�j � jA�v�j� by holding a bit vector Test of length n� and thecondition A�v� nAdj�v� � is implemented in the following way �

�� for each w � Adj�v�� set the bit Test�w� to ��

�� for each w � A�v�� if Test�w� is �� return FALSE�

� for each w � Adj�v�� clear the bit Test�w� to ��

�� return TRUE

Page 49: Advanced Topics in Algorithms Shamir

���� TRIANGULATED GRAPHS AS INTERSECTION GRAPHS ��

The resulting overall complexity is O�jV j � Pv � V jAdj�v�j � P

v � V jA�v�j�� wherejA�v�j is the last �maximal� size of A�v�� including the duplicates� For each v � V � Adj�v�adds vertices only to one list A�u�� and the number of added vertices is at most jAdj�v���j�Therefore

Pv � V jA�v�j P

v � V jAdj�v�j � O�jEj� and the overall time complexity isO�jV j� jEj��

Corollary �� There is a linear time algorithm for checking whether a given graph is tri�angulated�

��� Triangulated Graphs as Intersection Graphs

In Lecture � it was shown that every interval graph is triangulated� and that interval graphsare characterized as intersection graphs� Is there such a characterization for triangulatedgraphs as well� We shall see that a graph G is triangulated if and only if G is an intersectiongraph of a family of subtrees of a tree� The tree containing all the subtrees is called the hosttree�

a b

c

d e

fg

h

i

a

b

ch

i

de

f

g

Figure ���� The intersection graph of a set of subtrees of a host tree is triangulated

����� Evolutionary Trees

An application for this characterization of triangulated graphs is the evolutionary tree� alsocalled the phylogenetic tree� This model is formulated in the study of evolution� where we

Page 50: Advanced Topics in Algorithms Shamir

�� CHAPTER �� LECTURE �

wish to determine the way a group of species evolved in time to their current properties� Weuse the following assumptions �

� There exists a single ancient species� from which all the other species have evolved�

� Each ancient species might have split into two subspecies� because of a mutation chang�ing a property of one of the subspecies�

� Mutations are rare� so each mutation can occur only once in the tree�

We can therefore de�ne the evolutionary tree� which is a rooted binary tree� In this tree�every vertex corresponds to a species �every leaf corresponds to a current species�� Becauseof the third assumption for every property the set of all the species having that propertycorresponds to a set of tree vertices that induces a connected subgraph� i�e� a subtree�

We can build a graph with vertices that match properties� Two vertices will be adjacentif their properties appear together in a certain species �as in �gure ������ This graph mustbe triangulated�

A1 B1 C1 A2 D2 D3

1to2

AtoD

2to3BtoC

AtoB

A1

A1

C1

A2

D2

A B C D

1 2 3

Figure ����� An evolutionary tree describing the properties A�B�C�D� �� �� � and the cor�responding triangulated intersection graph

Page 51: Advanced Topics in Algorithms Shamir

���� TRIANGULATED GRAPHS AS INTERSECTION GRAPHS ��

����� Triangulated Graphs as Intersection Graphs

De�nition Let S � fTigi�I be a family of subsets of a set T � S has the Helly property ifand only if for every J � I� if �i� j � J � Ti � Tj �� then

j�J� Tj �� �� ��gure�

Figure ����� The left family has the Helly property� while the right family does not

Lemma �� Suppose that fTigi�S is a set of subtrees of T � and that there exist points a� b� con T � such for each i � S� Ti contains at least two of them� then

i�S� Ti ��

Proof� Denote� P� the simple path from a to b in T � P� the simple path from b to c inT � and P� the simple path from c to a in T � Since T is a tree� P� � P� � P� �� �otherwiseP� � P� � P� contains a cycle�� Every Ti contains at least one of the paths Pi� i � �� �� �Hence�

i�S� Ti � P� � P� � P� �� �

b

c

P

Common intersection point

a

Figure ����� The paths P�� P�� and P� must intersect

Page 52: Advanced Topics in Algorithms Shamir

�� CHAPTER �� LECTURE �

Theorem �� A family of subtrees of a host tree has the Helly property�

Proof� We shall prove the claim by induction on k� the size of the family J � For k � �the theorem is trivially true� Assume correctness for jJ j � k� Let J be a family of k � �trees � fT�� � � � � Tk��g� each pair of which having a non�empty intersection� By the inductionhypothesis�

�j���k Tj �� so there exists a �

j���k Tj�

�j���k��Tj �� so there exists b �

j���k��Tj�

� In addition� by assumption� T� � Tk�� �� so there exists c � T� � Tk���

Lemma �� applied for fT�� � � � � Tk��g and the points a� b� c� yieldsj���k��Tj �� �

Theorem �� Walter ��� Gavril ��� Buneman ��Let G�V�E� be an undirected graph� The following statements are equivalent �

� G is triangulated�

� G is the intersection graph of a family of subtrees of a tree�

� There exists a tree T � � �K� �E� as in �gure ���� such that �K is the set of maximalcliques in G� and for every v � V � if �Kv � fC � �Kjv � Cg� then T Kv

� the subgraphinduced by �Kv� is connected hence a subtree�

Proof�

�� � ��� Let T be a tree satisfying ��� We shall prove that vw � E � T Kv� T Kw

�� �� If v�w � V � vw � E� then for some maximal clique C � �K� v�w � C so T Kv

�T Kw

�� �� If T Kv

� T Kw�� then there are maximal cliques that contain both w and v� so

vw � E�

It follows that G is an intersection graph of the family fT Kvgv�V of subtrees of T �

��� � ��� Let fT Kvgv�V be a family of subtrees of a tree T � for which vw � E � T Kv

� T Kw�� �

Suppose that G contains an induced chordless cycle �v�� v�� � � � � vk��� v��� for k � � Letthe corresponding subtrees be T�� T�� � � � Tk��� respectively� It is obvious that ji� jj ���modk� � Ti � Tj �� � Let ai be an arbitrary point in Ti � Ti��� for i � �� � � � � k � ��throughout� indices are mod k�� We would like to prove that the ai�s form a cycle�

Page 53: Advanced Topics in Algorithms Shamir

���� TRIANGULATED GRAPHS AS INTERSECTION GRAPHS �

2,10 1,2,3

1,3,4

2,3,5

3,11

3,5,6

6,7,8,9

K2

K3 K6

1

2

3

4

5

6

9

11

710

8

Figure ���� The tree T � � �K� �E�

Page 54: Advanced Topics in Algorithms Shamir

�� CHAPTER �� LECTURE �

but we have to "throw away� possible branches� which are not on the main cycle� butthat the ai�s may lie on� Let bi be the last common point in the simple paths ai � ai��

and ai � ai��� The path ai � ai�� is in Ti and the path ai � ai�� is in Ti��� thereforebi � Ti � Ti���

Denote by Pi the simple path from bi�� to bi� It follows that Pi � Ti� hence Pi�Pj � for every ji� jj � �� On the other hand� Pi � Pi�� � fbig for every i� We have shown

thati���kPi is a simple cycle in T � contradicting T being a tree�

a3 3

b

1T

2T

3T

2b a

2

1P

2P

a0

0T

0b

3P

a1

1b

Figure ����� The paths P�� � � � � Pk�� form a cycle

U

a

BA

Figure ����� The case B �� Y

��� � �� We shall prove the claim by induction on n� the number of vertices in G� Assumecorrectness for every graph with less then n vertices�

Page 55: Advanced Topics in Algorithms Shamir

���� TRIANGULATED GRAPHS AS INTERSECTION GRAPHS ��

U

a

B

A

Figure ���� The case B � Y

� If G is the complete graph then �K � V � and T contains one vertex making theclaim trivial �this applies also for n � ���

� If G is not connected with connected components G�� � � � � Gk� then by the induc�tion hypothesis for each Gi there is a host tree Ti satisfying ��� for i � �� � � � � k�For each i � �� � � � � k � �� connect Ti to Ti�� by adding an arbitrary edge� Theresulting graph is a tree T satisfying ���

� If G is a connected� not complete� triangulated graph� then let a be a simplicialvertex in G� The set A � fag � Adj�a� is a maximal clique in G� DenoteU � fu � AjAdj�u� � Ag and Y � A n U �

� U �� because a � U �

� Y �� because G is not complete�

� V nA �� because G is connected and not complete�

The graph G� � GV nU is triangulated and contains less than n vertices� therefore�by the induction hypothesis there is a tree T � � � �K �� E��� whose vertices corre�spond to the maximal cliques in G�� in a way that for each vertex u � V n U � theset �K �

v � fC � �K �jv � Cg induces a connected subtree of T ��

Let us examine the connection between �K and �K �� the sets of maximal cliques inG and in G�� respectively� Let B be the maximal clique in G� that contains Y �There are two cases �

B � Y In that case T can be generated from T � by renaming B as A� For each y � Y� �Ky � �K �

y � fAg n fBg and �Ky induces the same subtree as �K �y� because all

we did is renaming B as A �as in �gure �����

B �� Y In that case T can be generated from T � by adding a vertexA� and connectingit to B� For each y � Y � �Ky � �K �

y�fAg and �Ky induces a connected subtree

Page 56: Advanced Topics in Algorithms Shamir

� CHAPTER �� LECTURE �

�as in �gure ������

In both cases� for each vertex u � U � fAg � �Ku� and for each vertex v � V n A��Kv � �K �

v� and these sets induce connected subtrees in T � respectively�

Page 57: Advanced Topics in Algorithms Shamir

Chapter �

Lecture �Advanced Topics in Graph Algorithmsc�Tel�Aviv UniversitySpring Semester� ����

Lecturer � Ron Shamir

Scribe � Lea Epstein

Lecture � � May ��

��� Triangulated Graphs Are Perfect

����� Proving This Property

In some graph families� the minimum graph coloring and the maximum clique problem� canbe simpli�ed using the principle of separation into pieces� as follows�

Theorem �� �Berge� ����� Let G be a connected� undirected graph� let S be a vertexseparator in G� and let GA� � GA� � ���� GAt be the connected components of GV�S � If S is aclique not necessarily maximal� then

��G� � maxi��GS�Ai �

w�G� � maxi w�GS�Ai �

Proof� Clearly ��G� ��GS�Ai� for each i� �because GS�Ai is an induced subgraph ofG� � so��G� k � maxi ��GS�Ai � On the other hand� G can be colored using exactly k colors� asfollows�

� First� color GS � �S is a clique� so there is only one way to do it��

��

Page 58: Advanced Topics in Algorithms Shamir

� CHAPTER �� LECTURE �

S

Figure ���� The Graph

� Then� independently extend the coloring to each piece GS�Ai � Each piece can becolored with at most k colors� and S is always colored using jSj colors � so it is possibleto extend the coloring on S to GS�Ai �renaming the colors if necessary��

� There will be no contradictions because if v � Ai� u � Aj� i �� j have the same colorthey are disconnected �because S separates them��

Next� consider the case of clique� Again w�G� w�GS�Ai � for each i� sow�G� maxi w�GS�Ai � � m�Let X be a maximum clique of G� i�e� jXj � w�G�� It is impossible that two vertices of Xlie in GAi and GAj � i �� j� since they are not connected � Thus� X is wholly contained in oneof the pieces� say GS�Ar � Hence m w�GS�Ar � jXj � w�G� �Therefore� w�G� � m�

Corollary �� Let S be a separating set in a connected graph G � �V�E�� and letGA� �����GAt be the connected components of GV�S� If S is a clique� and if each subgraphGS�Ai is perfect� then G is perfect�

Proof� The proof is by induction on n� the number of vertices in the graph�

Claim �� It is su�cient to prove ��G� � w�G�

Proof� It is trivial if n � �� Suppose jV �G�j � n and the claim is true for all graphs withless then n vertices� Suppose S is a separating set� and a clique in G� and each GS�Ai isperfect� Pick v � V � and let G� � G � fvg� If v � S� de�ne S� � S � fvg� In G� S� is alsoa clique � and also each GS��Ai is perfect �because this is an induced subgraph of a perfectgraph�� If v � Ai � S is still a clique � and GS�Ai�fvg is perfect� In both cases� from theinduction hypothesis � G� is perfect � This implies that for every proper induced subgraphH � ��H� � w�H� �

Now prove that ��G� � w�G� ���G� � maxi ��GS�Ai � �using theorem �����

maxi ��GS�Ai � � maxi w�GS�Ai � �because every GS�Ai is perfect��w�G� � maxi w�GS�Ai � �using theorem ��� again��

Thus� ��G� � w�G� �

Page 59: Advanced Topics in Algorithms Shamir

���� TRIANGULATED GRAPHS ARE PERFECT ��

Theorem �� Berge ����� Hajnal�Suranyi ��� Every triangulated graph is perfect �

Proof� By induction on the number of vertices in the graph� Let G be a triangulatedgraph� We shall assume it is connected� otherwise we consider each component individually�

� If G is complete� it is perfect�

� Otherwise let S be a minimal vertex separator for a pair a� b of nonadjacent vertices�By theorem �� S is a clique� Each of the subgraphs GS�Ai �de�ned in theorem ���� istriangulated �a hereditary property� and thus by induction hypothesis using corollary���� G is perfect�

����� Other Results

De�nition A Meyniel graph is a graph in which there are at least two chords in every oddcycle of length ��

Figure ���� Some examples of Meyniel graphs �which are not chordal��

Theorem �� Meyniel ���� Every Meyniel graph is perfect�The proof can be found in Golumbic�s book section ����

De�nition G is weakly chordal graph if G and �G do not contain an induced Ck � k � �

Theorem �� Hayward �� � Weakly Chordal graphs are perfect�

Page 60: Advanced Topics in Algorithms Shamir

� CHAPTER �� LECTURE �

V1 V2 V3 V4

P

Q

Figure ��� Example�A Chain Graph

��� Computing the Minimum Fill In

����� The Problem

The Minimum �ll�in problem is de�ned as follows� Given a graph� �nd the minimum numberof edges ��ll in� whose addition makes the graph triangulated� i�e� for G � �V�E� �nd F �such that jF j is minimal and G� � �V�E � F � is triangulated� This problem has to do withthe Gaussian elimination of symmetric matrices� �When looking for an elimination witha maximal number of zeros in the matrix in each step � the problem arises in numericalalgebra�� In the book of Garey and Johnson� the minimum �ll in problem �called thereChordal Graph Completion� is mentioned as a major open problem� shortly after the bookwas published� Yannakakis showed that the problem is NP complete�

����� Fill In is NP�Hard

Chain Graphs

De�nition A bipartite graph G � �P�Q�E� is a chain graph if one of the parts� say P � canbe ordered v��v�����vk so that Adj�v�� � Adj�v�� � ��� � Adj�vk� �the chain property��

This property is hereditary� �if we take out a vertex from P � the chain of containmentdoesn�t change� if we take out a vertex from Q� the containment order does not change��

Claim �� If a bipartite graph is a chain graph� both parts of the graph have the chainproperty�

Proof� We have to �nd an order for Q� Let Qi � �j�iAdj�vj� In this way�Q� � Q� � ��� � Qk� Let Ri � Qi�Qi��� i � �� ���� k� �� Rk � Qk� Then R� �R� � ����Rk

is a partition of Q� Impose a linear order � on the vertices in Q such that if u � Ri�v � Rj

and i j then v � u� Thus if v � u� u� v � Q then either u� v � Ri and Adj�u� � Adj�v� �fv�� ���� vig� or u � Ri�v � Rj and i j� in which case Adj�v� � fv�� ���� vjg � fv�� ���� vig �Adj�u��

Page 61: Advanced Topics in Algorithms Shamir

���� COMPUTING THE MINIMUM FILL IN �

V1 V2 V3 V4

P

QU U U U13 2 4

a cb d

Figure ���� Ordering Q� in the same chain graph

For the example in Figure ���� we have�

Q� � fa� b� c� dg�R� � fdg

Q� � fa� b� cg�R� � fagQ� � fb� cg�R� � fb� cg

Q� � ��R� � �

De�nition Two edges ij�kl are independent if the graph induction on fi� j� k� lg induces�K�� �see �gure ����

ji

k l

Figure ���� Independent edges �broken lines denote non�edges�

Theorem �� A bipartite graph G is a chain graph i� G does not contain two independentedges�

Proof� ���� Let ij and kl be independent edges� Then Adj�i� �� Adj�k�� Adj�i� �� Adj�k�and G is not a chain graph����� If this isn�t a chain graph� there must be two vertices� i� k � P so that

Page 62: Advanced Topics in Algorithms Shamir

� CHAPTER �� LECTURE �

u

v

x

y

Figure ��� Independent edges that form an induced C�

Adj�i� �� Adj�k� and Adj�i� �� Adj�k�there exist� j � Adj�i��Adj�k� and l � Adj�k��Adj�i�and the edges ij and kl are independent�

De�nition For a bipartite graph G � �P�Q�E� we de�ne a new graph C�G� � �N�E���where N � P � Q� E� � E � fuv j u� v � Pg � fuv j u� v � Qg � �i�e� we place the

independent set on each side of the clique� See �gure �����

π(4)

π(1)

V

V1

V

V

4

3

2

Figure ���� C�G� for the graph G of Figure ��

Lemma �� G is a chain graph i� C�G� is triangulated�

Proof� ���� If G is a chain graph� by lemma G contains two independent edges� ux � vy�

Thus� fu� v� y� xg is an induced C� in C�G� ����� Let G be a chain graph� let � be an ordering of P � such that

Adj������ � Adj������ � ��� � Adj���p��

where p � jP j � Since the property of being a chain graph is hereditary� it su�ces to showthat C�G� has a simplicial vertex� The neighborhood Adj����p�� of ��p� in C�G� is

Adj����p�� � AdjG���p�� � P � ��p�

Page 63: Advanced Topics in Algorithms Shamir

���� COMPUTING THE MINIMUM FILL IN

5 4

3 2 1

3 4 5 1 2

3 5 4 2 1

Figure �� � a graph �left� with two possible layouts of cost �center� and �right�

AdjG���p�� � Q and Q is a clique� so AdjG���p�� is a clique in C�G�� P � ��p� � P and Pis a clique� so P � ��p� is a clique in C�G�� Also� since Adj���p�� � Adj�v� for every v � P �all the nodes of P are adjacent to all nodes of Adj���p�� � Therefore Adj����p�� is a cliquein C�G�� and ��p� is a simplicial vertex of C�G��

Optimal Linear Arrangement �OLA�

A linear arrangement �or a layout� of a graph G � �N�E� is a �� � mapping� � N � f�� �� ��� jN jg� For an edge e � uv ofG � let �e� �� � j����u������v�j� The cost c���of the linear arrangement � is c��� �

Pe�E �e� ��� The optimal linear arrangement problem

is to decide� given a graph G and an integer k� whether there exists a linear arrangement �of G with cost c��� � k � This problem is NP�complete�

Chain Graph Completion �CGC�

Given a bipartite graph G � �P�Q�E� and a constant k� is there a set of non�edges F suchthat jF j � k and �P�Q�E � F � is a chain graph�

Theorem �� Yannakakis � �� �Chain graph completion is NP�complete�

Proof� Reduction from OLA� Given an instance of OLA� a graph G � �N�E� and aninteger k � we build an instance of CGC� a bipartite graph G� � �P�Q�E �� as follows� P � N� and Q contains two vertices e� and e� for every edge e of G� and a set R�v� of n � d�v�vertices for every vertex v of N � where n � jN j and d�v� is the degree of v in G� If e � �u� v�is an edge of G� then the nodes e�� e� that correspond to e are adjacent to u and v� Thenodes in R�v� are adjacent to v� In Fig ��� we see an example of this construction�

Page 64: Advanced Topics in Algorithms Shamir

� CHAPTER �� LECTURE �

Figure ���� the graph G �left� and G� �right�

Let A � �n�n��

����m� where m is the number of edges in G� The constant for CGC will

be k� � k �A� Let l�G� be the minimum cost of a linear arrangement of G� and h�G�� theminimum number of edges whose addition to G� gives a chain graph� We shall prove thath�G�� � l�G��A Thus l�G� � k �� h�G�� � k�A� which will prove the correctness of thereduction� First observe that an ordering � of N speci�es uniquely a minimal set H��� ofedges whose addition makes G� into a chain graph with the neighborhoods of the nodes inP ordered according to �� For every node x � Q� let �x� � maxfi j �x� ��i�� � E�g� Then

1 2 3 4

v

e

u

u v

e e1 2

P

Q

Figure ����� Example�Edges we have to add

H��� � f�x� ��j�� j x � Q� j ����x�g �E��Conversely� suppose that F is a set of edges such that G��F � � �P�Q�E ��F � is a chain graphand let � be an ordering of the nodes in P according to their neighborhoods in G�F ��� It iseasy to see that F � H���� and therefore if F is a minimal augmentation then F � H����Let h��� � jH���j� In order to complete the proof� it su�ces to show that for every ordering

� of N � h��� � c���� �n�n���

�� �m�where c��� is the cost of the linear arrangement � of G�

Page 65: Advanced Topics in Algorithms Shamir

���� COMPUTING THE MINIMUM FILL IN �

Let � be an ordering of N � For every v � N and x � R�v�� �see Figure ����� H��� contains����v� � � edges incident to x� Let e � uv be an edge of G� and suppose without loss ofgenerality that ����u� ����v�� The number of edges of H��� incident to each of the twonodes e��e� that correspond to e is

x

v

Q P

Figure ����� x and v

����v�� � � ����u� � �����v�� ����u��� �

� ����u� � �e� ��� ��

thus the number of edges of H��� incident to e� and e� is������v�� �� � ����v�� � � ����u� � �e� ��� �� ����u� � ����v� � �e� ��� �� Consequently�

h��� �Xv�N

Xx�Rv

�����v�� �� �����

�X

e�uv�E

�����v� � ����u� � �e� ��� �� �����

�Xv�N

�n� d�v�������v�� �� ����

�Xv�N

d�v������v�� �Xe�E

�e� ��� �m �����

�Xv�N

n�����v�� �� �Xv�N

d�v� � c���� �m �����

� c��� � �n��n� ��

��� �m ����

the last equality follows Xv�N

d�v� � �m� �����

Page 66: Advanced Topics in Algorithms Shamir

CHAPTER �� LECTURE �

and Xv�N

�����v�� �� � � � � � � � ���� �n� �� � �n�n� ��

�� ��� �

The result for Fill in

Theorem ��� Minimum Fill in is NP�hard

Proof� Reduction from CGC� Given G � �P�Q�E� and a constant k we build the graphC�G�� and give the same k � as an instance of the minimum �ll in problem�� By Lemma �� Adding edges to C�G� creates a triangulated graph i� adding the same edges to G creates achain graph�

����� Problems

� Maximum Chordal subgraph� Remove minimum number of edges from a graph�until you get a triangulated graph� This problem is still open� There exists an algorithmfor �nding a maximal �ll in �not maximum�� it�s time complexity is O�mn� wherem � jEj � n � jV j �Ohtsuki� �����

� Approximating the �ll in� Find in polynomial time a �ll�in set �i�e� a set F � such

that �V�E�F �� is chordal� such that if F is an optimal �ll in� � jEj�jF�j

jEj�jF j � � f�n�� The best

f�n� known today is O�pklog�n� for graph with max degree k �Klein et al�� ������ Can

one get better approximation� or prove lower bounds on the achievable approximation�assuming P �� NP �

� parametric �ll�in problem� How fast can we solve the �ll in problem for �xed k�Simple enumeration of all possible sets of size � takes O�n�km�� Two better algorithmsare known �Kaplan�Shamir�Tarjan ��� of complexity O�ckm� and O�k�mn�Ck�� BothCk and ck are� of course� exponential in k�

Page 67: Advanced Topics in Algorithms Shamir

Chapter �

Lecture �

Advanced Topics in Graph Algorithmsc�Tel�Aviv UniversitySpring Semester� ����

Lecturer � Ron Shamir

Scribe � Rotem Erlich

Lecture � May ��

��� Some Optimization Algorithms on Triangulated

Graphs

����� Computing the chromatic number and all maximal cliques

Theorem �� �Fulkerson and Gross ��� Let G � �V�E� be a triangulated graph� and let be a perfect elimination order for G� Every maximal clique in G is of the form� Xu � fugwhere Xu � fx � Adj�u�j���u� ���x�g�

4 8 7 5 3

1 6 2

Figure ��� An example for maximal cliques in a graph

Example� In the chordal graph in Figure ��� vertices are numbered according to p�e�oand we have� X� � f�g � f�� � �� g� X� � f�g � f�� �� g�X� � fg � f� �g�X� � f�g �

Page 68: Advanced Topics in Algorithms Shamir

CHAPTER �� LECTURE �

f�� g�X� � f�g � f�� � �g � maximal cliques� and� X� � fg � f� �� g�X� � f�g � f�� g �non maximal cliques�

Proof� Let C be an arbitrary maximal clique in G� and let v be the �rst vertex accordingto the order which is contained in C� Let w � G����w� � ���v�� If w �� Xv � fvg� thenwv �� E� therefore w �� C� so we get� C � Xv � fvg�

On the other hand� since G is triangulated Xv�fvg is a clique� and because C is maximalwe get� C � Xv � fvg�Corollary �� A triangulated graph on n vertices has at most n maximal cliques� withequality if and only if the graph has no edges�

Proof� Every maximal clique is characterized uniquely by the �rst vertex in which iscontained in it�

From Theorem ��� a naive algorithm for calculating the maximum clique in a triangu�lated graph is as follows�

� Find fvg � Xv for each v�

� Filter out the non�maximal cliques�

A more e�cient algorithm is based on the algorithm TEST for testing whether a givenvertices permutation is a PEO as shown in lecture no� �� In that algorithm Xv is calculatedfor each v�

Theorem �� When algorithm TEST operates on a chordal graph and a p�e�o� � fug�Xu

is not a maximal clique i� Xu is concatenated to A�u��

Proof� Reminder� In the phase of eliminating v �phase ���v� � i of TEST�� Xv � fugis concatenated to A�u� if u is the �rst neighbor of v after it in �

���� If Xu �fug is not a maximal clique then there exists a vertex w� ���w� ���u�such that fug � Xu � fwg � Xw� Let us take v such that v � �maxf���w�j���w� ���u�g��

In phase ���v�� Xu � Xv � fug is concatenated to A�u������ Assume that at phase ���v� Xu � Xv � fug is concatenated to A�u�� Then

Xv � Xu � fug� So Xv � fvg is a clique and Xu � fug � Xv � fvg� therefore Xu � fug is notmaximal�

See the modi�ed algorithm in �gure ���

Theorem �� The above algorithm correctly calculates the chromatic number and all max�imal cliques of a triangulated graph G � �V�E� in O�jV j� jEj� time�

The proof is similar to that of the algorithm in lecture no� ��

Page 69: Advanced Topics in Algorithms Shamir

���� SOME OPTIMIZATION ALGORITHMS ON TRIANGULATED GRAPHS �

�� � � ��� for all vertices v do S�v�� �� for i � � to n do

begin�� v � �i���� X � fx �Adj�v�j���v� ���x�g� if Adj�v� � then print fvg��� if X � then goto � � u� �minf���x�jx � Xg��� S�u��maxfS�u�� jXj � �g��� if S�v� jXj then do

begin��� print fvg �X��� � �maxf�� � � jXjg

end�� end��� print �The chromatic number is ����

Figure ��� Chromatic Number Calculation

Page 70: Advanced Topics in Algorithms Shamir

�� CHAPTER �� LECTURE �

����� Finding � and k

Next we tackle the problem of �nding the stability number ��G� of a triangulated graph G�Better yet� since G is perfect� the clique cover size k�G� � ��G��

Let be a perfect elimination scheme for G � �V�E�� We de�ne inductively a sequenceof vertices y�� y�� � � � � yt in the following manner�

��� y� � ���

��� yi � �minf���x�j���x� � ���yi��� and x �� Xy� �Xy� � � � � �Xyi��g�yi is the �rst vertex in which appears after yi�� in � and which is not in Xy� �Xy� �

� � � �Xyi��� All vertices following yt are in Xy� �Xy� � � � � �Xyt�

81 6

473

5

2

Figure �� An example for �nding maximal stable set

For example� in the graph in Figure ��

y� � �� Xy� � f� �gy� � �� Xy� � f gy� � �� Xy� � f� �gHere fy�� y�� y�g is a maximum stable set� and�

y� �Xy� � f�� � �g� y��Xy� � f�� g� y��Xy� � f�� � �g are a minimum clique cover�

Theorem �� Gavril� ���� The set fy�� y�� � � � � ytg is a maximum stable set of G� and thecollection of sets Yi � fyig � Xyi� i � �� �� � � � � t comprises a minimum clique cover of G�

Proof� The set y�� y�� � � � � yt is stable since if yiyj � E for i j� then yj � Xyi� whichcannot be� Thus ��G� t�

On the other hand� since fY�� Y�� � � � � Ytg is a set of cliques which together cover G� weget k�G� � t�

Since ��G� � k�G� we get� ��G� � k�G� � t� and we have produced the desiredmaximum stable set and minimum clique cover�

The method above� with a slight modi�cation in the algorithm of section ����� �nds amaximum stable set and a minimum clique cover in time complexity of O�jV j� jEj��

Page 71: Advanced Topics in Algorithms Shamir

���� COMPARABILITY GRAPHS ��

��� Comparability Graphs

����� Some De�nitions

An undirected graph G � �V�E� is a comparability graph if there exists an orientation �V� F �of G satisfying

F � F�� � �F � F�� � E�F � � F� where F � � facjab� bc � F for some vertex bgF is also called a transitive orientation of G� and G is also called transitively orientable

�TRO��

?

yes yes no

Figure ��� some comparability graphs

The relation F is a strict partial ordering �irre�exive� transitive�� Comparability graphsare also known as partially orderable graphs�

De�ne the binary relation # on the edges of an undirected graph G � �V�E� as follows�ab#a�b� �� a � a� and bb� �� E or b � b� and aa� �� E�We say that ab directly forces a�b� whenever ab#a�b��The re�exive� transitive closure of # is #�� It is easily shown that #� is an equivalence

relation on E� and hence partitions E into what we shall call the implication classes of G�Thus edges ab and cd are in the same implication class i� there exists a sequence of edges

ab � a�b�#a�b�# � � �#akbk � cd� k �� Such a sequence is called a #�chain from ab to cd�and we say that ab �eventually� forces cd whenever ab#�cd�

c d e

b

a

Figure ��� An example for implication classes

Page 72: Advanced Topics in Algorithms Shamir

�� CHAPTER �� LECTURE �

For example� the implication classes in the graph of �gure �� are� A� � fabg� A� �fcdg� A� � fac� ad� aeg� A� � fbc� bd� beg� A��

� � fbag� A��� � fdcg� A��

� � fca� da� eag�A��

� � fcb� db� ebg�Notice that ba#dc �� ab#cd and ba#�dc �� ab#�cd� by de�nition� Notice also that

ab#ab �by our convention that G contains no self�loops�� but not ab#ba necessarily�Let I�G� denote the collection of implication classes of G� We de�ne �I�G� � f �AjA �

I�G�g� where �A � A � A�� �the symmetric closure of �A�� The members of �I�G� are calledthe color classes of G�

����� Implication Classes

Theorem �� Let A be an implication class of an undirected graph G� If G has a transitiveorientation F � then either F � �A � A or F � �A � A�� and� in either case� A � �A � �

Proof� We de�ned # in order to capture the fact that� for any transitive orientation Fof G� if ab#a�b� and ab � F � then a�b� � F � Applying this property repeatedly� we obtainF � A � or A � F �

If F � A � � A � F�� � A�� � F � F � �A � A��

If A � F � A�� � F�� � F � A�� � �since F � F�� � � � F � �A � A�In both cases A � A�� � �since F � F�� � ��We shall prove later that the converse of Theorem � is also valid� namely if A�A�� �

for every implication class A� then G has a transitive orientation�Note that the existence of an arbitrary union of implication classes F � �iAi satisfying

F � F�� � and F � F�� � E does not necessarily mean that F is a transitive orientationof G� For example� in a simple triangle abc� fabg� fbcg and fcag are implication classessatisfying the condition but the resulting orientation is cyclic�

Lemma �� If ab#�cd� then there exists a #�chain from ab to cd of the form

ab � a�b�#a�b�#a�b�#a�b� � � �#akbk � cd

Proof� In the #�chain in the lemma the indices change for the ai�s in the odd �#��s� andfor the bi�s in the even ones� Let us look at any #�chain between ab and cd� If in that chainthere is a group of or more sequential edges with the same index changed � in particular inthat group the �rst and last edges directly force each other� We shall take for �our� chainthose �rst and last edges � so we got only � edges in a row with the same index changed�We shall do that for every such group of or more edges in a row� and will get the desired#�chain�

A #�chain satisfying the lemma is called a canonical #�chain�

Page 73: Advanced Topics in Algorithms Shamir

���� COMPARABILITY GRAPHS �

����� The Triangle Lemma

Lemma �� �The Triangle Lemma� Let A�B and C be implication classes of an undi�rected graph G � �V�E� with A �� B and A �� C�� and having edges ab � C� ac � B andbc � A

� i If b�c� � A then ab� � C and ac� � B

� ii If b�c� � A and a�b� � C� then a�c� � B

� iii No edge in A touches the vertex a

a

b

b c

c

c0

k k

1

0

a

b

b

b c

c

c0

1

k k

1

0

b 1

A

C

B

b

1

2

2

2ak

a

a2

b1

1

(1) (2)

Figure �� The triangle lemma

Proof� If b�c� � A� by Lemma �� there exists a canonical #�chain

bc � b�c�#b�c�#b�c� � � �#bkck � b�c�

�see Figure ������ Let a � a��a�c� � B doesn�t force b�c� � A� a�b� � E�a�b� � C� b�b� �� E �since b�c�#b�c��� a�b� � C�a�b� � C� b�c� � A� a�c� � E �otherwise b�a�#b�c�� contradiction to C�� �� A��c�c� �� E� a�c� � B � a�c� � B� By induction on the same argument we get� a�bk �

C� a�ck � B� This proves �i�� In particular �i���iii��

Page 74: Advanced Topics in Algorithms Shamir

�� CHAPTER �� LECTURE �

Next� assume b�c� � A� a�b� � C� Consider a new canonical #�chain

ab � a�b�#a�b�#a�b�# � � � albl � a�b�

�see Figure ������ If ca� �� E then ba�#bc but C�� �� A therefore ca� � E�aa� �� E� ac � B � a�c � B�The triangle a�bc has the same characteristics as the original triangle abc� By induction

we get that the triangle albc � a�bc has also the same characteristics� From �i� �with� a�

instead of a� we get a�c� � B�

Theorem �� Let A be an implication class of an undirected graph G � �V�E�� Exactlyone of the following alternatives holds�

� i A � �A � A��

� ii A �A�� � � A and A�� are transitive orientations of �A�

Proof� �i� Assume A�A�� �� � Let ab � A�A��� So ab#�ba� According to the de�nitionof #� for any cd � A� cd#�ab i� dc#�ba� Since #� is an equivalence relation and ab#�ba� cd#�dcand therefore dc � A� Thus A � �A�

�ii� Assume A �A�� � and let ab� bc � A� We shall now prove ac � A� Now ac �� E �ab#cb� cb � A� bc � A��� a contradiction� Thus ac � E� Let B be the implication classof G containing ac� and suppose A �� B�

Since A �� A�� and ab � A� the triangle lemma �iii� on triangle abc �with bc � A� ac �B� ab � C � A� gives us that there is no edge in A touching a�

But ab � C � A touches a� A contradiction�Therefore ac � A� A is transitive � A�� is transitive�Finally� A is an implication class of �A� so by Theorem � A and A�� are the only

transitive orientations of �A�

Corollary �� Each color class of an undirected graph G either has exactly two transitiveorientations� one being the reversal of the other� or has no transitive orientation� If in Gthere is a color class having no transitive orientation� then G is not a comparability graph�

����� Decomposition of Graphs

Let H� be a graph with n vertices v�� v�� � � � � vn and let H��H�� � � � �Hn be n disjoint graphs�The composition graph H � H��H��H�� � � � �Hn� is formed as follows�

For all � � i� j � n� replace vertex vi in H� with the graph Hi and make each vertex Hi

adjacent to each vertex of Hj whenever vi is adjacent to vj in H��

Page 75: Advanced Topics in Algorithms Shamir

���� COMPARABILITY GRAPHS ��

Formally� for Hi � �Vi� Ei� we de�ne H � �V�E� as follows�

V � �i��Vi

E � �i��Ei � fxyjx � Vi� y � Vj and vivj � E�gWe may also denote E � E��E�� E�� � � � � En�H� is called the outer factor of H�Hi� i � �� � � � � n are called the inner factors of H�

Theorem ��� Let G � G��G�� G�� � � � � Gn� where the Gi�s are disjoint undirected graphs�Then G is a comparability graph i� each Gi �� � i � n� is a comparability graph�

Proof����� It is obvious that if one of the Gi�s is not a TRO graph then G is not TRO����� Let F�� F�� � � � � Fn be transitive orientations of G�� G�� � � � � Gn� respectively� Let us

show that F � F��F�� F�� � � � � Fn� is transitive� Let ab� bc � F � if ab� bc � Fi then ac � Fi bytransitivity� If ab � Fi� bc � Fj� j �� i then we cannot have i �� �� j �� � since inner factorsare disjoint� If ab � Fi bc � F� then a � Gi so� since every vertex in Gi is connected to everyvertices in the factor in which c is contained in� then ac � F�� If ab � F� bc � Fi then c � Gi

so ac � F���and in both cases we get transitivity�A graph is called decomposable if it can be expressed as a non�trivial composition of some

of its induced subgraphs��For each graph there is the trivial composition� G � k��G���Formally� G � �V�E� is decomposable if there exists a partition V � V� � V� � � � � � Vr

of the vertices into nonempty pairwise disjoint subsets with � r jV j such that G �GR�GV �� GV �� � � � � GV r� for any set of representatives R � fx�� x�� � � � � xrg� xi � Vi�

Such a partition is said to induce a proper decomposition of G�

Page 76: Advanced Topics in Algorithms Shamir

� CHAPTER �� LECTURE �

Page 77: Advanced Topics in Algorithms Shamir

Chapter �

Lecture �Advanced Topics in Graph Algorithmsc�Tel�Aviv UniversitySpring Semester� ����

Lecturer � Ron Shamir

Scribe � Sariel Har�Peled

Lecture � � June �

��� Uniquely Partially Orderable Graphs

De�nition Given a graph H� with n vertices labeled fv�� � � � � vng and n disjoint graphs

H�� � � � �Hn� we denote by H � H�

hH��H�� � � � �Hn

ithe composition graph� resulting from

replacing each vertex in H�� vi� � � i � n by the graph Hi� and replacing all edges ij � E�H��by the edges connecting all the vertices of Hi with the vertices of Hj � That is V �H� � �ni��Viand E�H� � �ni��Ei � f�v� u�jv � Vi� u � Vj and �i� j� � E�g�

The graph H� is called the outer factor of H� and the graphs H�� � � � �Hn are called theinner factors of H�

Example �� See �gure ��� for an undirected example of a composition graph� See �gure��� for a directed example of a composition graph�

Theorem �� Given n � � undirected graphs G�� � � � � Gn� let G � G�

hG�� � � � � Gn

idenote

their composition graph� Then� G is a comparability graph if and only if� all the graphsGi� � � i � n are comparability graphs�

Proof� ���� Clearly� if one of the Gi� i � �� � � � � n is not a comparability graph� then Gcan not be a comparability graph�

��

Page 78: Advanced Topics in Algorithms Shamir

� CHAPTER �� LECTURE �

Figure ���� The composition graph of P��K��K�� C��

F1 F2 F3 F4

Figure ���� The composition graph of F��F�� F�� F��

Page 79: Advanced Topics in Algorithms Shamir

���� UNIQUELY PARTIALLY ORDERABLE GRAPHS ��

���� Let F�� � � � � Fn be transitive orientations of the graphs G�� � � � � Gn� let

F � F�

hF�� � � � � Fn

ibe an orientation of G� Given two edges a� b� b� c � F � We have to

show that a� c � F � One of the following hold�

� The vertices a� b� c � Vi� � � i � n� Since Fi is a transitive orientation it follows thata� c � F �

� The vertices a� b � Vi� c � Vj � i �� j� Then� it follows that i � j � F�� but thena� c � F �

� The vertices a � Vi b� c � Vj � i �� j� then i� j � F�� thus a� c � F �

� The vertices a � Vi� b � Vj � c � Vk� then i � j� j � k � F�� since F� is transitive itfollows i� k � F�� thus a� c � F �

Thus F is a transitive orientation of G�

De�nition A graph G � �V�E�� V � fv�� � � � � vng is decomposable if it can be presentedas a non�trivial composition of induced subgraphs of G� The trivial decompositions of Gare G � K�

hGi� G � G

hfv�g� � � � � fvng

i� A graph which has only trivial decompositions is

called prime�If there exists a partition of the vertex set of G� V � V� � V� � � � � � Vr� � r jV j�

such that G � GR

hGV� � � � � � GVr

i� where R is a set of r representatives from V�� � � � � Vr� then

we say the the partition induces a proper decomposition of G�

Example �� See �gure ��� for an example of various decompositions of a graph�

Theorem �� Let G�� � � � � Gn be n disjoint� undirected graphs� and let G � G��G�� � � � � Gn�be their composition� Let bA be a color class of G� then exactly one of the following holds�

� bA � Ej for a single value of � � j � n�

� bA � Ej � for all � � j � n�

Proof� Any color�class in G is� by de�nition� a connected subgraph of G� Assume thatbA � Ej �� for a vertex � � j � n� Look at an edge ab � bA � Ej� and let cd � E�G� be anedge� such that cd#ab� There are three possibilities�

�� The edge cd � Ek� k �� j� This is not possible� because internal edges of distinct innerfactors do not share a vertex�

Page 80: Advanced Topics in Algorithms Shamir

� CHAPTER �� LECTURE �

4 5

2

3

1

,2P[ ]

, ],P[3

3

1

4 5

2

P[ ],2

4 5

2

3

1

G

3 4 5

2

1

Figure ��� The decomposition of a graph

Page 81: Advanced Topics in Algorithms Shamir

���� UNIQUELY PARTIALLY ORDERABLE GRAPHS �

�� The edge cd is an external edge� This is not possible� because then the set C �fa� bg� fc� dg having three vertices� induce a triangle in G� contradicting the fact thatcd#ab�

Thus the only remaining possibility is that cd � Ej� and by the connectivity of bA � it followsthat bA � Ej �

De�nition Let G � �V�E� be an undirected graph� A set Y � V is called a module ora partitive set if for all x � V n Y either Y � Adj�x� � or Y � Adj�x�� The set Y is anon�trivial module if � jY j jV j�

Figure ���� Module in a graph

Example �� See �gure ��� for an example of a module in a graph�

Lemma �� The graph G possess a non�trivial module Y � V � if and only if G is decom�posable�

Proof� ���� Let G � G��G�� � � � � Gn� is a decomposition of G� with Gi � �Vi� Ei� a non�trivial inner factor� If x � Gj� j �� i then either Vi � adj�x� �if ij � E�� or vi � Adj�x� � �if ij �� E��� Hence Gi is a module�

���� If Y is a non�trivial module of G� then the division �

V � fv�g� fv�g� � � �� fvkg� Y

induce a proper decomposition of G�

Corollary �� A set of vertices Y � V in the graph G � �V�E� with � jY j jV j is amodule� if and only if there exists a proper decomposition of G � G��G�� � � � � Gn�� such that�there is an inner factor of G� Gi� � � i � n� such that Gi � GY �

Claim �� If Y is a set of vertices spanned by a color�class bA in the undirected graphG � �V�E�� then Y is a module�

Page 82: Advanced Topics in Algorithms Shamir

� CHAPTER �� LECTURE �

Proof� If Y � V or jY j � �� then the set Y is a trivial module of G�Else� let a be any vertex in V n Y � and assume that b � Y � Adj�a�� then ab � E n bA�

Since Y is de�ned by edges there exists a vertex c � Y such that bc � bA� The edge ac � Eexists �else� ba � bA�� The edge ac �� bA �else� a � Y ��

Given any vertex d � Y � let de � bA be an edge connected to d� Now� using the trianglelemma� it follows that ad � E� thus Y � Adj�a��

Claim �� An undirected graph G � �V�E� has at most one color�class which spans all ofV �

Proof� Assume that bA� bB are two distinct color�classes that both span V � Given anyvertex b � V � there are edges ab � bB� bc � bA� Since bA �� bB the edge ac � E�

Let bC be the color�class that contain the edge ac� If bC �� bA� bC �� bB� from the trianglelemma �iii�� it follows that no edge in bA is incident to the vertex a� A contradiction�

Thus bC � bA �� bB� and by the same argument no edge from bB is incident to the vertex c�A contradiction�

De�nition A comparability graph is uniquely partially orderable graph �abbreviated UPOgraph�� if it has only two transitive orientations� where each orientation is the reversal of theother�

Figure ���� Uniquely partially orderable graph

Example �� See �gure ��� for an example of a uniquely orderable graph

Corollary ��� A graph G is UPO i G have a single color�class�

Theorem ��� �Shevrin�Filippov ��� Let G be a connected comparability graph� Thefollowing conditions are equivalent�

�� The graph G is UPO�

Page 83: Advanced Topics in Algorithms Shamir

���� UNIQUELY PARTIALLY ORDERABLE GRAPHS

�� Every non�trivial module in G is an independent set�

�� In any proper decomposition of G� every inner�factor is an independent set Explicitly�all the edges in G are external�

Figure ��� A graph with a color class that induce all vertices

Proof� ��� �� �� Follow immediately from the natural equivalence between a moduleand a inner factor in a decomposition� as stated in corollary ����

If there is a non�trivial module Y � which is not stable� there is a decomposition of G�with inner factor GY � which is not stable�

If GY is an inner factor in a given proper decomposition� then Y is a module� thus if GY

is not stable� then the set Y is a non�stable module�

��� �� �� If G is UPO� then in G there is a color�class� bA� which contains all theedges of G� Thus by theorem ���� it follows that all the edges are external in any non�trivialdecomposition of G �because no non�trivial inner factor can contain all the edges of bA� thussuch an inner factor� has a n empty intersection with bA � E�G���

��� �� ��� Assume� for the sake of contradiction� that G is not UPO� Then G has morethan one color�classes �Since G is a comparability graph�� From claim ��� it follows thatthere is a color�class which spans a proper subset Y of V � By claim �� it follows that Y isa module of G� But Y is not a stable set �Y is de�ned as these vertices that are spanned bya color�class� which is connected�� A contradiction�

Corollary ��� A prime comparability graph G is UPO�

Proof� If G is not decomposable� then it must be connected� Condition �� in theorem���� holds trivially thus G is UPO�

Page 84: Advanced Topics in Algorithms Shamir

� CHAPTER �� LECTURE �

��� Characterizations and Recognition Algorithms

De�nition For the undirected graph G � �V�E�� a partition of E into k sets� E �cB� � cB� � � � � � cBk� is called a G�decomposition if Bi is an implication class of the graphG � �V� cBi � dBi�� � � � �� cBk�� See �gure ��� for an example�

A sequence of edges �x�y�� � � � � xkyk� is a decomposition scheme for G� if there exists aG�decomposition E � cB� � cB� � � � � � cBk� such that xiyi � cBi� i � �� � � � � k�

B1 B2 B3

C3C2C1

G

3

5

4

1

2

Figure ���� A graph G�decomposition

Example ��� The following are examples for the decomposition schemes for �gure ����

� For the top G�decomposition�

����� ���

����

����

������

� For the bottom G�decomposition�h��� �� �

i

Remark ��� A G�decomposition of a graph can have several decomposition�schemes� butthe decomposition scheme uniquely de�nes the G�decomposition� We will present algorithmsto calculate both�

See �gure �� for a description of the G�decomposition algorithm�

Page 85: Advanced Topics in Algorithms Shamir

���� CHARACTERIZATIONS AND RECOGNITION ALGORITHMS �

Algorithm construct G�decompositionInput� A graph G � �V�E��Output� A G�decomposition� A number k

k sets of edges of G� cB�� � � � � cBk�

begin

Let E� � E� i� ��

Loop�

Arbitrarily pick an edge ei � xiyi � Ei�

Enumerate the implication class Bi of Ei containing xiyi�

Let Ei�� � Ei n cBi�

if Ei�� � then

Let k � i�stop�

else

Increase i by ��go to Loop

end if

end construct G�decomposition

Figure �� � Algorithm to construct G�decomposition

Page 86: Advanced Topics in Algorithms Shamir

CHAPTER �� LECTURE �

Theorem ��� �Golumbic ��� Let A be an implication class of an directed graph G ��V�E�� Let D be an implication class in E n bA� One of the following holds�

�� D is an implication class in E� and A is an implication class in E n cD�

�� D � B � C� where C�B are implication classes in E� and G contain a triangle withedge taken from each implication class� A�B�C�

Proof� In the graph remaining after the removal of bA several implication classes of Gmay had been united� Let D be an implication class in E n bA� Assume that D is a union ofseveral implication classes of E� including B and C�

c a

A C

B c a

A C

B

b b

Figure ���� A triangle forcing the merge of two implication classes

Since B�C are two distinct implication classes in E� that were united in E n bA� thereexist edges ab� ac � E n bA such that ab � C� ac � B� bc � bA or ba � C� ca � B� bc � bA �see�gure ����� Assume without limiting generality that the former holds� since the second caseis the inverse of the �rst case�

If B � C�� then ba � B� It is known that ac � B but bc �� B� Thus B is not transitive�and using theorem � it follows that C�� � bB� explicitly B � C� A contradiction�

Thus bB � bC � and thus the triangle �abc have three�colors�Is it possible that D is a union of more than � implication classes� Assume that there is

another implication class F � distinct from B�C� in E n bA that is contained in D� From theabove discussion� it follows that there is a three color triangle with bA�F�B as its colors �See�gure ������ Now� using the triangle lemma it follows that triangles containing edges fromboth bA� bB� have their third edge from the same color�class� Thus D � B � C�

For the other case� suppose D is a single implication class in E� If A is not an implicationclass in E n cD� then there is a triangle with A and D as two of its edges� This triangleexist because where removing D from E� the implication class A was merged with anotherimplication class� Let A� denote the implication class in E �cD that contains the third edgeof the triangle �see �gure ������

But when removing A from E� this triangle implies the merge of the implication classesA��D into a single implication class� This contradicts the fact that D is an implication classin E n bA� Thus A is an implication class in E n cD�

Page 87: Advanced Topics in Algorithms Shamir

���� CHARACTERIZATIONS AND RECOGNITION ALGORITHMS �

B

A C

B

FA

Figure ����� The classes bF� bC must be equal�

c aB

CA

b

Figure ����� bA� cA� is an implication class in E n cD�

Corollary ��� If A is an implication class� such that A � bA� then there is no triangle withthree colors such that bA is one of its colors�

We leave this proof as an exercise� This claim implies� that for any triangle containingbA� the two other edges in the triangle are colored by the same color�

Corollary ��� If A is an implication of G � �V�E� such that A � bA then all the otherimplication classes of G are implication classes in E n bA�

Proof� By theorem ��� if E n bA contains two implication classes from E that wheremerged� then these two class with bA induce a three colored triangle in G� which is impossibleby Corollary �����

Theorem ��� �characterizations of comparability graphs� �Gilmore and Ho �man ����� Ghouilla�Houri �����

Let G � �V�E� be an undirected graph with G�decomposition� E � cB� � � � � � cBk� Thefollowing conditions are equivalent�

�� G is a comparability graph�

�� For all implication classes A of E� A �A�� � �

�� Bi �B��i � for i � �� � � � � k�

Page 88: Advanced Topics in Algorithms Shamir

CHAPTER �� LECTURE �

�� Any circuit v�v�� v�v�� � � � � vqv� in E not necessarily simple� such that vq��v� �� E�vqv� �� E and vi��vi�� �� E� i � �� � � � � q � � has even length�

De�ne a short chord or a triangular chord in a cycle to be a chord connecting twovertices which are distance � along the cycle� Condition � is equivalent to requiringthat every odd circuit in G contains a short chord�

Proof� ��� �� ��� Proved in theorem ����� �� �� By induction of k� For k � �� B� is an implication class in G and it is given

that B� �B��� � �

We assume the claim holds for all G�decomposition of graphs that include less than ksets� Speci�cally� the claim holds for E n cBi� Let D by an implication class of E n cBi� Bytheorem ��� two cases are possible�

� The class D is an implication class of E� then by the induction hypothesis it followsD �D�� � �

� D � B�C where B�C are implication classes in E� Then� D�D�� � �B�C�T�B���

C��� � �B�B�����C�C��� � � because B�C � and B�B�� � and C�C�� � by the induction hypothesis�

�� �� ��� Let E � cB� � � � � � cBk a G�decomposition of E such that Bi � Bi�� � �By theorem �� it follows that B� is transitive� If k � � then we are done� else assumecorrectness to all G�decomposition of less than k sets� It follows that F � B� � � � ��Bk is atransitive orientation of E n cB�� We have to prove that B��F is transitive orientation of G�Let ab� bc � B� � F � If both edges belong to B� or to F � then the edge ac exists and mustbelong to the corresponding set by the fact that both B�� F are transitive� Thus� assumethat ab � B� and bc � F � Since B� � B��

� � � if ac �� E then ab#cb thus cb � B� thusbc � cB� but bc � F by assumption� a contradiction� Thus ac � E�

Assume that ac �� B� � F � then ca � B� � F � there are two possibilities �

� If ca � B�� since ab � B� then cb � B�� a contradiction�

� If ca � F � since bc � F then ba � F � a contradiction�

Thus ac � B��F � In the same manner� if we assume that ab � F� bc � B� it follows thatac � B� � F � Thus B� � � � ��Bk is a transitive orientation of E�

��� �� ��� Assume that G is not a comparability graph� By the fact that ��� �� ���it follows that there exists v�v� � A � A�� �� � By the lemma ensuring the existence of acanonical implication chain� there is a canonical implication chain such that �

v�v�#v�v�#v�v�#v�v� � � �#vqvq��#vqvq�� � v�v��

Page 89: Advanced Topics in Algorithms Shamir

���� CHARACTERIZATIONS AND RECOGNITION ALGORITHMS �

The length of the chain is odd �because of its special structure�� and there is no shortchord between two vertices in cycle� because then vivi�� � #vi��vi���

For the other direction� assume that there is an odd cycle in the graph with no shortchords� then it holds �

v�v�#v�v�#v�v� � � �#vqvq��#vqv�#v�v�

is a canonical implication chain� Thus v�v� � A � A�� �� and G is not a comparabilitygraph�

De�nition Given an undirected graph G � �V�E� we de�ne a graph G� � �V �� E�� in thefollowing manner �

V � � f�i� j�� �j� i�jij � EgE� � f�x� y�� �y� z�jxz �� Eg

�Note that by our convention xx �� E so �x� y�� �y� x� for every xy � E�� An orientationof G� such that �x � y� y � z� imply that xz � E is called quasi�transitive orientation ofG�

Example �� See �gure ���� for an example of a graph and the resulting quasi�transitivegraph� The �gure omits some the edges of the form �ij� ji��

Theorem ��� �Ghouilla�Houri� ����� The following claims are equivalent�

�� The graph G is a comparability graph

�� The graph G have a quasi�transitive orientation�

�� The graph G� is bipartite�

Proof� ��� �� ��� Trivial� since G has a transitive orientation and this orientation is alsoquasi�transitive�

��� �� ��� Let F be a quasi transitive of G� and let C be an odd cycle� The cycle Cmust contain two adjacent edges in F � y � z� x� y and then because of the quasi�transitiveproperty xz � E� Thus ��� follows from theorem ���� since we found a short chord�

��� �� �� We will use GH characterization �Any odd cycle contains a short�chord��The vertices of a cycle in G� correspond to adjacent edges in G �with common vertex�� thatinduce a cycle in G with no short chords� Thus G� is bipartite �� G is a comparabilitygraph�

By the above theorem it is possible to check if a graph is a comparability graph� asfollows� Construct the graph G�� and check if it is bipartite� The size of G� is � jV �j � �jEj�and �

Page 90: Advanced Topics in Algorithms Shamir

�� CHAPTER �� LECTURE �

12 34

25 56

4554

65 52

32 2143

23

G

3

1 2 4

56

G

Figure ����� A graph G and its quasi�transitive graph G� �in G�� edges �x� y� � �y� x� arenot drawn�

Page 91: Advanced Topics in Algorithms Shamir

���� CHARACTERIZATIONS AND RECOGNITION ALGORITHMS ��

jE�j � jEj� �Xv�V

���nw� x ���wv � E� vx � E�wx �� Eo��� � O�jV j��

Thus the complexity of constructing the graph is O�jV j��� Check if G� is bipartite canbe performed in linear time in the size of G�� i�e� in O�jV j���

One can obtain a transitive orientation of G by taking the orientation of edges whosevertices belong to one part of the bipartite graph G�� In particular� G is UPO i� G� isconnected and bipartite� We shell give more e�cient algorithms for recognizing comparabilitygraph later in the course�

Page 92: Advanced Topics in Algorithms Shamir

�� CHAPTER �� LECTURE �

Page 93: Advanced Topics in Algorithms Shamir

Chapter �

Lecture �Advanced Topics in Graph Algorithmsc�Tel�Aviv UniversitySpring Semester� ����

Lecturer � Martin Golumbic

Scribe � Shimon Shahar

Lecture � June �

��� Some interesting graph families characterized by

intersection

���� Introduction

The topic of this lecture is intersection graphs� We shall focus mainly on F�graphs andtolerance graphs�

De�nition Let S � fTiji � Ig be a family of subsets of a set T� The intersection graph ofS is G � �S�E�� where

� S � fTigj �I� E � f�i�j� jTi � Tj �� g�

It was proved �Marczewski ������ that if we allow S to be an arbitrary family� thenwe obtain all the undirected graphs� Usually we are interested in families of sets withspeci�c topological properties� Moreover we should notice that some graphs were de�ned asintersection graphs �like line graphs�� and others were de�ned by their properties� and onlyafterwards were proved to be an intersection graph �for example triangulated graphs� wereoriginally studied as Ck�free graphs �k � � and only later characterized as intersection ofsubtrees��

Page 94: Advanced Topics in Algorithms Shamir

�� CHAPTER � LECTURE

���� Permutation graphs

De�nition A matching diagram consists of n points� on each of two parallel lines� and nstraight line segments matching the points� The intersection graph of the line segments iscalled a permutation graph �See Fig� ���� If the endpoints on the line are numbered ����� � �n�then the endpoints on the other side of the line are numbered by a permutation on f���� � ��ngdenoted �

1

2

3

4

5

6 5

3

4

2

6

1

2 1 3

4 6 5

Corresponding permutation graphmatching diagram

Figure ��� A permutation graph for the permutation �����������

Remark �� It is easy to build the permutation graph directly from the permutation��i� j �i j and �i� � �j�� � �i� j� � E�

Theorem �� A permutation graph G � �V�E� is transitively orientable�

Proof� Let be the permutation of f�� � � � � ng generating G � �V�E�� where V �f�� �� � � � � ng� For every �i� j� � E� de�ne F as follows �

�i� j� � F i� i j�We shall prove that D � �V� F � is transitively orientable�Let �i� j� � F� �j� k� � F � then by Remark ��� since �i� j� � E� then ���j� ���i�� and

���k� ���j�� Hence ���k� ���i�� and therefore �i� k� � F �which implies F is a transitive orientation �See �g� ����

Page 95: Advanced Topics in Algorithms Shamir

���� SOME GRAPH FAMILIES CHARACTERIZED BY INTERSECTION ��

1

2

3

4

5

6 5

3

4

2

6

1

matching diagram Corresponding permutation graph

2 1 3

4 6 5

Figure ��� An orientation on a permutation graph

De�nition If is a permutation� we say that � is the opposite permutation� meaning that�i� � ��n� �� i�� For example � �� � � � � ���� � �� � � � � ���

Theorem �� If G is a permutation graph generated by � then �G is also a permutationgraph� generated by ��

Proof� We shall prove that the graph H � �V� F � generated by � is �G�For every i�j�V� �i� j� � E i� �i�j�����i� � ���j�� �� But since ����i� ����j� i�

���i� � ���j� and �i�j��F i� �i�j������i�� ����j�� �� � we obtain that �i�j��E � �i�j� ��F�so H� �G�

Theorem �� Pnueli Lempel Even ���� G is a permutation graph i� both G and �G aretransitively orientable�

Proof�

� Trivial from the previous two theorems�

� Wasn�t proved in class�

Page 96: Advanced Topics in Algorithms Shamir

� CHAPTER � LECTURE

1 4

5

3

1

6

2

6

5

4

3

2

2

4 3

5

1 6

Corresponding F-graph

Function Diagram

Figure �� An F�graph

���� F �Graphs

De�nition An F�diagram consists of n points� on each of two parallel lines� and n continuousfunction curves ending in the points� The intersection graph of the functions segments iscalled a function graph� or an F�graph �See Fig� ��� Note the requirement that each curvesegment is a function �See Fig� �� for negative example��

�The air controllers strike�

Given two collections of cities lying on two parallel lines� and a collection of �ight pathsbetween them� assign an altitude to each �ight so that no crashes occur� It is easy to seethat if we take the intersection graph of the paths� we obtain an F�graph �assuming thatno �ight is going backwards�� We should assign di�erent altitude only for those �ights thatintersect� Therefore we can consider each altitude to be a color� and we should solve thecoloring problem for that F�graph �See Fig� ���� Note that if all �ight paths are straightlines� then the resulting graph is a permutation graph�

A composition of permutation diagram

We can think of F�graph as if it was constructed from few partial orders �each of them is apermutation on the vertices�� Therefore we can construct the F�graph from the compositionof these partial orders� �See Fig� ���

Page 97: Advanced Topics in Algorithms Shamir

���� SOME GRAPH FAMILIES CHARACTERIZED BY INTERSECTION ��

A

2

1

3

4

5

6

5

1

6

4

2

3

Not a function diagram -point A has two values

Figure ��� Not an F�graph�point A have two values of the function�

Theorem �� Golumbic Rotem Urrutia �� �Let G be an undirected graph� The following statements are equivalent�

� G is an F�graph�

� G is the intersection graph of a composition of permutation diagrams�

� �G is transitively orientable�

Proof�

���� ��� Trivial� each piecewise�linear path �connecting the point numbered i in all the orders��is a continuous function� Therefore it is an F�Graph�

���� �� We shall de�ne H � �V� F � an orientation of �G as follows � �i�j� �F if the i�th path inthe diagram is completely below the j�th path� More formally �

�i�j��F if � x fi�x� fj�x� and �j�i� if � x fj�x� fi�x�� otherwise the edge is not inF �

If �i� j� � E� than obviously the function fi�x� � fj�x� changes sign at least once�Therefore �i�j� �� F � and vice versa� So F � �E� We should now prove that F istransitive orientation for �G�

Page 98: Advanced Topics in Algorithms Shamir

� CHAPTER � LECTURE

Birmingham

Nashville

Indianapolis

Chicago

Milwakee Albany

Newark

Philadelphia

Baltimore

Richmond

Wilmington

Charleston

Figure ��� The air controllers strike problem�

Page 99: Advanced Topics in Algorithms Shamir

���� SOME GRAPH FAMILIES CHARACTERIZED BY INTERSECTION ��

If �i� j� � F � and �j� k� � F � then � �xfi�x� fj�x� fk�x��

� �i� k� � F �

��� ��� Let F be a transitive orientation of �G� We can choose �l�� l�� � � � lk� to be a realizer ofF� For each line order li we assign the points of its permutation in the correspondingorder on the i�th horizontal line �See �g� ��� For i������ � ��n connect all pointscorresponding to i by straight line segment� The resulting structure is a functiondiagram�

Now� by the de�nition of the realizer� �i�j��F i� for every order lk i�j appear in thesame order �i�e� either for all k i lk j or for all k j lk i�� Hence �i�j� ��F i� the pathsof i and j intersect� Hence G is an F�graph�

���� Tolerance graphs

De�nition Let I � fI�� I�� � � � Ing be a collection of line segments� and let T � ft�� t�� � � � tnga set of positive numbers� The tolerance graph G � �V�E� of �I�T� is de�ned as follows �

V � fv�� � � � � vngE � f�i� j�jjIi � Ijj min�ti� tj�g �See Fig� ���

Interval graphs as a subset of tolerance graphs

The family of tolerance graphs is a generalization of the interval graphs� They are usuallyused for more general scheduling problems� where we allow things to happen simultaneously�

Given an interval graph G � �V�E� whose realization is I � fI�� I�� � � � � Ing� we canconstruct an isomorphic tolerance graph in the following manner �

T � �V�E� the tolerance graph of �I�X��de�ne X�i� j� � jIi � Ijj� if Ii � Ij �� C � minfXi� j�j�i� j� � Eg Now let I�fI�� I�� � � � � Ing and T�ft�� t�� � � � � tng where

ti � C�� for all i� We claim that G is the tolerance graph of �I�T�� Two line segmentsintersect in the original interval graph� i� the intersection length is bigger than C$�� thereforethe edge sets of the two graphs coincide�

The following lemma will be used in the next theorem �

De�nition G��V�E� is an interval containment graph if there exists a set of intervalsfIugu�V such that �u�v��E� �IuisinIv or vice versa��

Lemma �� G is a permutation graph if and only if it is a interval containment graph�

Page 100: Advanced Topics in Algorithms Shamir

��� CHAPTER � LECTURE

2

3 1 5 7

6 4

6

5

4

3

2

1

7

4

1

5

2

6

3

4

5

7

1

2

6

3

7

Corresponding graph

Composition of permutations

Figure �� The composition of permutation diagrams�

0 1 2 3 4 5 6 7 8 9 10

Line realization

Tolerances : { T(A) = 2, T(B) = 1, T(C) = 0,

T(D) = 0.5, T(E) = 1.5}

E D

B C

Notice : (A,E) is not an edge, because itsintersection is less than min(2,1.5) .

The intervals of vertices A-E appear in

their alphabetic order, from top to bottom.Corresponding graph.

A

Figure ��� A tolerance graph�

Page 101: Advanced Topics in Algorithms Shamir

���� SOME GRAPH FAMILIES CHARACTERIZED BY INTERSECTION ���

Proof� Both sides wasn�t proved in class�

Theorem �� G is a tolerance graph with ti � jIij� if and only if G is a permutation graph�

Proof�

� The proof is based on a the previous lemma� So all we have to do is to prove that Gis an interval containment graph�

Let G be a tolerance graph with ti de�ned as above� If �i� j� � E then either Ij containsIi� or vice versa� Using the previous theorem� our theorem is proved�

� If G is a permutation graph� than it is a line containment graph� therefore we canrealize it with a tolerance graph with tolerances de�ned as above�

���� Bounded and unbounded tolerance graphs�

If for a vertex i ti � jIij� than we can enlarge ti as much as we want� without a�ecting thegraph� Any interval which intersects Ii will have a common intersection with Ii not longerthan ti� so in this case an edge �i�j� will be in the graph if and only if jIi � Ijj tj� Vi willbe called a vertex with unbounded tolerance� If G is a tolerance graph� in which no vi is ofunbounded tolerance� we call G a bounded tolerance graph�

Theorem �� Let G be a bounded tolerance graph� then is an F�graph�

Proof� Wasn�t proved in class�

Page 102: Advanced Topics in Algorithms Shamir

��� CHAPTER � LECTURE

0 1 2 3 4 5 6 7 8 9 10

Line realization

Tolerances : { T(A) = 2, T(B) = 1, T(C) = 0,

E D

A B C

Corresponding graph.

T(D) = 0.5, T(E) = 5}

Notice : (A,E) is not an edge, because itsintersection is less than T(A)

The intervals of vertices A-E appear in

alphabetic order, from top to bottom.

Figure � � An unbounded tolerance graph�

Page 103: Advanced Topics in Algorithms Shamir

Chapter �

Lecture �Advanced Topics in Graph Algorithmsc�Tel�Aviv UniversitySpring Semester� ����

Lecturer � Ron Shamir

Scribe � Muafaq Tannous

Lecture � � June �

�� Comparability Graph Recognition

In lecture we discussed characterization of comparability graphs� and we proved a theorem� TRO theorem � that characterizes comparability graphs� We described an algorithm thatconstructs G�decomposition� By combining the TRO theorem with the G�decompositionconstruction we obtain an algorithm that recognizes comparability graphs and generates atransitive orientation the graph if it is TRO� The algorithm is shown in �gure ���

�� initialize i�� �� Ei �� E�F �� �� arbitrarily pick an edge xiyi � Ei

�� enumerate the implication class Bi of Ei containing xiyiif Bi �B��

i � � then add Bi to Felse stop �G is not TRO�

� Ei�� �� Ei � �Bi

�� if Ei�� � � then output F and stopelse i�� i� � go to �

Figure ���� Code of The TRO Algorithm

��

Page 104: Advanced Topics in Algorithms Shamir

��� CHAPTER � LECTURE

ba

d

f

e

c

Figure ���� Example �

Example� Let us run the algorithm on the graphs shown in �gures ���� �� and ���� Therun of the algorithm on the �rst graph will be as the following �

a

b

edc

Figure ��� Example �

Initialize � E� � E � fab� ba� ae� ea� af� fa� ad� da� bc� cb� ce� ec� cf� fc� ea� aeg� F � � Af�ter the �rst iteration we have x�y� � ab�B� � fab� ad� af� ae� cb� cf� ce� cdg� F � B�� E� � �so the graph is TRO�

The execution of the algorithm on the second graph will be the following �

a b

c

d

e

Figure ���� Example

Initialize �

E� � fac� ca� ae� ea� ad� da� ab� ba� cb� bc� eb� be� cd� dc� db� bdg� F � �

Page 105: Advanced Topics in Algorithms Shamir

��� THE COMPLEXITY OF COMPARABILITY GRAPH RECOGNITION ���

After the �rst iteration we have�

x�y� � ac�B� � fac� ab� ad� aeg� F � fac� ab� ad� aeg� E� � fdc� cd� ba� ab� be� eb� de� edg�After the second iteration

x�y� � bc�B� � fbc� bd� ba� beg� E� � fcdg� F � fac� ab� ad� ae� bc� bd� ba� beg�E� � fcdg�After the third iteration

x�y� � dc�B� � fdcg� F � fac� ab� ad� ae� bc� bd� ba� be� dcg� E� � �Thus the graph is TRO�The execution of the algorithm on the second graph will be the following �Initialize � E� � fab� ba� bc� cb� cd� dc� de� ed� ea� aeg� F � � After the �rst iteration we

have x�y� � ab�B� � fab� ae� cb� cd� ed� ea� ba� bc� dc� deg� B� � B��� �� � so the graph is not

TRO�The edges we choose in step ��� in the algorithm determine which transitive orientation

of the set of transitive orientations of the graph will be the output of the algorithm� If werun the algorithm several times� and in every time we choose di�erent edges in step ��� wemay get di�erent transitive orientations� but one can prove that the number of iterations ofthe algorithm in every run will be the same�

�� The Complexity of Comparability Graph Recogni

tion

����� Implementation

We shall show that the complexity of the above algorithm is O� jEj� time and O�jEj� jV j�space� where is the maximum degree of a vertex� and we�ll give the implementation ofthis algorithm that gives such complexity� Let G�V�E� be an undirected graph with V �fv�� v�� � � � � vng� The algorithm uses a function called CLASS�i� j�� which is de�ned as thefollowing � CLASS�i� j� � �� if vivj �� E� CLASS�i� j� � k� if vivj has been assigned toBk� CLASS�i� j� � �k� if vjvi has been assigned to Bk� or unde�ned� if vivj has not beenassigned yet�

Let di be the out�degree of vi after directing the graph G�The algorithm gets as an input graph G�V�E� such that V � fv�� v�� � � � � vng and its

adjacency sets such that j � Adj�i� i� vivj � E� The output of the algorithm �

�� a variable FLAG which tells if G is a comparability graph� FLAG � � i� G iscomparability graph�

Page 106: Advanced Topics in Algorithms Shamir

�� CHAPTER � LECTURE

�� if FLAG � � then the transitive orientation that was found by the algorithm is theunion of all edges having positive CLASS�

The algorithm consists of two subroutines� the EXPLORE procedure which is shown in�gure ���� and the main procedure which is shown in �gure ���

The set of edges explored in iteration k is denoted Bk� In iteration k� the algorithmchooses an edge e that has not been assigned to any Bi� i k� and start exploring from e�If Bk �B��

k �� then the value of the variable FLAG will be changed from � to ��

����� Complexity Analysis

The input graph G is represented by adjacency lists� The adjacency sets are stored as linkedlists sorted in increasing order and every element of the list represents a vertex� Each elementin the linked list Adj�i� is described by four �elds� For every edge vivj in G there are twoelements as shown in �gure ����

�� j

�� CLASS�i� j�

� pointer to CLASS�j� i�

�� pointer to next element on Adj�i�

This data structure requires O�jV j � jEj� space� Let us compute the time complexityof the algorithm� In executing the �for� command in EXPLORE�i� j� we use two pointers�one points to Adj�i� and the other points to Adj�j�� These two pointers will scan these twosets in parallel looking for a vertex m which satis�es the condition of the �for� command andthen the value of CLASS will be updated� The loop will take O�di � dj�� The complexityof the second loop is similar because it is executed in the same way� The algorithm calls theprocedure EXPLORE twice for every edge� hence the time complexity of the algorithm is

CX

vivj�E

�di � dj� � O� jEj�

In summary �

Theorem �� Comparability graph recognition and �nding a transitive orientation can bedone in O� jEj� time and O�jV j� jEj� space� where is the maximum degree of a vertex�

Page 107: Advanced Topics in Algorithms Shamir

��� THE COMPLEXITY OF COMPARABILITY GRAPH RECOGNITION ���

procedure EXPLORE�i�j��for each m � Adj�i� such that m �� Adj�j� or jCLASS�j�m�j k do

beginif CLASS�i�m� is unde�ned then

beginCLASS�i�m��� k�CLASS�m� i��� �k�EXPLORE�i�m��

endelse

if CLASS�i�m� � �k thenbegin

CLASS�i�m��� k�FLAG�� ��EXPLORE�i�m��

endend

for each m � Adj�j� such that m �� Adj�i� or jCLASS�i�m�j k dobegin

if CLASS�m� j� is unde�ned thenbegin

CLASS�m� j��� k�CLASS�j�m��� �k�EXPLORE�m� j��

endelse

if CLASS�m� j� � �k thenbegin

CLASS�m� j��� k�FLAG�� ��EXPLORE�m� j��

endend

return

Figure ���� Procedure EXPLORE

Page 108: Advanced Topics in Algorithms Shamir

�� CHAPTER � LECTURE

begininitialize � k �� ��FLAG�� ��for each edge vivj in E do

if CLASS�i� j� is unde�ned thenbegin

k �� k � ��CLASS�i� j��� k�CLASS�j� i��� �k�EXPLORE�i� j��

endend

Figure ��� The main procedure of the algorithm

j

i -k

kADJ(i)

ADJ(j)

CLASS(i,j) = k

Figure ���� Two elements for each Edge�

Page 109: Advanced Topics in Algorithms Shamir

��� COLORING AND OTHER PROBLEMS ON COMPARABILITY GRAPHS ���

As we de�ne the procedure EXPLORE it explores the edges in a depth��rst search� wecan change the algorithm to breadth��rst search by storing the edges in queue �instead ofstack�� then it will run in the same time and space complexity�

There are several di�erent algorithms that solve the TRO recognition problem� Untilrecently� the time complexity of the best known algorithm was due to Spinrad and hascomplexityO�n����� In ���� McConnel and Spinrad found an algorithm that in O�m�n log n�constructs an orientation F in the graph G such that if G is a comparability graph then Fis transitive� There is an algorithm that decide if F is transitive in O�n����������

�� Coloring and Other Problems on Comparability

Graphs

����� Comparability Graphs Are Perfect

On a directed and acyclic graph G�V� F �� de�ne a strict partial ordering of vertices� namely�x � y i� there is nontrivial path in F from x to y� A height function h can be de�ned onsuch graphs � h�v� � � if out�degree of v is �� h�v� � ��maxfh�w�jvw � Fg� An example ofh�v� is shown in �gure �� � Here in subsequent �gures we use Hasse diagram of the partiallyordered set� i�e� all edges are pointing upwards and transitive edges are omitted�

1

2

3 2

1

0

Figure �� � Example �

h�v� is equal to the number of vertices in the longest path from one of G roots to v� h�v�can be computed in linear time using BFS� The function h gives a proper vertex coloringof G� because for every v and u if vu � F then h�v� h�u�� but it is not necessarily aminimum coloring� For a graph G which is undirected� for any acyclic orientation F � thecorresponding h will be a proper vertex coloring of G� We now prove that if G is transitivethen h is an optimal coloring�

Theorem �� Every comparability graph is a perfect graph�

Page 110: Advanced Topics in Algorithms Shamir

��� CHAPTER � LECTURE

Proof� Let F be a transitive orientation of a comparability graph G�V�E�� Every pathin F corresponds to a clique of G� because of transitivity� and every clique corresponds toa path� hence the function h is a proper vertex coloring of G that uses exactly ��G� colors�this is an optimal vertex coloring because � �� Because of the hereditary property ofcomparability graphs we �nd that ��GA� � ��GA� for all induced subgraph GA of G� so Gis a perfect graph�

Let �X��� be a partially ordered set� A subset of X that is completely ordered is calledchain� A subset in X that doesn�t contain two members comparable by is called antichain�

The sets fc� e� ag� fd� g� bg� ff� bg are chains in the partial order shown in �gure ���� thesets fc� dg� fe� f� gg are antichains in the same partial order�

a e b g

dfc

Figure ���� Example �

A Hasse diagram is a compact representation of a transitive order� For a partially orderedset �V� F �� the Hasse diagram is �V�H� where H � F and uv � H i� uv � F and there isno m � V s�t� um � V�mv � V � The edges of Hasse diagram is drawn without the directionarrow� with the convention that all edges are pointing up� For example the Hasse diagramof the graph in �gure ��� is in �gure �����

a e b g

f dc

Figure ����� Example

Theorem �� Dilworth ���� Let �X��� be a partially ordered set� the minimum numberof chains needed to partition cover X is equal to the maximum cardinality of a antichainin X�

Proof� �X��� corresponds to comparability graph G which is a perfect graph� hencek�G� � ��G�� k is equal to the minimum number of chains needed to partition X� because

Page 111: Advanced Topics in Algorithms Shamir

��� COLORING AND OTHER PROBLEMS ON COMPARABILITY GRAPHS ���

a vertex set S induces a clique in G i� there is a path in X passing through all vertices in S�� is equal to the maximum cardinality of an antichain� So� the minimum number of chainsneeded to partition X is equal to the maximum cardinality of antichain�

For example consider the partial order that is shown in �gure ���� The number of chainswhich partition the partial order is � also� the maximum cardinality of antichains is �

Corollary �� In a comparability graph with transitive orientation F � optimal proper col�oring and maximum clique can be calculated in O�jEj � jV j� time�

We shall illustrate this by solving a slightly more general problem�

����� Maximum Weighted Clique

For a given undirected graph G and an assignment of a weights w�v� to each vertex� theproblem is to �nd a clique in G for which the sum of the weights of its vertices is largest�The algorithm calculates for every vertex v the value W �v� which is the sum of weights ofevery vertex in the heaviest path from v to one of the graph sinks� A pointer is assigned tov designating its successor on that heaviest path�

Input � a transitive orientation F of a comparability graph G�V�E� and a weight functionw de�ned on V �

Output � a clique K of G whose weight is maximum�

The algorithm uses two subroutine� the EXPLORE procedure which is shown in �gure����� and the main procedure which is shown in �gure �����

Proving the correctness of the algorithm and displaying an implementation whose com�plexity is linear are left as exercises�

After running the algorithm on the graph that its Hasse diagram is shown in �gure ���we will have W �a� � ��W �b� � �W �c� � ���W �d� � ��W �e� � ���W �f� � ��W �g� ���� POINTER�a� � null� POINTER�b� � a� POINTER�C� � b� POINTER�d� � null�POINTER�e� � f� POINTER�F � � null� POINTER�g� � e and the maximum weightclique is f� e� g�

����� Calculating ��G�

We shall show a polynomial�time method for �nding ��G� for a comparability graph G� Themethod gets as an input a graph G�V�E� and a transitive orientation F � We transform Finto a transportation network by adding two new vertices s and t and edges sx and yt foreach source x and sink y� Then we assign a lower bound � on the �ow through each vertex�We compute a minimum��ow� which is a polynomial problem� The value of such �ow will

Page 112: Advanced Topics in Algorithms Shamir

��� CHAPTER � LECTURE

procedure EXPLORE�v��if Adj�v� � then

W �v� � w�v��POINTER�v� �� ��return�

else for all x � Adj�v� doif x is unexplored then

EXPLORE�x��end for all�select y � Adj�v� such that W �y� � maxfW �x�jx � Adj�v�g�W �v��� w�v� �W �y��POINTER�v��� y�return�

end�

Figure ����� Procedure EXPLORE

procedure MAXWEIGHT CLIQUE�V� F ��for all v � V do

if v is unexplored thenEXPLORE�v��

end for all�select y � V such that W �y� � maxfW �v�jv � V g�K �� y�y �� POINTER�y��while y �� � do

K �� K � fyg�y�� POINTER�y��

return�end�

Figure ����� The main procedure of the algorithm

Page 113: Advanced Topics in Algorithms Shamir

��� THE DIMENSION OF PARTIAL ORDERS ��

c

b

a

f

g

e

d

w=1

w=6

w=5 w=2

w=7

w=3

w=4

Figure ���� Example �

equal to k�G�� the size of the smallest covering of the vertices by cliques� This value isequal to ��G�� the maximum cardinality independent set since every comparability graph isperfect�

�� The Dimension of Partial Orders

Every partial order �X�P � can be extended to a linear order �also called its topological order��Such an order is called a linear extension of P � Let L�P � be the set of linear extensions ofP � A subset L � L�P � that satis�es

Tl�L l � P is called a realizer of P � and its size is jLj�

Example� The orders L� � �a� b� c� d� e��L� � �a� c� b� e� d��L� � �a� b� c� e� d�� are linearextensions of the partial order in �gure ����� fL�� L�g is realizer of this partial order�

d

b

a

c

e

Figure ����� Example

A realizer of partial order P with the smallest size is called a minimum realizer� Thedimension of partial order P � dim�P � is the size of a minimum realizer of P �

The dimension of the partial order in �gure ���� is ��

Remark �� P is a complete order i� dim�P � � ��

Page 114: Advanced Topics in Algorithms Shamir

��� CHAPTER � LECTURE

e

f

b

d

x

c’ e’

f’

d’

b’

a’

P’P

c

a

Figure ����� Example �

Example� The orders

L� � �a� x� b� c� d� e� f� a�� b�� e�� d�� c�� f ��� L� � �a�� x� b�� c�� d�� e�� f �� a� b� e� d� c� f�

are linear extensions of the partial order P in �gure ����� fL�� L�g is the realizer of P �dim�P � � �� And

L�� � �b�� e�� d�� c�� f ��� L�

� � �b�� c�� d�� e�� f ��

are linear extensions of P � in �gure ����� fL��� L

��g is the realizer of P �� dim�P �� � ��

Example� The orders L� � �a� b� c�� c� b�� a��� L� � �b� c� a�� a� c�� b��� L� � �c� a� b�� b� a�� c��are linear extensions of the partial order P in �gure ���� fL�� L�� L�g is realizer of P � anddim�P � � � To Show this� let us assume that dim�P � � �� then there are two linearextensions l�� l�� that in one of them� say l�� the elements �a� b� c� will be ordered� a� b� c�Then in l� these three elements must be ordered� c� b� a � l� must contain the subsequenta� b� c� b�� a� and l� must contain the subsequent c� b� a� b� so we see that both extensions haveb� b�� a contradiction�

Lemma �� Let �X�P � be partial order� For every subset Y of X� Y � X we havedim�PY � � dim�PX�

Proof� Let L be a realizer of P � Restricting L to the elements of Y yields a realizer ofPy� L is a minimum realizer for P so dim�PY � � dim�P �

Theorem �� Hiraguchi ���� Let P � P��P�� P�� � � � � Pk� be a composition of a disjointpartial orders �Xi� Pi� i � �� �� � � � � k then dim�P � � maxfdim�Pi�j� � i � kg

Page 115: Advanced Topics in Algorithms Shamir

��� THE DIMENSION OF PARTIAL ORDERS ���

c’ b’ a’

a b c

P

Figure ���� Example ��

Proof� Let m � maxfdim�Pi�j� � i � kg and fLi�� Li�� � � � � Limg be a realizer of Pi�De�ne �i � Loj�L�j� L�j� � � � � Lkj �� then f�j jj � �� �� � � � �mg is a realizer of P � so dim�P � �m� every Pi is a subset of P � so dim�P � maxfdim�Pi�� � � i � kg �� dim�P � �maxfdim�Pi�� � � i � kg

For an example see �gure �����

1P

2 3

1

LL

11

12

= {1,2,3}= {1,3,2}

P

LL

0

01

02 ={ba}={ab}

a b

P2

L

L21

22 ={6,5,4}

={5,6,4}

4

5 6

P

42 3

1 5 6

L

L1

2

= 1,2,3,5,6,4

= 6,5,4,1,3,2

Figure ����� Example ��

Theorem �� Dushnik�Miller� ���� Let G be a comparability graph of poset P� dim�P � �� i� G the complement graph of G� is a comparability graph�

Proof�

Page 116: Advanced Topics in Algorithms Shamir

�� CHAPTER � LECTURE

� � Let F be a transitive orientation of G� Consider the graph G��V�E �� when E� � P �F �This graph satis�es �

�� for every a� b � V either ab � E� or ba � E��but not both�

�� G� is transitive

To prove �� note that if ab� bc� ca � E�� it is obvious that ab� bc� ca cannot be in thesame set �all in F or all in P �� because F�P are transitive� So� two of these three edgesare in the same set �F or P �� say bc� ab� ab � F and by transitivity of F � we see thatac � F so ca �� P � ��� and ��� imply that G� is a complete order on V � Because of thesame reasons we know that G���V�E��� when E�� � P � F�� is a complete order on V �L � fP � F�P � F��g is a realizer of P because if ab � P then ab � P � F�P � F���and if ab �� P then either ab � F and ab �� F��� or ab � F�� and ab �� F � Hencedim�P � � ��

� � Assume that dim�P � � �� Let L � fl�� l�g be a realizer of P � De�ne F � l� � P ��l� � P��� �the equality holds because L is a realizer� To calculate l� � P we look atl� as a complete directed graph and remove all the edges from P � see �gure ��� �

l‘ = y x a g b e d c f

l = g a x y b c d e f

f

F = l - Pi

b

c ed

y x a y

L = { l , l‘}

f

d ec

b

y x a g

P

Figure ��� � Example ��

We will show that F is a transitive orientation of G� assume that ab� bc � F and ac �� F �Then ac � P � ab� bc � F �� ba� cb � l� �� ca � l� �� ca � P contradiction � hence F istransitive�

Corollary �� Let G be a comparability graph of poset P � dim�P � � � i� G is a permutationgraph�

Page 117: Advanced Topics in Algorithms Shamir

��� THE DIMENSION OF PARTIAL ORDERS ���

Proof� We will give two proofs �

�� dim�P � � � from the previous theorem �� G is a comparability graph� From thetheorem of Pnuely�Even�Lempel ������� G�G are comparability graphs �� G is apermutation graph�

�� let us look at the matching diagram of permutation graph�see �gure ������

4

3

5

2

1

1 5

2 3 45

4

3

2

1

52 3 1 4

542 31

Figure ����� Example �

�i� j� � E �� �����i� � ����j�� i j��Hence� the complete orders l� � �n� n � �� � � � � ��and l� � �������� ������� � � � � ����n�� is a realizer of P � so dim�P � � �� Conversely� from therealizer fl�� l�g we can construct the matching diagram in the same way�

The theorem of Dushnik�Miller tells that for two partial orders which have the samecomparability graph� the dimension of both � � or the dimension of both � ��

c

a

e

b

d

G

e

b

a

d

cP P‘

a

e

b

c

d

Figure ����� Example ��

Page 118: Advanced Topics in Algorithms Shamir

�� CHAPTER � LECTURE

Theorem �� �Trotter� Moore� Sumner ����� Gysin ����� Two partial orderswhich have the same comparability graph have the same dimension�

Figure ���� gives an example of two partial orders that have the same comparabilitygraph�

The problem of calculating the dimension of partial order mentioned as a major openproblem in the Garey and Johnson book� In �� �� Yannakakis proved that the problem isNPC� In addition he proved deciding if dim�P � � k� is NPC� for every k �

%

Page 119: Advanced Topics in Algorithms Shamir

Chapter �

Lecture �Advanced Topics in Graph Algorithmsc�Tel�Aviv UniversitySpring Semester� ����

Lecturer � Ron Shamir

Scribe � Michael Seltser

Lecture �� � June ��

���� Comparability invariants

In lecture & � we quoted the following theorem�

Theorem �� � Trotter� Moore� Sumner ������� Gysin ������ � If two partialorders have the same comparability graph then their dimensions are same�

Hence� the dimensions of all posets which have the same comparability graph is the same�This leads to the following de�nition�

De�nition Let � be a property of partially ordered sets �posets�� Then for poset P� �P� �� � if � holds on P and ��P � �� � otherwise� Property � is called comparabilityinvariant �CI� if for every two posets P�P � G�P � � G�P �� implies ��P � � ��P ���

Some of the known comparability invariants are� the dimension� length of maximumchain �because it is ��G��� minimum number of chains � or anti�chains � needed for coveringof P �because they are k�G�� ��G� in correspondence�� and the number of linear extensionsof P �

In ���� Brightwell and Winkler showed that the problem of counting the number of linearextensions of a poset is &P � complete�

De�nition Let P � �V�E� be poset� L � �V�E�� is linear extension� Without loss ofgenerality order for E � is v� v� � � � vn� The jump number �JP� of L is the number of

���

Page 120: Advanced Topics in Algorithms Shamir

��� CHAPTER ��� LECTURE ��

pairs �vi� vi��� such that fvi� vi��g �� E �

More generally�J�P�L� �j fi j �L���i�� L���i� ��� �� Eg j

The jump number of P is the least jump number over all linear extensions of P i�e�

J�P � � minfJ�P�L� j L is a linear extension of Pg�The jump number is known to be a comparability invariant� In ���� Syslo proved that

calculating J�P � is NP � complete�

Theorem �� � Habib� ������ � Property � is comparability invariant i� the followingis true�

� ��P � � ��P��� � poset P �

� Let P � P��P�� � � � � Pm�� Q � Q��Q�� � � � � Qm� be proper decompositions andG�Pi� � G�Qi�� � � i � m� If ��Pi� � ��Qi� �i� then ��P � � ��Q��

De�nition Let P� � � V�� � �� P� � � V�� � � be posets where V�� V� are disjoint� Thenwe�ll de�ne a parallel composition of P�� P� by P� � P� � � V� � V�� � � where

x � y� ��x� y � V�� x � y� � �x� y � V�� x � y���

The serial composition of P�� P� is P� � P� � �V� � V�� �� where

x � y � ��x� y � V�� x � y� � �x� y � V�� x � y� � �x � v�� y � v����

Thus� P� � P� � �K��P�� P��� P� � P� � P��P�� P���

De�nition A poset P � �V � � is called series parallel �SP� if either j V j� � or one canderive it from any series parallel posets P�� P� by parallel or series compositions�

For examples see Figure �����

De�nition A graph is called cograph if it is P� � free�

Theorem �� G is a cograph i� for every induced subgraph H of G either H or �H isdisconnected�

Proof� Exercise�

Theorem �� Every cograph is a permutation graph�

Theorem �� A is a cograph i� A is the comparability graph of a series�parallel poset�

Corollary �� The property �being a series�parallel poset� is a comparability invariant�

Page 121: Advanced Topics in Algorithms Shamir

����� INTERVAL GRAPHS ���

b)

e)

a)

d)

c)

Figure ����� a� not SP poset� b� � e� SP posets

���� Interval graphs

De�nition graph G � �V�E� is called an interval graph if one can assign to each vertexv � V an interval on the real line Iv such that �v�� v�� � E � Iv�

TIv� �� �

Interval graph were introduced by Haj os���� andBenzer��� �

b)

e)

a)

d)

c)

Figure ����� a� interval graph� b� it�s interval representation� c� chordal� but not intervalgraph

For examples see Figure �����

Theorem �� �Gilmore � Ho man ������� The following are equivalent�

� G is an interval graph�

Page 122: Advanced Topics in Algorithms Shamir

��� CHAPTER ��� LECTURE ��

� G contains no induced C� and �G is a comparability graph�

� It is possible to order the maximal cliques in G so that for every vertex v � V thecliques that contain v appear consecutively in this order�

Proof�

��� ���� Immediate� because it is easy to see that an interval graph G contains no induced C�

and a transitive orientation for �G is obtained by taking an interval realization of G�fIvgv�V and setting �u� v� � E� �G�� Iu is completely to the left of Iv�

��� ��� Let F be a transitive orientation for �G�

Lemma� Let A�� A� be distinct non�empty maximal cliques of G� and let �V� F � be atransitive orientation of �G� Then �� there exists an arc from F between A� and A��

�� all such arcs between A� and A� have the same direction�

Proof�

��� It is trivial because otherwise B �� A�SA� is a clique in G and j B j�j A� j� j A� j�

in contradiction to the de�nition of A�� A��

��� Assume that a� c � A�� b� d � A�� �a� b�� �d� c� � F � For example see Figure ����If a � c �or b � d� then we get �d�b� � F � a contradiction to A� being a cliquein G� Therefore the vertices are di�erent� The situation fa� dg � E and fb� cg �E is impossible� because otherwise G contains an induced C�� Without loss ofgenerality assume that fadg �� E� Then we have two possible cases now�

�i� �a� d� � F �Then the transitivity of F implies �a� c� � F �

�ii� �d� a� � F � Transitivity of F implies �d� b� � F �

In both cases we get a contradiction�

a b

c d

A2A1

Figure ���� example for lemma

Page 123: Advanced Topics in Algorithms Shamir

Interval graphs ��

We now return to the theorem� De�ne a relation among maximal cliques in G asfollows� for max�cliques A� and A�� A� A� � there is exists arc from F whose tail isin A� and it�s head is in A�� According to lemma� this relation de�nes a tournament onthe set of maximal cliques of G� We�ll prove that it is transitive and therefore de�nesa complete order on G� Assume A� A� A�� Then � �w� x� � F � w � A�� x � A�

and � �y� z� � F � y � A�� z � A�� For example see Figure �����

A12A A

3w

x

y

z

Figure ����� example for theorem of Gilmore�Ho�man

��� if fx� zg �� E then the lemma implies that �x� z� � F and because F is a transitiveorientation for G we get �w� z� � F and� hence� A� A��

��� if fw� yg �� E then analogously we get �w� y� � F and A� A��

��� fx� zg� fw� yg � E� G contains no C� and therefore fw� zg �� E� It follows that�since F is transitive� �w� z� � F � Hence� A� A��

We have shown that is complete order �linear� on the maximal cliques of G�Let x � V � Suppose that there exist Ai Aj Ak such that x � Ai� Ak andx �� Aj�

�x �� Aj�� �y � Aj � fx� yg �� E

�Ai Aj�� �x� y� � F

�Aj Ak�� �y� x� � F

We have a contradiction� Therefore the claim is true�

�� ���� Let I�x� be the set of maximal cliques of G that contain x� By �� each such set isan interval in complete order �C�� of maximal cliques� �x� y � V fx� yg � E �I�x�

TI�y� �� � because two vertices are neighbors i� they are contained together in

some maximal clique�

Page 124: Advanced Topics in Algorithms Shamir

��� CHAPTER ��� LECTURE ��

Corollary �� An undirected G is an interval graph i� G is chordal and �G is comparability�

Proof� If G is interval then it is chordal by the theorem of Haj�os ���� � �lecture & ���Therest holds according to the last theorem� Conversely� if G is chordal then it contains no C�

and therefore if �G is a comparability graph then G is interval�Reminder� The clique matrix of graph is a ����� matrixM such that its rows correspond

to the maximal cliques of graph� its columns to the vertices and Mij � � i� vj belongs tothe i�th maximal clique� Theorem ���� implies that if rows are ordered in the order thenthe ones in every column will appear contiguously� This property is called the consecutiveones property for columns� For example see Figure �����

Theorem �� �Fulkerson�Gross ������� An undirected graph G is interval i� its cliquematrix has the consecutive ones property�

Proof� Immediately follows from the third characterization of Theorem �����

b)

1 2 3 4 5 6 71 1 1

1 1 1 1

1 1 1 1

1 1

0 0 0 0

0 0 0

0 0 0

0 0 0 0 0

{1, 2, 3}

{2, 3, 4, 5}{3, 4, 5, 6}

{6, 7}

1

35

6 7a) 2 4

Figure ����� a� interval graph� b� it�s clique matrix�

De�nition In an undirected graph G a triplet of vertices x� y� z � is called an asteroidaltriplet if G�x�y�z� is stable and for each pair from fx� y� zg there exists path between thesetwo vertices which does not pass through neighbors of the third vertex�

Page 125: Advanced Topics in Algorithms Shamir

Interval graphs ���

Theorem �� �Lekkerkerker�Boland ������� G is an interval graph i� it is chordaland asteroidal triplet�free�

Proof� If G interval then it is chordal� Consider an interval realization of G� Assume that z� y� x � is asteroidal triplet� Without loss of generalization suppose that the left endpointof Iz is smallest among left endpoints of the intervals of the triplet in this realization andright endpoint of Ix is biggest among right endpoints of this intervals� Then there existssequence of intervals z � v�� � � � � vk � x such that � � � i � k � � Ivi

TIvi�� �� � On other

hand� � � � j � k� � IyTIvi � � It is contradiction� Therefore G is asteroidal triplet�free�

For example see Figure ���� Proof of other direction is omitted here�

Iz

Ix

? I y

Figure ���� Example for Lekkerkerker � Boland theorem

Page 126: Advanced Topics in Algorithms Shamir

�� CHAPTER ��� LECTURE ��

Page 127: Advanced Topics in Algorithms Shamir

Chapter ��

Lecture ��Advanced Topics in Graph Algorithmsc�Tel�Aviv UniversitySpring Semester� ����

Lecturer � Ron Shamir

Scribe � Vered Zilkha

Lecture �� � June �

���� Preference and Indi�erence

Let V be a set of possibilities� A decision maker de�nes a preference relation on this set�for every pair of distinct members of V � he either prefers one over the other� or he feelsindi�erent about them�

We construct an oriented graph H � �V� P �� and an undirected graph G � �V�E� asfollows�

�x� y � V

xy � P � x is preferred over yxy � E � indi�erence is felt between x and yBy de�nition� �V� P � P�� � E� is complete�We assume that the preference relation is acyclic� In fact we would want it to be transitive�

Thus we require that P be a partial order�One way of formalizing preference relations �in utility theory� is the notion of Semiorder�

De�nition Given � �� a real�valued function u � V � R is called a utility function ofsemiorder if �x� y � V � xy � P � u�x� u�y� �

Remark� If P has a utility function of semiorder then P is a partial order �irre�ex�ive�transitive��

���

Page 128: Advanced Topics in Algorithms Shamir

�� CHAPTER ��� LECTURE ��

Let us now characterize the partial orders that have a utility function of semiorder� We�rst state without proof a fundamental result from utility theory�

Theorem ��� � Scott � Suppes ������ � A binary relation �V� P � has a utility functionof semiorder i� �x� y� z� w � V

S� P is irre�exive

S� If xy � P � zw � P then either xw � P or zy � P

S� If xu � P � yz � P then either xw � P or wz � P

De�nition An interval order is a binary relation �V� P � such that �i � V �we can match aninterval Ii on the real line� such that ij � P � Ii Ij �i�e Ii � Ij � and Ii is on the leftside of Ij�

Claim ��� A partial order �V� P � is an interval order i� it satis�es S��S��

�The proof of this claim is left as an exercise�The claim implies� If �V� P � is an oriented graph� �V�E� is an undirected graph� and

P � P�� � E is the edge set of the complete graph on V then if �V� P � is a semiorder then�V�E� is an interval graph�

�The converse is not true� For example see �gure ������

d

a b c

d

cba

c

d

a b

G G

Figure ����� Example

De�nition An interval graph G � �V�E� is called a proper interval graph if it has arealization fIvgv�V such that no interval properly contains another�

Page 129: Advanced Topics in Algorithms Shamir

����� PREFERENCE AND INDIFFERENCE ���

Theorem ��� � Roberts ������ � Let G � �V�E� be an undirected graph� The followingstatements are equivalent�

� There exists a real valued function u � V � R such that �xy � V � x �� y� xy � E �ju�x�� u�y� j �

� There exists a semiorder �V� P � such that �E � P � P��

� �G is a comparability graph and every transitive orientation of �G � �V� �E� is a semiorder

� G is an interval graph that doesn�t contain an induced K���

� G is a proper interval graph

� G is a unit interval graph

Proof�

���� �� Let u be a function that satis�es ���� We will match to each vertex x � V an openinterval Ix � �u�x� � �

�� u�x� � �

��� Then �x� y� x �� y� Ix � Iy �� �j u�x�� u�y� j

�� xy � E� Therefore fIxgx�V is a unit�interval realization of G�

��� ��� In a unit�interval realization of G� no interval can properly contain another� becausethey all have length �� Therefore this realization will be proper�

���� ��� Let fIxgx�V be a proper interval realization of G� Suppose G contains an induced sub�graph Gfy�z��z� �z�g isomorphic to K��� where fz�� z�� z�g is a stable set and y is adjacentto each zi� Without lost of generality� suppose that Iz� Iz� Iz�� Then Iy mustproperly contain Iz�� a contradiction� Thus� G can have no induced copy of K����

���� �� Since G is an interval graph� �G � �V� �E� is a comparability graph� Let F be a transitiveorientation of �G� It is easy to show that F satis�es �S��� �S��� Now we will see that italso satis�es �S�� By Scott�Suppes Theorem this will imply F is a semiorder�

Assume to the contrary that xy � F � yz � F � xw �� F � wz �� F � By the transitivityof F it follows that� wx �� F � zw �� F � wy �� F � yw �� F � But xz � F � Thus Gx�y�z�w

induces a K���� a contradiction�

��� ��� Immediate�

���� ��� If �V� P � is a semiorder� then by de�nition there exist a real valued function 'u � V � R

and a constant � � such that xy � P � 'u�x��'u�y� � Denoting u�x� � �ux�

we getxy � P � u�x�� u�y� �� and because P � P�� � �E we get that xy � E � xy �� Pand xy �� P�� �j u�x�� u�y� j ��

Page 130: Advanced Topics in Algorithms Shamir

�� CHAPTER ��� LECTURE ��

Additional results on unit interval graphs�

De�nition A ������valued matrix satis�es the consecutive ��s property for the columns ifits rows can be permuted such that on each column� the ��s will appear consecutively�

De�nition A layout of a graph G � �V�E� is a one�to�one function �a permutation�L � V � f�� � � � � j V jg� We will denote �L � the linear order L����� L����� � � � L���n��

Let G � �V�E� be an interval graph� Then other equivalent conditions to G being unitinterval are�

� The clique matrix of G satis�es the consecutive ��s property for rows and for columns�

� Let A��G� be the adjacency matrix of G when we add ��s on the diagonal� Then A��G�satis�es the consecutive ��s property for columns� � Roberts �� �

� G is a triangulated graph and it doesn�t contain as an induced subgraph any of thegraphs appearing in �gure �����

Figure ����� Wegner ���

� There exists a layout L ofG such that for every vertex v� L�Adj�v�� � fL�v��kv� L�v��kv � �� � � � � L�v�� �� L�v� � �� � � � � L�v� � lvg � Deng� Hell� Huang ���� �

Some hard optimization problems involving unit interval graphs are�

� Adding a minimum number of edges to a graph to get a unit interval graph is NP �complete� � Golumbic� Kaplan� Shamir ��� �

� Removing a minimum number of edges to get a unit interval graph is NP �complete�� Golumbic� Kaplan� Shamir ��� �

Page 131: Advanced Topics in Algorithms Shamir

����� RECOGNIZING INTERVAL GRAPHS ��

���� Recognizing interval graphs

Theorem ��� G � �V�E� is an interval graph i� it has a layout L that satis�es�

�L�u� L�v� L�w�� uw � E�� vw � E ������

�The proof of this theorem is left as an exercise��

Theorem ��� Let G � �V�E� be a co�comparability graph� and let F be a transitive ori�entation of �G� We denote d�u� the out�degree of u in �V� F �� If L is a layout of G suchthat

d�u� � d�v�� L�u� L�v� ������

then G is an interval graph i� L satis�es condition ����

Proof�

� If condition ���� holds then according to Theorem ���� G is an interval graph�

� Assuming� to the contrary that L satis�es condition ���� but not condition ����� wewill prove that G contains an induced C��

�a� if uv � F then by transitivity of F � d�u� � d�v�� and thus L�u� L�v��

�b� if L�u� L�v� and uv �� E then uv � F �else vu � F and from �a� we getL�v� L�u���

From �b� and the transitivity of F it follows that�

�L�u� L�v� L�w�� uv �� E� vw �� E�� uw �� E �����

�L�u� L�v� L�w�� uw � E� uv �� E�� vw � E ������

Now� suppose L does not satisfy ����� Thus there exist u� v� w such that

L�u� L�v� L�w�� uw � E� vw �� E ������

From �b� it follows that vw � F � and from condition ��� it follows that uv � E�

Since L�u� L�v�� it follows that d�u� d�v�� vw � F� uw �� F � thus there existsy such that uy � F � vy �� F � Moreover� yv �� F �else uy� yv � F � uv � F � acontraction�� thus vy � E� consider that

If yw � F then uy� yw � F � uw � F � a contradiction�

If wy � F then vw�wy � F � vy � F � a contradiction�

Thus yw � E� and Gfu�v�w�yg induces a C��

Page 132: Advanced Topics in Algorithms Shamir

�� CHAPTER ��� LECTURE ��

Theorem ��� Let G � �V�E� be a graph with a layout L� and let us de�ne functionsl� h � V � f�� � � � � j V jg�

l�u� � minv�N �u�

L�v�

h�u� �

�����������

max L�v� fv j L�v� L�u�� v �� N�u�g �� v �N �u�Lv�Lu

� otherwise

then L satis�es condition ���� i� �w � V� h�w� l�w�

l(v) 1 1 3 2 3

h(v) 0 0 2 0 2

Figure ���� Example of function l� h

Proof�

� If L does not satisfy condition ���� then there exist u� v� w such that L�u� L�v� L�w�� and uw � E� but vw �� E� Thus l�w� � L�u� L�v� � h�w��

� If there exists w � V such that l�w� h�w� then taking u � L���l�w��� v � L���h�w��gives us vertices u� v� w such that L�u� L�v� L�w�� and uw � E� but vw �� E� thuscontradicting condition �����

������ A quadratic algorithm �

We �rst describe an elementary O�n�� algorithm for recognizing interval graph� This algo�rithm is due to Ramalingam and Rangan �������

Let G � �V�E� be an undirected graph�

�� Find a transitive orientation of �G� and call it F �

Page 133: Advanced Topics in Algorithms Shamir

����� RECOGNIZING INTERVAL GRAPHS �

�� Compute a layout of G according to a decreasing order of out�degrees of vertices in�V� F ��

� For each vertex� compute l�u�� h�u��

G is an interval graph i� �w � V � h�w� l�w��correctness�

�� If G is an interval graph then �G has a transitive orientation� From theorem ����� thelayout L computed in step � of the algorithm satis�es condition ����� From theorem��� the condition h l holds�

�� IfG is not an interval graph then no layout L satis�es condition ����� and from theorem��� the condition h l fails�

complexity�

�� Finding a transitive orientation of �G� O�n�� �Spinrad ��� ���� O�n � �m log n� �Mc�Connell � Spinrad ������ �We don�t need to check that the orientation is transitive�

�� Sorting by out�degrees of vertices� O� �m� n log n�� �Where �m �j E� �G� j��� Computing l�u� for all vertices� O� �m��

Computing h�u� for all vertices� O�m��

We can see that the complexity does not exceed O�n���Remarks�

( We can produce a realization of an interval graph� using the layout L��this follows fromthe proof of theorem ����� which is constructive�

( The proof implies that every transitive orientation of �G has a linear extension L �oneor more� that satis�es condition �����

������ A Linear Algorithm

To check whether a graph G � �V�E� is an interval graph we can use the following algorithm�

�� Check whether G is triangulated

�� Produce all the maximal cliques in G� and then produce the clique matrix M of G

� Check whether the matrix M satis�es the consecutive ��s property

Page 134: Advanced Topics in Algorithms Shamir

�� CHAPTER ��� LECTURE ��

The �rst two stages can be implemented in a linear time� O�j V j � j E j�� We will seenow that the third stage can be implemented in a linear time� by an algorithm of Booth andLeuker �������

The data structure being used is called PQ � trees� a PQ�tree is a tree with a root� thathas vertices of two kinds� P and Q� The sons of a P �vertex are an unordered set� The sonsof a Q�vertex are an ordered set� The leaves of the tree are labeled by ��� correspondencewith the members of the set X� The frontier of the tree is the permutation of X� obtainedby reading the labels on the leaves from left to right�

Two PQ�trees� T � T � are equivalent� denoted T � T �� if one can be obtained from theother by applying a sequence of the following transformation rules�

� Arbitrarily permute the children of a P �vertex�

� Reverse the order of children of a Q�vertex�

Any frontier obtainable from a PQ�tree equivalent with T is said to be consistent withT � the set of permutations on X consistent with T is denoted by�

CONSISTENT �T � � fFRONTIER�T �� j T � T �g

F

IJ

G H

A B

E D C

Figure ����� a PQ�tree� The FRONTIER here is �F J I G H A B E D C�

The null tree T� has no nodes and CONSISTENT �T�� � � The universal tree has oneinternal P �vertex� the root� and a leaf for every member of X�

The relation between the consecutive arrangement problem and PQ�trees is as follows�Let � be a collection of subsets of a set X� and let )��� be the collection of all permu�

tations � of X such that the members of each I � � occur consecutively in ��

Page 135: Advanced Topics in Algorithms Shamir

����� RECOGNIZING INTERVAL GRAPHS ��

Theorem ��� � Booth � Leuker ������ �

�� For every collection of subsets � of X there exists a PQ�tree T such that )��� �CONSISTENT �T ��

�� For every PQ�tree there exists a collection of subsets � such that)��� � CONSISTENT �T ��

The role of the Q�vertices is to restrict the number of permutations by making some ofthe brother relationships rigid�

The main approach of the algorithm is as follows�Begin with the collection of all possible permutations� Introduce the subjects one at a

time� reducing the tree to those permutations that also satisfy the constraints of the nextsubset� Below is an implementation of the algorithm�

Procedure CONSECUTIVE�X����begin

T � universal tree�for each I � � do

T � REDUCE�T�I��return T�end

The routine REDUCE attempts to apply on the existing tree� one of �� templates�according to the tree and the set I� and replaces a part of the tree accordingly� The templatesare applied from the bottom to the top of the tree� We omit the details here� �gure ����gives an example of the execution of the algorithm�

Theorem ��� � Booth � Leuker ������ � The collection of permutations )��� can becalculated when implemented with a PQ�tree in time O�j � j � j X j �P

I�� j I j��Corollary ��� A ��� ���valued matrix Amn with f ��s can be checked for the consecutive��s property in O�m� n � f� steps�

Corollary ��� Interval graphs can be recognized in linear time�

De�nition A ������valued matrix on satis�es the circular ��s property in the columns if itsrows can be rearranged such that on each column� the ��s will appear cyclicly consecutive�

Remarks�

� A ������valued matrix satis�es the circular ��s property i� it satis�es the circular ��sproperty�

Page 136: Advanced Topics in Algorithms Shamir

� CHAPTER ��� LECTURE ��

A F B C

A F

D C B E

E

D

4 permutations

16 permutations

I={B,E}

A B C D E F

B C E

A FD

144 permutations

I={B,C,D}

I={A,D,F}

720 permutations

Figure ����� Example of execution of CONSECUTIVE

Page 137: Advanced Topics in Algorithms Shamir

����� MORE ABOUT THE CONSECUTIVE ��S PROPERTY ��

� If a matrix satis�es the circular ��s property for the columns� then after switching ��swith ��s in a column� the property still holds�

Theorem ���� �Tucker ������ � Given a ����valued matrix M � switch ��s with ��s inevery column that has � in the k�th row� Denote the new matrix M ��

M satis�es the circular ��s property i� M � satis�es the consecutive ��s property�

Proof�

� IfM satis�es the circular ��s property then M � satis�es the circular ��s property� Movethe k�th row to the �rst row by rotating the rows cyclicly� In this row there will be ��sonly in M �� Hence� M � satis�es the consecutive ��s property�

� If M � satis�es the consecutive ��s property then it satis�es the circular ��s property�and therefore M satis�es the circular ��s property�

Theorem ���� � Booth ������ � A ����valued matrix Amn� with f ��s can be checkedfor the circular ��s property in time O�m � n � f�� assuming that the matrix is given as alist of the ��s for each row�

Proof� Let k be the row with the smallest number of ��s� and let M � be the matrixobtained from M by switching ��s with ��s in every column that has � in the k�th row�

M � has at most �f ��s� because in every row the number of ��s is at most doubled �thenumber of ��s that become ��s is not larger than the original number of ��s in the row��Then apply the algorithm for consecutive ��s on M �� According to the previous theorem� M �

satis�es the consecutive ��s property i� M satis�es the circular ��s property�

���� More about the consecutive � s property

Theorem ���� � Booth ������ � Given a ����valued matrix Mrc and an integer k�deciding whether or not there exists an r k submatrix of M satisfying the consecutive ��sproperty or circular ��s property is NP �complete�

Proof� It is easy to show that the problem is NP � To prove that the problem is NPcomplete we can show a reduction from the Hamiltonian�path problem� Given an undirectedgraph G � �V�E�� we produce the adjacency�matrix A of size j V j j E j �The rowsrepresent vertices and the columns represent edges�� Then it is easy to see that A has asubmatrix of size j V j j V j that satis�es the consecutive ��s property � There exists aHamiltonian path in G� For circular ��s property� reduce from Hamiltonian cycle instead�

Page 138: Advanced Topics in Algorithms Shamir

� CHAPTER ��� LECTURE ��

Theorem ���� � Kou ������ � Given a ����valued matrix� �nding a permutation of therows that minimizes the total number of consecutive blocks of ��s appearing in the columnsis NP �complete�

Theorem ���� � Kou ������ � Given a ����valued matrix� �nding a permutation ofthe rows that minimizes the number of times a row must be split into two pieces to obtainconsecutive ��s in the columns is NP �complete�

Proof� First� we will introduce an equivalent problem� Given a �nite alphabet # and acollection of subsets s�� � � � sk such that si � #� we want to �nd a chain � #� of length � B�such that for each si there exists a consecutive interval of length j si j in G which containsall letters in si�

It is obvious that the problem is NP � to show that it is NP �complete we will showa reduction from the Hamiltonian�path problem� given a graph G � �V�E� we will de�ne# � V � E� B � � j E j ��� si � f vi � �Sx�Adjvi�vi� x�g �i � � � � � n�

� If there exists a Hamiltonian path� without lost of generality v� � � � vn� then we canproduce the chain�

v�� �v�� ��� �v�� ��� � � � � �v�� v��� �z all edges of v�

� v�� �v�� ��� � � � � �v�� v��� �z the other edges of v�

� v�� � � � � vn� �vn� ��� � � � � �vn� ��� �z the other edges of vn

The length of the chain� j V j �� j E j ��j V j ��� � B�

� If there exists a chain with length � B� since for every two sets si� sj� si �� sj� j si�sj j��� it follows that the length of the chain is at least�

nXi��

j si j ��n� �� � n � � j E j ��n� �� � B

Therefore� if there exists a chain of length B� it matches a Hamiltonian cycle �there isan edge between each pair of adjacent si� sj��

Remarks

� The problem is NP �complete even if �i� j si j� � �the same reduction from a �regulargraph��

� the problem is polynomial if �i� j si j� �� �exercise�

� Finding a polynomial approximation is an open problem�

Theorem ���� �Goldberg� Golumbic� Kaplan� Shamir ������ � Given a��� ���valued matrix� deciding there exists a permutation of the rows that gives at most kblocks of ��s in every column is NP �complete� for every k ��

Page 139: Advanced Topics in Algorithms Shamir

Chapter ��

Lecture ��Advanced Topics in Graph Algorithmsc�Tel�Aviv UniversitySpring Semester� ����

Lecturer � Ron Shamir

Scribe � Michael Seltser

Lecture �� � June

���� Temporal Reasoning and Interval algebras

In this section we deal with problems in temporal reasoning� Let us start with an example�

Example ��� A paleonthologist wants to determine the relative span of existence of thespecies Brontosaurus� Parasaurulophus� Stegosaurus� and Tyrannosaurus� His assumptions�

� B and P did not exist simultaneously

� P perished before S emerged

� S emerged before T and perished not after it

� Either P perished before T emerged or P emerged when T perished

� B emerged and perished during T �s existence

Is there a scenario satisfying all his assumptions �

See �gure ���� for a possible scenario consistent with the assumptions�Allen in �� has de�ned a model for temporal logic whose elements are time intervals

�corresponding to events that happen during a certain period of time� and used the following� primitive relations�

��

Page 140: Advanced Topics in Algorithms Shamir

��� CHAPTER ��� LECTURE ��

P ST

B

Figure ����� A consistent scenario

f����m�m��� o� o��� s� s��� f� f��� d� d����gto express the relative position of two intervals �See Figure ������ We will call this the

���valued interval algebra A�� �

RELATION NOTATION INTERPRETATION

x before y

y after x

x meets y

y met�by x

m

m��

x overlaps y

y overlapped�by x

o

o��

x starts y

y started�by x

s

s��

x during y

y includes x

d

d��

x �nishes y

y �nished�by x

f

f��

x equals y �

Figure ����� The ���valued interval algebra A��� Single line� x interval� Double line� y interval�

From these we de�ne the �valued interval algebra A� whose elements are called its atomicrelations

A� � f�����gHere X�Y denotes that events � intervals � x and y have a non�empty intersection� i�e��

any one of the eleven relations excluding � and � in Allen�s algebra may hold between xand y� The choice of which algebra to use depends on the nature of the application�

Page 141: Advanced Topics in Algorithms Shamir

����� INTERVAL SATISFIABILITY PROBLEMS ���

���� Interval satis�ability problems

We now de�ne our temporal reasoning problems in the context of constraint satis�ability�For each pair of events x and y� let D�x� y� be a set of atomic relations in the algebra Ai�The semantics here is that we do not know precisely the relationship between x and y� butit must be one of those in the set D�x� y�� �In the language of constraint satis�ability� thereis a variable v�x� y� representing the relation between x and y� and its value must be takenfrom those in the set D�x� y� corresponding to its domain��

For example� we read D�x� y� � f�� og as x is either before or overlaps y� We also call aset of atomic relations a relation set� Occasionally we shall use the notation xD�x� y�y forshort� For example� D�x� y� � f�� d����g and xf�� d����gy both mean "either x endsbefore y starts� or y is during x� or the two are equal�� We omit braces and commas whenthere is no ambiguity� e�g�� x�y or x�y�

In particular� relation sets in A� will be presented by concatenation of the atomic rela�tions� Hence� x��y denotes x and y are disjoint� x��y denotes xf���gy� etc�

An instance �or input� for all the problems studied in this paper consists of n events�and a relation set D�x� y� for every pair of distinct events x� y� Without loss of generality�we assume that for each pair of events x and y� the relation sets D�x� y� and D�y� x� givenas input are consistent� i�e�� for each atomic relation R� R � D�x� y� � R�� � D�y� x��Otherwise� it is a simple matter to restrict the relation sets further so that they satisfy theseproperties or are shown to be unsatis�able� Hence� we can assume that the input containsfor each pair of events x� y only one relation set� say D�x� y�� and that the other relation setD�y� x� is given implicitly by the above rule�

Remark ��� The size of an instance is the number s of non�trivial relation sets in it� andis linearly equivalent to the binary input length for each Ai� We will assume that relationsets which are trivial i�e�� contain all the atomic relations are not listed explicitly as partof a problem input� and that each event is involved in at least one non�trivial relation set�

Hence� the input size s of a problem with n events satis�es s � O�n�� and s � *�n��

An interval realization for the instance fD�x� y�g is an assignment of intervals on the realline to events� so that for each pair of events� one of the atomic relations in their relationset holds� Since the algebras discussed here are concerned with topological properties only�a realization can be viewed also as a complete weak order of the interval endpoints� therebyidentifying all realizations which di�er in metric only� Two realizations are distinct if theorders of the endpoints in them di�er� The input data fD�x� y�g is consistent �or satis�able�if it admits at least one realization�

The interval satis�ability problem �ISAT� is determining the existence of �and �nding�one instantiation that is consistent with the input data fD�x� y�g� Occasionally� we shallmake an additional distinction between the decision version of ISAT� whose output is only

Page 142: Advanced Topics in Algorithms Shamir

��� CHAPTER ��� LECTURE ��

a yes$no answer� and the constructive version� whose output is the answer �no� if the inputis inconsistent and a solution if it is consistent�

The minimal labeling problem �MLP� is to determine the minimal sets D��x� y� � D�x� y�such that the set of realizations is unchanged� and every remaining atomic relation partici�pates in some solution�

Example ��� xf��m� ogy� yf�����gz� zff� sgx�Here xoy� y�z� zsx� and x�y� y�z� zfx are both consistent with the input� as shown inFigure ����� On the other hand� y�z and z � y are impossible� The minimal labeling forthis problem is xf��m� ogy� y�z� zff� sgx�

x

z y

I� xoy� y�z� zsx

x

z y

II� x�y� y�z� zfx

Figure ���� Two interval realizations for Example ����

The all�consistent�realizations problem �ACRP� is �nding of all the consistent realizations�Here there may be exponentially many solutions� but we would like to generate them in timepolynomial per each new realization�

A fragment of an algebra �A� or A�� � is a collection of relation sets in that algebra� Aproblem is restricted to a fragment F if all relation sets participating �implicitly or explicitly�in the instance belong to F � We will denote the problem A restricted to fragment F by A�F ��

Example ��� In the problem ISAT ���� for every pair of events x� y either x�y orx�y� Clearly the input is consistent i� the relation � is a linear order� as no intersectionsare allowed� This can be checked in linear time�

Example ��� ISAT ������ is polynomial by a similar argument� Here the instance isconsistent i� � is a partial order�

Example ��� ISAT ���� is equivalent to interval graph recognition� Form a graph Gwith a vertex for each event with an edge between x and y i� x�y� The instance has arealization i� G is an interval graph� Hence the problem is solvable in linear time by thealgorithm of Booth and Leuker �����

Theorem ��� �Golumbic � Shamir� ��� For each of A���A�� MLP and ACRP are poly�nomially equivalent to ISAT�

Page 143: Advanced Topics in Algorithms Shamir

����� INTERVAL SANDWICH PROBLEMS AND ISAT ��

J�Allen de�ned a constraint propagation polynomial heuristic for solving ISAT on A���If the algorithm returns a negative answer then it is correct� but a positive answer may beincorrect� He conjectured that ISAT is NP�complete on A��� This was proved by Vilain andKautz ��� �� Vilain� Kautz and van Beek ��� �� have shown that Allen�s algorithm alwaysgives the correct answer if the input data is restricted to a fragment of A��� N okel ��� �has given another polynomial algorithm on a di�erent fragment of A���

Applications of interval satis�ability problems are numerous� They include planning�molecular biology �DNA�� knowledge representation� natural language processing� informa�tion systems �databases�� arti�cial intelligence� behavioral psychology� archaeology �seri�ation�� graph theory and others�

���� Interval sandwich problems and ISAT

Let E� and E� be two disjoint sets of edges de�ned on the same vertex�set V � A graphG�V�E� with E� � E � E� �E� is called a sandwich graph for �E�� E��� The interval graphsandwich �IGS� problem is the following�

Interval Graph Sandwich problem�

INPUT� Two graphs G� � �V�E�� and G� � �V�E�� with the same set of vertices�and disjoint edge�sets E� and E��

QUESTION� Is there a sandwich graph for �E�� E�� which is an interval graph�

De�ne F � fE� � E�g �i� e�� F is the set of non�edges in the graph �V�E� �E���� WhenE� � or F � � the answer is trivially yes� When E� � � the problem is equivalent torecognizing if G�V�E�� is interval and thus is polynomial by the algorithm of Booth andLueker� We shall show that in the general case� the problem is NP�complete�

Given a set of intervals on the real line� one can de�ne a partial order on the intervals bya � b if and only if the interval a is completely to the left of interval b� We use this intervalorder to give a reduction from the following problem�

BETWEENNESS�

INPUT� A set of elements S � fa�� � � � � ang� and a set T � fT�� � � � � Tmg of orderedtriplets of elements from S� where Ti � �ai�� ai�� ai�� i � �� � � � �m �

QUESTION� Does there exist a one�to�one function f � S � f�� �� � � � � ng such thateither f�ai�� f�ai�� f�ai�� or f�ai�� � f�ai�� � f�ai�� for i � �� � � � �m�

The problem was shown to be NP�complete by Opatrny ��� ���

Page 144: Advanced Topics in Algorithms Shamir

��� CHAPTER ��� LECTURE ��

Theorem ��� The interval graph sandwich problem is NP�complete�

Proof� Membership in NP follows since a given interval realization can be checked to �tthe data in polynomial time� Given an instance of BETWEENNESS� we transform it to aninterval sandwich instance as follows� De�ne a vertex vi for each element ai� and two verticesx�j and x�j for triplet Tj� The vertex set is V � fv�� � � � � vng � fx�j � x�j j j � �� � � � �mg� Theedges sets are

E� � f�vi�� x�i �� �x�i � vi����vi�� x

�i �� �x

�i � vi�� j i � �� � � � �mg

F � f�vivj� j i �� jg�f�vi�� x�i �� �vi�� x�i �� �x�i � x�i � j i � �� � � � �mg

In other words� to each triplet corresponds a ��chain �see �gure �����a�� which shouldalso appear as a ��chain in the sandwich graph� In addition� all the vi�s should form anindependent set in that graph� The reduction is clearly polynomial�

The key to the reduction is the following simple observation� in any interval realizationof a ��chain �a� x� b� y� c�� either a � b � c or c � b � a �see �gure �����b���

�a�v v v v vvi� x�i vi� x�i vi�

x�i x�i

vi� vi� vi��b�

Figure ����� �a� The ��chain �vi�� x�i � vi�� x

�i � vi��� �b� An interval realization of the ��chain�

Suppose there is an ordering f of the set S which satis�es the betweenness conditions�Create an interval realization for an interval sandwich as follows� Draw n disjoint intervalscorresponding to the vi�s in the same order as the ai�s appear in f � That is� I�vi� � I�vj�if and only if f�ai� f�aj�� Since the order conditions on triplets are satis�ed� additionalintervals corresponding to x�i and x

�i can be added for each triplet Ti such that the subgraph

induced by the �ve vertices fvi�� vi�� vi�� x�i � x�ig is a ��chain� The resulting interval graph onV is a sandwich graph�

For the converse� suppose there exists an interval sandwich solution with realization I�Since in that graph the set fv�� � � � � vng induces an independent set� a complete orderingon S is generated� Number the elements in the order of their intervals from left to right�namely� f�ai� f�aj� if and only if I�vi� � I�vj�� Since for each triplet Ti the �ve verticesfvi�� vi�� vi�� x�i � x�ig must induce a ��chain in every sandwich graph� by the above observation�every triplet satis�es the betweenness condition�

Interestingly� we can also show that a restricted version of the above problem is NP�complete� A function c � V � Z is called a coloring of the graph G � �V�E� if for every�u� v� � E� c�u� �� c�v�� The problem is de�ned as follows�

Page 145: Advanced Topics in Algorithms Shamir

����� A LINEAR TIME ALGORITHM FOR ISAT ��� ���

COLORED INTERVAL SANDWICH�INPUT� A graph G � �V�E� and a coloring c of G�QUESTION� Does there exist a set E� so that E � E�� G� � �V�E �� is an interval

graph and c is also a coloring for G��

Notice that this is a special case of the sandwich problem where E� � E and F �f�u� v� j c�u� � c�v�g is given implicitly by the coloring�

Theorem ��� The colored interval sandwich problem is NP�complete�

Proof� Reduction from BETWEENNESS� where the vertex set and E � E� is de�nedas in Theorem ��� and the coloring is c�x�i � � c�x�i � � i �i � �� � � � �m� and c�v�� � c�v�� �� � � � c�vn� � m � �� A slight modi�cation of the arguments in Theorem ��� proves theresult�

Remark ��� Golumbic� Kaplan� and Shamir ���� have shown that the analog problemsto Theorem ��� and ����� with the additional condition that all intervals have the samelength� are still NP�complete�

Corollary ���� ISAT �������� is NP�complete�Proof� Just consider V � f events g� �i� j� � E� � i�j� �i� j� � F � i��j�

�i� j� � E� � i���j�Corollary ���� ISAT A� is NP�complete�

Proof� Follows from Corollary ����� since ISAT �������� is a restriction ofISAT A� �

Corollary ���� ISAT� MLP� ACRP are NP�hard for A� and A���

Theorem ���� ISAT � � � � �� � � is polynomial�

Proof� exercise�

���� A linear time algorithm for ISAT����

In this section we deal with ISAT problems on the fragment�

�� � f���������������g�That is� A� � ��� We shall give e�cient algorithms for ISAT� MLP and ARP on thisfragment� and they will apply immediately to any subfragment of ��� Hence� by excludingjust a single relation set from A� the problems become tractable�

Page 146: Advanced Topics in Algorithms Shamir

�� CHAPTER ��� LECTURE ��

The polynomial algorithm for ISAT���� utilizes a directed graph� which will be describedlater� with vertices corresponding to the endpoints of event intervals and arcs representingthe relative order of endpoints� The key observation here is that every relation in �� isequivalent to a certain order requirement between a pair �or two pairs� of such endpoints�This observation is proved below�

Lemma ���� Let i and j be the event intervals �li� ri� and �lj� rj�� respectively� In each ofthe following cases� the intervals satisfy the set of relations if and only if their endpointssatisfy the corresponding inequalities�

i�j � ri lj i�j � rj li ������

i��j � li � rj i��j � lj � ri ������

i�j � li � rj and lj � ri �����

If i���j� no constraint is imposed�

Proof� ��� is immediate� The conditions in ��� are the negation of those in ���� �� isequivalent to the intersection of the two conditions in ����

The graph is now constructed as follows� For an instance J of ISAT���� with n events�form a directed graph G�J� � G�V�E� with vertex set V � fr�� � � � rn� l�� � � � lng� The arc setE consists of two disjoint subsets� E� and E��

The former will represent weak inequality and the latter will represent strict inequalitybetween pairs of endpoints�

The arcs are de�ned as follows�

�li� ri� � E� i � �� � � � � n ������

�ri� lj� � E� �i� j s�t� i�j ������

�li� rj� � E� �i� j s�t� i��j �����

�li� rj� � E� and �lj� ri� � E� �i� j s�t� i�j ������

For pairs i� j with the relation i���j� no arc is introduced� De�ne now E � E� � E��We call the arcs in E� �resp�� E�� the weak arcs �resp�� strict arcs�� Note that the graph G isbipartite� Denote the two parts of the vertex set by R � fr�� � � � � rng and L � fl�� � � � � lng�and call an arc an RL�arcs �resp�� LR�arc� if it is directed from R to L �resp�� from L to R��

Remark ���� In the graph G all the RL�arcs are strict and all the LR�arcs are weak�Hence� we need not record explicitly the type of each arc since it is implied by its direction�

Lemma ���� Every cycle in G contains a strict arc�

Page 147: Advanced Topics in Algorithms Shamir

����� A LINEAR TIME ALGORITHM FOR ISAT ��� ���

Algorithm ���CONSISTENCYbegin

�� construct G�J� according to rules ������ � ��������� if G�J� contains a cycle � J is not satis�able� Otherwise� it is�

end construct G�decomposition

Figure ����� Algorithm to construct Delta��CONSISTENCY

Proof� Since G is bipartite� a cycle must contain vertices both from R and from L� Inparticular� it must contain an RL�arc� so the claim follows by Remark �����

An algorithm for solving ISAT���� is described in �gure ����

Lemma ���� Suppose G�J� � �V�E� is acyclic� Then a linear order on V is consistentwith the partial order G�J� if and only if it is a realization of J �

Proof� Take any linear order P which extends the partial order G� P is an ordering ofall the endpoints� which by Lemma ����� satis�es all the relations in the input� so P givesa realization for J � On the other hand� every realization of J gives a linear order of theendpoints� in which each of the input relations must be satis�ed� by Lemma ������ Hence�the linear order must be consistent with the partial order G�J��

Theorem ���� Algorithm ���CONSISTENCY correctly recognizes if an instance ofISAT�� is satis�able in linear time�

Proof� Validity� By Lemma ������ each arc re�ects the order relation of a pair of intervalendpoints as prescribed by the input relations�

If G contains a cycle� then by Lemma ����� that cycle contains a strict arc� Hence�that cycle must satisfy ri lj � � � � � ri� which implies that the input relations cannot besatis�ed� In case G is acyclic�

Lemma ���� implies that J is satis�able�Complexity� Constructing G�J� requires O�s� steps� where s is the number of input

relation sets� since the e�ort is constant per relation� Checking if G is acyclic can be done�for example� by depth �rst search� in time linear in jEj� the number of arcs�

Since jEj � �s � n� using remark ���� we conclude that the algorithm is linear�In a similar way one can construct algorithms for MLP���� and ACRP���� in the fol�

lowing manner� An algorithm for MLP is obtained by calculation of transitive closure of G�The algorithm for ACRP���� is based on �nding of all linear extensions of G�

Remark ��� ISAT is polynomial if all events are points A� � A�� in that case �

Page 148: Advanced Topics in Algorithms Shamir

�� CHAPTER ��� LECTURE ��

Proof� Exercise�

Remark ���� One can handle additional metric constraints in A� � ��� by solving thelinear programming problem de�ned by ���� � ���� with additional metric constraints onthe endpoints�

� �� ����� T T

Polyinterval graph

� Polylinear order

Polyinterval order

Polyacyclic graph

Poly

�� T T NPC( NPC(

��� T T TNPC

interval sandwich���� Poly Poly NPC( NPC(����� Poly Poly Poly NPC

������ T T NPC NPC�������� Poly Poly NPC NPC

Figure ���� Complexity of ISAT on all fragments of A�� T � satis�ed by setting all intervalsdisjoint or identical� The four asterisk cases were shown to be NPC by Webber �������

Figure ��� summarizes results from Golumbic � Shamir ����� and Webber ������ onthe complexity of ISAT on all fragments of A��

���� Bandwidth� Pathwidth and Proper Pathwidth

We now switch to di�erent problems related to interval and proper interval graphs� Themotivation studying to these problems arises in physical mapping of DNA� a major problemin the Human Genome Project�

Lemma ���� Every interval graph and every proper interval graph has an interval resp��proper interval representation on the real line in which all endpoints are distinct� and theleft endpoints are assigned to the integers �� �� � � � � jV j�

We shall call such a representation canonical�

De�nition Pathwidth and Proper Pathwidth A path decomposition of a given graphG � �V�E�� is a sequence of subsets of V � X � �X�� � � � �Xl� such that

Page 149: Advanced Topics in Algorithms Shamir

����� BANDWIDTH� PATHWIDTH AND PROPER PATHWIDTH ���

��� V � �iXi

��� For each edge �u� v� � E� there exists some i � f�� � � � � lg so that both u and v belongto Xi�

�� For each v � V there exist some s�v�� e�v� � f�� � � � � lg so that s�v� � e�v�� and v � Xj

if and only if j � fs�v�� s�v� � �� � � � � e�v�g�

The width of X is de�ned by pwX�G� � maxfjXij j i � �� � � � � lg � �� The pathwidthof G� denoted pw�G�� is the minimum value of pwX �G� over all path decompositions� i�e��pw�G� � minfpwX�G� j X is a path decomposition of Gg� The notion of pathwidth wasoriginally introduced by Robertson and Seymour ��� ��

Lemma ���� �eg� Mohring� ��� For any path decomposition X � �X�� � � � �Xl� of agraph G� every clique in G must be contained in some Xi�

The PATHWIDTH problem is to decide for a given graph G and a given integer k ifpw�G� � k� Equivalent problems arise in various areas� including VLSI layout� processormanagement� node searching and vertex separation�

Lemma ���� For every graph G� the pathwidth of G is one less than the least clique sizeof any interval supergraph of G�

We introduce here the notion of a proper path decomposition of G� It is as a path decom�position X which satis�es ������ and also�

��� For every u� v � V � fs�u�� s�u� � �� � � � � e�u�g �� fs�v�� s�v� � �� � � � � e�v�g��As usual� � denotes strict containment�� The proper pathwidth of G� denoted ppw�G�� is

the minimum value of pwX�G� over all proper path decompositions of G� namely ppw�G� �minfpwX�G� j X is a proper path decomposition of Gg�

Clearly� pw�G� � ppw�G�� but note that pw�G� and ppw�G� can di�er dramatically� Forthe star graph with �n � � vertices� G � K���n� pw�G� � � but ppw�G� � n� An easy wayto see the last equality is using the characterizations we shall provide in the next section�

Bandwidth� Another measure of graph width which we shall use is bandwidth� For G ��V�E� with jV j � n� a linear layout of the graph is a ��� function L � V � f�� � � � � ng� Thebandwidth of L is bwL�G� � maxu�v�EfjL�u��L�v�jg� The bandwidth of G is the minimumbandwidth over all layouts of G� namely� bw�G� � minfbwL�G� j L is a layout of Gg� TheBANDWIDTH problem is to decide for a given graph G and integer k� if bw�G� � k� Thisproblem has been studied intensely because of its application to sparse matrix algebra� Itis known to be NP�complete even for binary trees � Garey� Graham� Johnson� and Knuth���� � and for caterpillars with hair length at most three � Monien� �� �� On the otherhand� it is solvable in O�nk� for arbitrary k and in linear time for k � � � Garey� Graham�Johnson� and Knuth� ��� ��

Page 150: Advanced Topics in Algorithms Shamir

��� CHAPTER ��� LECTURE ��

Lemma ���� � Kaplan � Shamir� �� � For every graph G� the proper pathwidth of G isone less than the least clique size of any proper interval supergraph of G�

Proof� Suppose X � �X�� � � � �Xl� is a proper path decomposition of G and pwX�G� �ppw�G� � k� On the linear order � � � � � l� let I�v� be the interval �s�v�� e�v��� ThenfI�v�gv�V is a representation of an interval graph G�� G� is proper since no interval is strictlycontained in the other� by property ��� in the de�nition of a proper path decomposition� G� isa supergraph of G� by property ���� SinceX is also a path decomposition of G�� Lemma ����implies that every clique in G� must be contained in some Xi� Hence� ��G�� � k � ��

Conversely� suppose k � � is the least clique size of any proper interval supergraph ofG� Let fI�v�gv�V be a proper interval representation of such supergraph G� � �V�E�� with��G�� � k � �� in which all endpoints are distinct� and I�v� � �l�v�� r�v��� Order the �nendpoints from left to right p�� � � � p�n� De�ne Xi � fv � V j pi � I�v�g for i � �� � � � � �n��Here and throughout n � jV j�� We claim that �X�� � � � �X�n� is a proper path decompositionof G� Checking the four requirements from a proper path decomposition one can observethat ��� is immediate� ��� follows since E � E�� and if �u� v� � E� and l�u� l�v� thenl�v� � I�v� � I�u�� In other words� every edge in E� is represented in some Xi� Since G�

is a proper interval graph� it follows that s�v� � l�v� and e�v� � r�v� satisfy �� and ����Since the clique size of G� is k � �� each point pi can meet at most k � � intervals in therepresentation� Hence� maxi jXij � k � � so ppw�G� � k�

Theorem ���� � Kaplan � Shamir� �� � The bandwidth of a graph equals its properpathwidth�

Proof� For the graph G � �V�E� with ppw�G� � k� by Lemma ����� there exists asupergraph G� � �V�E�� of G which is proper interval with clique size k � �� Let fI�v�gv�Vbe a canonical representation for G�� where I�v� � �l�v�� r�v��� De�ne a layout L on G byL�u� � l�u� for all u � V � Suppose L�u� � L�v� � k for some �u� v� � E� where L�v� � i�Then fL���i�� � � � � L���i� k � ��g form a clique of size k � � in G�� a contradiction� Hence�bw�G� � bwL�G� � ppw�G��

Conversely� let L be a layout of G so that bwL�G� � bw�G� � k� Form a set of equal�length intervals on the real line fI�v�gv�V where I�v� � �L�v�� L�v� � k�� Let G� � �V�E��be the intersection graph of that set of intervals� Clearly E� � E since if �u� v� � E thenjL�u��L�v�j � k� so I�u�� I�v� �� � Since the maximum clique size for G� is at most k���using Lemma ������ ppw�G� � k� Hence� bw�G� ppw�G��

This interesting � and somewhat surprising � equivalence between bandwidth and properpathwidth allows us to draw several immediate conclusions from the results on bandwidth�

Corollary ����A Finding the proper pathwidth is NP�hard� even for binary trees and for caterpillars with

Page 151: Advanced Topics in Algorithms Shamir

����� BANDWIDTH� PATHWIDTH AND PROPER PATHWIDTH ���

hair length at most three�B Problem A can be solved in O�f�k�nk��� time� and in particular is polynomial when k is�xed�C Deciding whether the proper pathwidth of a graph is not greater than two can be done inlinear time�

These results follow immediately from known results on bandwidth� using Theorem �����We �nish by mentioning two parametric results� The �rst deals with the unit interval

sandwich problem mentioned above�

Theorem ���� � Kaplan�Shamir �� � Deciding if a sandwich instance admits a properinterval sandwich graph with clique size at most k can be done in O�Ckn

k� time� and inparticular in polynomial time when k is �xed� Furthermore� it cannot be solved in O�Ckn

��where � is independent of k� unless deciding if a given graph has an independent set of size

k can be solved in O�C�

kn��

��

In contrast to that negative result� the completion problem for proper interval graphs istractable� in the parametric sense�

Theorem ���� � Kaplan� Shamir� Tarjan �� � Given a graph G � �V�E�� one candecide if there exists a proper interval graph G� � �V�E �� with E � E� and jE� n Ej � k intime O�Ck�jV j� jEj���

Page 152: Advanced Topics in Algorithms Shamir

Index

G�Decomposition� �H � G � h� ���� ��� �� �

a�b separator� adjacency set� ��adjacent� ����Perfect property� �antichain� ���asteroidal triplet� ���

Bipartite graph� ��

c�colorable� ��c�coloring� ��Chain� ��chain� ���chordal� �chordless� ��Chordless cycle� ��chromatic number� ��circle graphs� ��circular ��s property� ��clique� ��clique cover� ��clique cover number� ��clique matrix� clique number� ��closed neighborhood� ��co�graph� ���comparability graph� ��comparability invariants� ���complement� ��

complete� ��Complete bipartite graph� ��Composition� ��compositions� ���Connected graph� ��consecutive ��s property� ��Cycle� ��

Decomposition� ��dimension� ��duality� ��

edge� ��edge graph� �endpoints� ��

F�diagram� �

Hasse diagram� ���� ���helly� ��Helly property� ��hereditary property� ��

independent set� ��integral� intersection graph� ��� �Interval containment graph� ��interval graph� ��� ���interval order� �� interval representation� ��isomorphic� ��

join� �jump number� ���

���

Page 153: Advanced Topics in Algorithms Shamir

INDEX ��

layout� ��line graph� �linear extension� ��

maximal� ��maximum� ��minimal vertex separator� minimum realizer� ��Module� �monotone transitive� �

odd anti�hole� odd hole� open neighborhood� ��opposite permutation� ��Orientation� ��oriented graph� ��

p�critical� �Path� ��Pathwidth and Proper Pathwidth� �� perfect elimination� �perfect elimination order� permutation diagram� ��� ��permutation graph� ��proper circular arc graph� ��proper interval graph� ��

Quasi�Transitive Orientation� �

r�clique� ��realizer� ��reversal� ��rigid�circuit� �

series�parallel� ���simple� ��Simple cycle� ��simplicial� �stability number� ��stable set� ��strong perfect graph conjecture�

Strongly connected graph� ��subgraph� ��subgraph induced by A� ��symmetric closure� ��

Tolerance graph� ��triangle� ��triangulated� �triangulated graphs� ��

undirected� ��union� �unit interval graph� ��UPO� �utility function� ���

Vertex Multiplication� ��Extended� ��

vertex separator� vertices� ��

X�free� �