1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great...

41
1 er Cours : Introduction MPRI 2010–2011 1 er Cours : Introduction MPRI 2010–2011 Michel Habib [email protected] http://www.liafa.jussieu.fr/ ~ habib Chevaleret, septembre 2010

Transcript of 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great...

Page 1: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

1er Cours : IntroductionMPRI 2010–2011

Michel [email protected]

http://www.liafa.jussieu.fr/~habib

Chevaleret, septembre 2010

Page 2: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Schedule

Introduction

Which algorithms ?

Structuration and decomposition

Schedule of the course

Problems and Exercises

Graph Representations

Chordal graphsParcours en largeur lexicographique LexBFSOrdre d’elimination simplicial

Page 3: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Introduction

First question

Why such a course ?

Fagin’s theorems in structural complexity

Characterizations of P and NP using graphs and logics fragments.

NP

The class of all graph-theoretic properties expressible in existentialsecond-order logic is precisely NP.

P

The class of all graph-theoretic properties expressible in Hornexistential second-order logic with successor is precisely P.

Page 4: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Introduction

Practical issues

Many applications involve graph algorithms, in particular manyfacets of computer science ! ! !

Page 5: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Introduction

The great importance of the right model

It is crucial to use all the characteristics of the problem you wantto solve. Two examples from Peter Winkler’s nice book onMathematical Puzzles :

1. Soldiers in a field

2. A problem on rectangles

Page 6: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Introduction

Graph invariants

A graph invariant is a function G → f (G ) ∈ N, which is invariantunder isomorphism (i.e. if G and H are isomorphic thenf (G ) = f (H)).

Page 7: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Which algorithms ?

Which algorithms ?

◮ Optimal

◮ Linear

◮ Efficient

◮ Simples

◮ Easy to program

Page 8: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Which algorithms ?

In our work on optimisation problems on graphs, we will metseveral complexity barriers :

◮ Polynomial versus NP hardIn this case an algorithm running in O(n75.m252) could be anice result !

◮ Linear versus Boolean matrix multiplicationAlgorithms running in O(n.m), hard to find a lower bound !

◮ Practical issues need linear algorithms in order to be applied◮ on huge graphs such as Web graph . . ..◮ many times such as inheritance in object oriented

programming.◮ Need for heuristics !

Page 9: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Structuration and decomposition

Our Claims or thesis

An efficient algorithm running on a discrete structure is alwaysbased on a combinatorial decomposition of this discrete structure.For some other cases a geometric representation of the structureprovides the algorithm.

Examples

◮ Chordal graph recognition and maximal clique trees (particular case of treewidth).

◮ Transitive orientation and modular decompostion.

◮ Max Flow and decomposing a flow in a sum of positivecircuits.

◮ Minimum spanning trees and matroids

◮ . . .

Page 10: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Structuration and decomposition

Uses of geometric reprsentations

◮ Computing a maximum clique (of maximum size) or anefficient representation of an interval graph.

◮ Numerous algorithms on planar graphs use a representation ofthe dual.

Page 11: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Schedule of the course

Academic year : 2010-2011

◮ 2 members of the group : Algorithmique et Combinatoire duLIAFA :

◮ Michel Habib (Pr Univ. Paris Diderot)

◮ Nicolas Trotignon (CR1 CNRS)

◮ contact : [email protected]

Page 12: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Schedule of the course

Examples of algorithmic problems

◮ shortest paths, reachability (existence of a path)

◮ Center and diameter computation

◮ graphe encoding, distance labeling

◮ Routing

◮ Sandwich (or completion) problems

◮ Colorations

Page 13: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Schedule of the course

Decompositions used here

◮ modular decomposition

◮ split decomposition

◮ Largeur de clique (cliquewidth)

◮ Largeur d’arborescence (treewidth), largeur de chaıne(pathwidth)

◮ Largeur de branche (branchwidth)

Page 14: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Schedule of the course

Graph classes used here

◮ Tournaments (Tournois), ensembles ordonnes, graphes bipartis

◮ Cographs

◮ Interval graphs

◮ Graphes triangules (Chordal)

◮ Graphes de comparabilite

◮ Graphes sans triplet asteroıdal

◮ Graphes distance-hereditaires

◮ Graphes de permutation

◮ Graphes parfaits

◮ Graphes convexes, bi-convexes, . . .

Page 15: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Schedule of the course

Typical questions

◮ Algorithmes de reconnaissance, si possible lineaires etrobustes.

◮ Algorithmes de decomposition efficaces

◮ Codages compacts et representations

◮ Enumeration et generation aleatoire

◮ Calculs de diametre, routages

◮ Optimisation d’invariants sur la classe (par exemple cliquemaximum). Soit un algorithme polynomial, soit une reductionde NP-completude.

Page 16: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Schedule of the course

Application domains

Themes◮ Biocomputing

◮ Networks (P-2-P)

◮ Distributed systems

◮ Analysis of huge graphs

GANG

Une equipe-projet INRIA–LIAFA sur les graphes et les reseaux,dirigee par L. Viennot

Page 17: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Schedule of the course

Extensions

◮ Algorithmes et structures donnees dynamiques

◮ Algorithmique probabiliste ou randomisee

◮ Applications aux tres grands graphes

◮ Algorithmique sous-lineaire, decision sans avoir consideretoute la donnee.

Page 18: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Schedule of the course

Notation

For a finite loopless undirected graph G = (V ,E )V set of verticesE edges set|V | = n and |E | = m

Page 19: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Problems and Exercises

Some exercises

1. A linear algorithm for isomorphism on trees

2. Computation of the diameter of a tree

3. Ecrire un algorithme qui verifie l’existence d’une clique ayant∆ + 1 sommets dans un graphe de degre maximum ∆?

Page 20: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Problems and Exercises

Exercices

1. On considere un graphe G dont la clique maximum a pourcardinal 2k , montrer qu’il existe une partition des sommets endeux sous-ensembles A,B tels ω(G (A)) = ω(G (B)) ?Peut-on calculer cette partition en temps polynomial (si onpart d’une clique maximum de G ) ?

2. Quelle est la complexite d’un algorithme de routage ? Parexemple RIP dans Internet.

Page 21: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Problems and Exercises

Solution de l’exercice

◮ Ecrire un algorithme qui verifie l’existence d’une clique ∆ + 1sommets dans un graphe de degre maximum ∆?

◮ Une solutionSoit S l’ensemble des sommets de degre ∆ du graphe.Tant qu’il existe a ∈ S ayant un voisin hors de S , eliminer ade S .Les composantes connexes de taille exactement ∆ + 1 sontdes bonnes reponses.

◮ L’algorithme est en O(n +m).

Page 22: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Problems and Exercises

Bornes sur le nombre d’aretes

Graphes sans triangles

Montrer que si G n’a pas de triangle alors

|E | ≤ |V |2

4

Graphes planaires

Montrer que si un graphe est planaire simple (i.e. sans boucle niaretes multiples) alors :|E | ≤ 3|V | − 6

Page 23: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Problems and Exercises

Research Problems

◮ Find a linear-time algorithm that minimizes a deterministicautomaton.

◮ Find a linear-time algorithm which computes a doublylexicographic ordering of a 0-1 matrix, i.e. an ordering of thecolumns and the lines for which lines and columns appear tobe lexicographically ordered.

Page 24: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Problems and Exercises

Example of a doubly lexicographic ordering

C1 C2 C3 C4 C5

L1 1 0 1 0 1

L2 0 1 0 1 1

L3 1 1 0 1 1

L4 0 0 0 0 1

L5 0 1 1 0 0

C3 C1 C4 C5 C2

L4 0 0 0 1 0

L1 1 1 0 1 0

L5 1 0 0 0 1

L2 0 0 1 1 1

L3 0 1 1 1 1

Page 25: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Problems and Exercises

◮ Such an ordering always exists

◮ Best algorithm to compute one :Paige and Tarjan [1987] proposed an O(LlogL) whereL = n+m+ e for a matrix with n lines, m columns and e nonzero values, using partition refinement.

◮ For undirected graphs, such an ordering of the symmetricincidence matrix, yields an ordering of the vertices which hasnice properties.

Page 26: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Graph Representations

◮ Implicit hypothesis : the memory words have k bits withk > ⌈log(|V |)⌉

◮ To be sure, consider the bit encoding level

Page 27: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Graph Representations

◮ Adjacency listsO(|V |+ |E |) memory wordsAdjacency test : xy is an arc in O(|N(x)|)

◮ Adjacency MatrixO(|V |2) memory words (can be compressed)Adjacency test : xy is an arc in O(1)

◮ Customized representations, a pointer for each arc . . .

Page 28: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Graph Representations

For some large graphs, the Adjacency matrix, is not easy to obtainand manipulate.But the neighbourhood of a given vertex can be obtained. (WEBGraph)

Page 29: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Graph Representations

Quicksands

◮ To compute this invariant or this property of a given graph Gone needs to ”see”( or visit) every edge at least once.

◮ False statement as for example the computation of twins resp.connected components on G knowing G .

Page 30: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Graph Representations

Exercice

Comment allier les avantages des deux representations ?liste d’adjacence : construction en O(n +m)Matrices d’adjacence : acces a un arc en O(1)

Espace O(n2) mais en gardant la possibilite d’ecrire desalogrithmes lineaires ?

Page 31: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Graph Representations

Auto-complemented representations

Initial Matrix

1 2 3 4

1 1 1 1 0

2 0 0 1 0

3 1 0 1 1

4 1 0 0 0

Tagged Matrix

1 2 3 4

1 0 1 0 0

2 1 0 0 0

3 0 0 0 1

4 0 0 1 0

Page 32: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Graph Representations

◮ At most 2n tags (bits).O(n +m′) with m′ << m.Dalhaus, Gustedt, McConnell 2000

◮ What can be computed using such representations ?Example : strong connected components of G , knowing G ?

Page 33: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Graph Representations

◮ Find a minimum sized representation

◮ If G is undirected a minimum is unique.

Page 34: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Graph Representations

What is an elementary operation for a graph ?

◮ Traversing an edge or Visiting the neighbourhood ?

◮ It explains the very few lower bounds known for graphalgorithms on a RAM Machine.

◮ Our graph algorithms must accept any auto-complementedrepresentation.Partition Refinement

Page 35: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Chordal graphs

Parcours en largeur lexicographique LexBFS

Parcours en largeur lexicographique (LexBFS)

Donnees: Un graphe G = (V ,E ) et un sommet source s

Resultat: Un ordre total σ de VAffecter l’etiquette ∅ a chaque sommetlabel(s)← {n}pour i ← n a 1 faire

Choisir un sommet v d’etiquette lexicographique max.σ(i)← vpour chaque sommet non-numerote w ∈ N(v) faire

label(w)← label(w).{i}fin

fin

Page 36: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Chordal graphs

Parcours en largeur lexicographique LexBFS

1

76

5

4

3

2

Page 37: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Chordal graphs

Parcours en largeur lexicographique LexBFS

C’est un parcours en largeur avec une regle de tie-break bizarre.

Page 38: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Chordal graphs

Ordre d’elimination simplicial

Graphe triangule

5

1 4 38

6 7 2

Un sommet est simplicial si son voisinage est une clique.

Ordre d’elimination simplicial

σ = [x1 . . . xi . . . xn] est un ordre d’elimination simplicial si xi estsimplicial dans le sous-graphe Gi = G [{xi . . . xn}]

ca b

Page 39: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Chordal graphs

Ordre d’elimination simplicial

Caracterisation

Un graphe est triangule ssi il possede un ordre d’eliminationsimplicial.

Caracterisation LexBFS [Rose, Tarjan et Lueker 1976]

Un graphe G est triangule ssi tout ordre LexBFS de G estsimplicial.

1 8

7

6

5

4

32

Page 40: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Chordal graphs

Ordre d’elimination simplicial

How can we prove such a theorem ?

1. A direct proof, finding the invariants ?

2. Find some structure of chordal graphs

3. Understand how LexBFS explores a chordal graph

Page 41: 1er Cours : Introduction MPRI 2010 2011 › ~habib › Documents › 1ercours.pdf · The great importance of the right model ... Linear versus Boolean matrix multiplication Algorithms

1er Cours : Introduction MPRI 2010–2011

Chordal graphs

Ordre d’elimination simplicial

A characterisation theorem for chordal graphs

Theorem

Dirac 1961, Fulkerson, Gross 1965, Gavril 1974, Rose, Tarjan,Lueker 1976.

(0) G is chordal (every cycle of length ≥ 4 has a chord) .

(i) G has a simplicial elimination scheme

(ii) Every minimal separator is a clique