5eme cours : parcours de graphes mpri 2012 2013habib/documents/cours5-2012.pdf5eme cours : parcours...
TRANSCRIPT
5eme Cours : Parcours de graphes MPRI 2012–2013
5eme Cours : Parcours de graphesMPRI 2012–2013
Michel [email protected]
http://www.liafa.univ-Paris-Diderot.fr/~habib
Chevaleret, Paris, octobre 2012
5eme Cours : Parcours de graphes MPRI 2012–2013
Schedule
Introduction
4 points conditions
Lexicographic Breadth First Search LexBFS
MNS
Les parcours *
Composition of Searches
Diameter computations and the 4-sweep method
5eme Cours : Parcours de graphes MPRI 2012–2013
C’est un sujet au centre de mes recherches actuelles.Joint work with D. Corneil (Toronto), P. Crescenzi (Firenze), J.Dusart (PhD), R. Grossi (Pisa), A. Marino (PhD, Pisa)and many others such as : F. de Montgolfier, D. Fortin . . .
5eme Cours : Parcours de graphes MPRI 2012–2013
Introduction
Introduction
4 points conditions
Lexicographic Breadth First Search LexBFS
MNS
Les parcours *
Composition of Searches
Diameter computations and the 4-sweep method
5eme Cours : Parcours de graphes MPRI 2012–2013
Introduction
Graph searches are very well known and used
1. Euler (1735) for solving the famous walk problem inKœnisberg
2. Tremaux (1882) and Tarry (1895) using DFS to solve mazeproblems
3. Computer scientists from 1950, in particular in the 70’s, R.E.Tarjan for new applications of DFS....
4. But also : ”Fil d’ariane” in the Greek mythology.
5eme Cours : Parcours de graphes MPRI 2012–2013
Introduction
Tarry
5eme Cours : Parcours de graphes MPRI 2012–2013
Introduction
Umberto Eco, ”Il nome della rosa”, Roman, 1980
5eme Cours : Parcours de graphes MPRI 2012–2013
Introduction
Some definitions
Graph Search
The graph is supposed to be connected so as the set of visitedvertices After choosing an initial vertex, a search of a connectedgraph visits each of the vertices and edges of the graph such that anew vertex is visited only if it is adjacent to some previously visitedvertex.At any point there may be several vertices that may possibly bevisited next ; this generic graph search does not specify whichvertex to choose. The breadth-first search (BFS) and depth-firstsearch (DFS) algorithms are the traditional strategies fordetermining the next vertex to visit.
5eme Cours : Parcours de graphes MPRI 2012–2013
Introduction
Variations
Graph Traversal
The set of visited vertices is not supposed to be connected (usedfor computing connected components for example)
Cops and robbers games on a graph
The name Graph searching is also used in this context, with aslightly different meaning.
5eme Cours : Parcours de graphes MPRI 2012–2013
Introduction
Three main aspects for a graph search :
1. its principle or its algorithm(i.e. the description of the tie-break rules for the choice of thenext vertex (edge) to be explored )
2. The study of the underlying tree structure
3. The complexity analysis and its implementation or its program
5eme Cours : Parcours de graphes MPRI 2012–2013
Introduction
We will focus here on a fourth one :
I Here we consider a graph search as an operator acting on agraph and producing of a total ordering on the set of vertices(the order in which the vertices are visited by the search)
I I will try to convince you that this viewpoint can be helpful
5eme Cours : Parcours de graphes MPRI 2012–2013
Introduction
I Building bottom up graph algorithms form well-known
I Develop basic theoretic tools for the structural analysis ofgraphs
I No need to store sophisticated data structures, just somelabels on each vertex, can be used to deal with huge graphs
I Le syndrome du petit Poucet or Tom ThumbPutting little stones or breadcrump on the vertices in order tobacktrack
5eme Cours : Parcours de graphes MPRI 2012–2013
Introduction
Our goals
Fundamental Question
What kind of knowledge can we learn about the structure of agiven graph via graph searching (i.e. with one or a series ofsuccessive graph searches) ?
Practical issues
Build a toolbox of different graph searches and find methods toanalyze them
5eme Cours : Parcours de graphes MPRI 2012–2013
Introduction
Problem
For an undirected graph G = (V ,E ),explore the vertices of G ”traversing or following” the edges.
ResultI a tree structure rooted at the first visited vertex
I an ordering σ of the vertices
QuestionsI Under which conditions an ordering σ of the vertices
corresponds to a search ?
I What are the properties of these orderings ?
5eme Cours : Parcours de graphes MPRI 2012–2013
Introduction
Important reference for this today lecture :
These easy questions have been only recently systematicallyconsidered :D.G. Corneil et R. M. Krueger, A unified view of graph searching,SIAM J. Discrete Math, 22, Num 4 (2008) 1259-1276
5eme Cours : Parcours de graphes MPRI 2012–2013
4 points conditions
Introduction
4 points conditions
Lexicographic Breadth First Search LexBFS
MNS
Les parcours *
Composition of Searches
Diameter computations and the 4-sweep method
5eme Cours : Parcours de graphes MPRI 2012–2013
4 points conditions
Generic Search
7
1
2
3
4
56Invariant
At each step, an edge between a visited vertex and a unvisited oneis selected
5eme Cours : Parcours de graphes MPRI 2012–2013
4 points conditions
Generic search
S ← {s}for i ← 1 to n do
Pick an unumbered vertex v of Sσ(i)← vforeach unumbered vertex w ∈ N(v) do
if w /∈ S thenAdd w to S
endend
end
5eme Cours : Parcours de graphes MPRI 2012–2013
4 points conditions
Generic question ?
Let a, b et c be 3 vertices such that ab /∈ E et ac ∈ E .
a cb
Under which condition could we visit first a then b and last c ?
5eme Cours : Parcours de graphes MPRI 2012–2013
4 points conditions
Property (Generic)
For an ordering σ on V , if a < b < c and ac ∈ E and ab /∈ E , thenit must exist a vertex d such that d < b et db ∈ E
<
cba
d <
Theorem
For a graph G = (V ,E ), an ordering σ sur V is a generic search ofG iff σ satisfies property (Generic).
5eme Cours : Parcours de graphes MPRI 2012–2013
4 points conditions
Most of the searches that we will study are refinement of thisgeneric searchi.e. we just add new rules to follow for the choice of the nextvertex to be visitedGraph searches mainly differ by the management of the tie-breakset
5eme Cours : Parcours de graphes MPRI 2012–2013
4 points conditions
Property (BFS)
For an ordering σ on V , if a < b < c and ac ∈ E and ab /∈ E , thenit must exist a vertex d such that d < a et db ∈ E
d cba
Theorem
For a graph G = (V ,E ), an ordering σ sur V is a BFS of G iff σsatisfies property (BFS).
5eme Cours : Parcours de graphes MPRI 2012–2013
4 points conditions
Proprerty (DFS)
For an ordering σ on V , if a < b < c and ac ∈ E and ab /∈ E , thenit must exist a vertex d such that a < d < b and db ∈ E .
d cba
Theorem
For a graph G = (V ,E ), an ordering σ sur V is a DFS of G iff σsatisfies property (DFS).
5eme Cours : Parcours de graphes MPRI 2012–2013
4 points conditions
Applications of BFS
1. Distance computations (unit length), diameter and centers
2. BFS provides a useful layered structure of the graph
3. Using BFS to search an augmenting path provides apolynomial implementation of Ford-Fulkerson maximum flowalgorithm.
5eme Cours : Parcours de graphes MPRI 2012–2013
4 points conditions
Applications of DFS
Some applications
I Planarity testing.
I Computation of 2-connected (resp. strongly connected)components, 2-SAT solvers
I Computation of a linear extension (topological sorting) for anacyclic digraph, applications to inheritance mechanisms. . . .
5eme Cours : Parcours de graphes MPRI 2012–2013
Lexicographic Breadth First Search LexBFS
Introduction
4 points conditions
Lexicographic Breadth First Search LexBFS
MNS
Les parcours *
Composition of Searches
Diameter computations and the 4-sweep method
5eme Cours : Parcours de graphes MPRI 2012–2013
Lexicographic Breadth First Search LexBFS
Lexicographic Breadth First Search (LexBFS)
Data: a graph G = (V ,E ) and a start vertex s
Result: an ordering σ of V
Assign the label ∅ to all verticeslabel(s)← {n}for i ← n to 1 do
Pick an unumbered vertex v with lexicographically largest labelσ(i)← vforeach unnumbered vertex w adjacent to v do
label(w)← label(w).{i}end
end
5eme Cours : Parcours de graphes MPRI 2012–2013
Lexicographic Breadth First Search LexBFS
1
76
5
4
3
2
5eme Cours : Parcours de graphes MPRI 2012–2013
Lexicographic Breadth First Search LexBFS
It is just a breadth first search with a tie break rule.We are now considering a characterization of theorder in which a LexBFS explores the vertices.
5eme Cours : Parcours de graphes MPRI 2012–2013
Lexicographic Breadth First Search LexBFS
Property (LexB)
For an ordering σ on V , if a < b < c and ac ∈ E and ab /∈ E , thenit must exist a vertex d such that d < a et db ∈ E et dc /∈ E .
d cba
Theorem
For a graph G = (V ,E ), an ordering σ sur V is a LexBFS of G iffσ satisfies property (LexB).
5eme Cours : Parcours de graphes MPRI 2012–2013
Lexicographic Breadth First Search LexBFS
Why LexBFS behaves so nicely on well-structured graphs
A nice recursive property :On every tie-break set S , LexBFS operates on G (S) as a LexBFS.Analogous properties are false for other classical searches.
5eme Cours : Parcours de graphes MPRI 2012–2013
Lexicographic Breadth First Search LexBFS
Applications of LexBFS
1. Most famous one : Chordal graph recognition
2. For many classes of graphs using LexBFS ordering”backward” provides structural information on the graph.
3. Last visited vertex (or clique) has some property (examplesimplicial for chordal graph)
5eme Cours : Parcours de graphes MPRI 2012–2013
Lexicographic Breadth First Search LexBFS
Theorem [Tarjan et Yannakakis, 1984]
G is chordal iff every LexBFS ordering yields a simplicialelimination scheme.
Proof :
Let c be a non simplicial vertex.There exist a < b ∈ N(c) avec ab /∈ E .Using characterization of LexBFS orderings, it exists d < a withdb ∈ E and dc /∈ E . Since G is chordal, necessarily ad /∈ E .
d cba
5eme Cours : Parcours de graphes MPRI 2012–2013
Lexicographic Breadth First Search LexBFS
d cba
But then from the triple d , a, b, it exists d ′ < d with d ′a ∈ E andd ′b /∈ E . Furthermore d ′d /∈ E . . .And using the triple d’, d, a , we start an infinite chain .....
Remark
Most of the proofs based on some characteristic ordering of thevertices are like that, with no extra reference to the algorithm itself.
5eme Cours : Parcours de graphes MPRI 2012–2013
Lexicographic Breadth First Search LexBFS
LexDFS Lexicographic Depth First Search
BFS vs LexBFS
BFS
d cba
LexBFS
d cba
DFS vs LexDFS
DFS
d cba
LexDFS
d cba
5eme Cours : Parcours de graphes MPRI 2012–2013
Lexicographic Breadth First Search LexBFS
Property (LDFS)
For an ordering σ on V , if a < b < c and ac ∈ E and ab /∈ E , thenit must exist a vertex d such that a < d < b and db ∈ E anddc /∈ E .
d cba
Theorem
For a graph G = (V ,E ), an ordering σ sur V is a LexDFS of G iffσ satisfies property (LDFS).
5eme Cours : Parcours de graphes MPRI 2012–2013
Lexicographic Breadth First Search LexBFS
Lexicographic Depth First Search (LexDFS)
Data: a graph G = (V ,E ) and a start vertex s
Result: an ordering σ of V
Assign the label ∅ to all verticeslabel(s)← {0}for i ← 1 to n do
Pick an unumbered vertex v with lexicographically largest labelσ(i)← vforeach unnumbered vertex w adjacent to v do
label(w)← {i}.label(w)end
end
5eme Cours : Parcours de graphes MPRI 2012–2013
Lexicographic Breadth First Search LexBFS
5eme Cours : Parcours de graphes MPRI 2012–2013
Lexicographic Breadth First Search LexBFS
5eme Cours : Parcours de graphes MPRI 2012–2013
Lexicographic Breadth First Search LexBFS
5eme Cours : Parcours de graphes MPRI 2012–2013
Lexicographic Breadth First Search LexBFS
5eme Cours : Parcours de graphes MPRI 2012–2013
Lexicographic Breadth First Search LexBFS
5eme Cours : Parcours de graphes MPRI 2012–2013
Lexicographic Breadth First Search LexBFS
LexDFS
Complexity
Is it possible to compute a LexDFS in O(n + m) ?
Spinrad 2008
Best implementation so far needs O(n + mloglogn) using Van derBoas trees.
First application : D. Corneil, B. Dalton, M. H. 2010
Hamiltonicity on co-comparability graphs via LexDFS.
5eme Cours : Parcours de graphes MPRI 2012–2013
Lexicographic Breadth First Search LexBFS
Conclusions
Using the 4-points configurations we have the following inclusionordering between searches
Inclusions
Gen↗ ↑ ↖↗ ↑ ↖↗ ↑ ↖
BFS MNS DFS↑ ↗ ↑ ↖ ↑↑ ↗ ↑ ↖ ↑↑ ↗ ↑ ↖↑
LexBFS MCS LexDFS
5eme Cours : Parcours de graphes MPRI 2012–2013
MNS
Introduction
4 points conditions
Lexicographic Breadth First Search LexBFS
MNS
Les parcours *
Composition of Searches
Diameter computations and the 4-sweep method
5eme Cours : Parcours de graphes MPRI 2012–2013
MNS
Propriete (MNS)
Etant donne un ordre σ sur V , si a < b < c et ac ∈ E et ab /∈ E ,alors il existe un sommet d tel que d < b, db ∈ E et dc /∈ E .
<
cba
d <
5eme Cours : Parcours de graphes MPRI 2012–2013
MNS
Parcours generique
<
cba
d <
Le parcours suivant le voisinage maximal est donc le complete duparcours generique (par analogie a LexBFS (resp. LesDFS) quisont les completes de BFS (resp. DFS)). Ainsi MNS futinitialement appele LexGen.
5eme Cours : Parcours de graphes MPRI 2012–2013
MNS
Parcours MNS
Parcours par voisinage maximal (MNS)
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 to 1 faire
Choisir un sommet v d’etiquette maximal pour l’inclusion.σ(i)← vpour chaque sommet non-numerote w ∈ N(v) faire
label(w)← {i} ∪ label(w)fin
fin
5eme Cours : Parcours de graphes MPRI 2012–2013
MNS
Theoreme [Tarjan et Yannakakis, 1984]
G est un graphe chordal ssi tout parcours MNS fournit un schemasimplicial.
Preuve :
Soit c un sommet non simplicial a gauche. Il existe donca < b ∈ N(c) avec ab /∈ E . D’apres la caracterisation des ordresMNS, il existe d < b verifiant db ∈ E et dc /∈ E . Comme G estchordal, necessairement ad /∈ E .Soit d < a, dans ce cas, en considerant le triplet d , a, b, il existenecessairement d ′ < a tel que d ′a ∈ E et d ′b /∈ E . En outred ′d /∈ E .Soit a < d , en considerant le triplet a, d , c, il existe necessairementd ′ < d tel que d ′d ∈ E et d ′c /∈ E . En outre ad ′ /∈ E .Dans les deux cas une figure se propage strictement sur la gauche,d’ou la contradiction.
5eme Cours : Parcours de graphes MPRI 2012–2013
MNS
Corollaire
G est un graphe chordal ssi tout parcours Maximal CardinalitySearch (MCS) (resp LexBFS, LexDFS) fournit un schemasimplicial.
5eme Cours : Parcours de graphes MPRI 2012–2013
Les parcours *
Introduction
4 points conditions
Lexicographic Breadth First Search LexBFS
MNS
Les parcours *
Composition of Searches
Diameter computations and the 4-sweep method
5eme Cours : Parcours de graphes MPRI 2012–2013
Les parcours *
Parcours Generique *
Parcours *
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 to 1 faire
Choisir un sommet v suivant la regle du parcours mais appliqueea une composante connexe de G -{les sommets numerotes}.σ(i)← vpour chaque sommet non-numerote w ∈ N(v) faire
Modifier l’etiquette de w suivant la regle du parcoursfin
fin
5eme Cours : Parcours de graphes MPRI 2012–2013
Les parcours *
Definition
Nous pouvons donc definir les parcours suivants : LexBFS*,LexDFS*, MCS*, MNS*.
Premieres Proprietes
I GEN = GEN *
I LexBFS* n’est plus un parcours un largeur et LexDFS* n’estplus un parcours en profondeur
5eme Cours : Parcours de graphes MPRI 2012–2013
Les parcours *
Caracterisation de MNS *
Propriete (MNS *)
Etant donne un ordre σ sur V , si a < b < c et ac ∈ E et ab /∈ E ,alors il existe un sommet d < b tel que db ∈ E . En outre si b, c ∈la meme composante connexe de G − {a]} alors dc /∈ E .
Caracterisations
Un ordre σ sur V provient d’un parcours MNS* ss’il verifie lapropriete ci-dessus.On obtient des conditions analogues pour LexBFS*, LexFS*.
5eme Cours : Parcours de graphes MPRI 2012–2013
Les parcours *
D’apres le configurations interdites nous retrouvons les inclusionssuivantes :
Inclusions
Gen↑↑
MNS*↗ ↑ ↖↗ ↑ ↖↗ ↑ ↖
LexBFS* MCS* LexDFS*
5eme Cours : Parcours de graphes MPRI 2012–2013
Les parcours *
Theoreme Shier 1984
Sur un graphe chordal MNS* =LexBFS* = LexDFS* = MCS* ={ l’ensemble de tous les schemas d’elimination simpliciaux }.
Preuve
Soit c le premier sommet non simplicial a gauche. Il existe donca < b ∈ N(c) avec ab /∈ E . b et c appartiennent a la comp.connexe de G − a] et donc nous pouvons utiliser le memeraisonnement que celui utilise pour MNS.Ainsi tout ordre MNS* fournit un schema simplicial.Nous avons montre G chordal ssi tout parcours MNS* (resp.LexBFS*, LexDFS*, MCS*) fournit un schema d’eliminationsimplicial.
5eme Cours : Parcours de graphes MPRI 2012–2013
Les parcours *
lemme
On considere un schema simplicial σ et supposons a <σ b et qu’ilexiste une chaıne de a vers b dans G − a[. Alors il existe unechaıne a0 = a <σ a1 · · · <σ ak = b compatible avec σ.
5eme Cours : Parcours de graphes MPRI 2012–2013
Les parcours *
MNS* ⊇ tous les schemas simpliciaux.
Soit σ un schema simplicial et supposons qu’il existe c <σ b <σ atels que b et c appartiennent a la meme composante connexe deG − a[, et ab /∈ E , ac ∈ E .D’apres le lemme il existe un chaıne de c vers b compatible avec σ,la simplicialite implique que tous les sommets de cette chaıne sontadjacents a a y compris b et donc ab ∈ E d’ou la contradiction.Donc σdual verifie bien la propriete MNS*.
La preuve est identique pour LexBFS*, LexDFS*, MCS*.
5eme Cours : Parcours de graphes MPRI 2012–2013
Les parcours *
Search classification
Search Tie-break management
Generic search none (random)
BFS queue
DFS stack
LexBFS Lexicographic maximal
LexDFS Lexicographic maximal
MNS Maximal under inclusion
MCS Maximal for the cardinality
5eme Cours : Parcours de graphes MPRI 2012–2013
Les parcours *
Importance of 4 points conditions for graph recognition
Many classes of graphs or partial orders can be characterized bythe existence of a particular ordering of the vertices with someforbidden configuration on three points.Examples with forbidden configuration on three points :
1. Interval graphs : ordering of the left ends of the intervals.
2. Chordal : simplicial elimination ordering.
3. Co-comparability : transitivity violation of the complementgraph
4. Permutation : transitivity violation of the graph and itscomplement.
5eme Cours : Parcours de graphes MPRI 2012–2013
Les parcours *
Forbidden 3 points suborderings
5eme Cours : Parcours de graphes MPRI 2012–2013
Les parcours *
Consequences
LexBFS is involved in many recognition algorithms for these classesof graphs.
I Apply a LexBFS on G giving an ordering σ
I If G is a comparability graph the last vertex of σ, can betaken as a source in a transitive orientation of G .
I The starting point for comparability and permutation graphrecognition algorithms.
5eme Cours : Parcours de graphes MPRI 2012–2013
Les parcours *
Applications
I BFS to compute distances, diameter, centersHeuristics for diameter
I DFS planarity, strongly connected components, 2-SAT, . . .
I LexBFS, recognition of chordal graphs, interval graphs . . .Recursive behavior on tie-break sets.Heuristics for one consecutiveness property
I LexDFS, long paths, minimum path coverFor co-comparability graphs LexDFS computes layeredordering of the complement partial order.Heuristics for graph clustering
5eme Cours : Parcours de graphes MPRI 2012–2013
Composition of Searches
Introduction
4 points conditions
Lexicographic Breadth First Search LexBFS
MNS
Les parcours *
Composition of Searches
Diameter computations and the 4-sweep method
5eme Cours : Parcours de graphes MPRI 2012–2013
Composition of Searches
Since we focus on the ordering of the vertices as the result of agraph search, now we can compose graph searches in a natural way.Therefore we can denote by M(G , x0) the order of the verticesobtained by applying M on G starting from the vertex x0.
Definition of the + Rule
Let M be a graph search and σ an ordering of the vertices of G ,M+(G , σ) be the ordering of the vertices obtained by applying Mon G starting from the vertex σ(1) and tie-breaking using σ indecreasing order.
5eme Cours : Parcours de graphes MPRI 2012–2013
Composition of Searches
Why this Rule ?
The + Rule forces to keep the ordering of the previous sweep incase of tie-break
5eme Cours : Parcours de graphes MPRI 2012–2013
Composition of Searches
I Graph searches operate on total orderings :Step 0 : σ = M(G , x0)Step 1 : M(G , σ)Step 2 : M2(G , σ) = M(G ,M(G , σ)). . .Step i : M i (G , σ) = M(G ,M i−1(G , σ)). . .
I For which search M and graph G does there exist fixedpoints ?
I Unfortunately a formal study of this composition remains tobe done !
I Also called multisweep algorithms.
5eme Cours : Parcours de graphes MPRI 2012–2013
Composition of Searches
1. Such an idea was already used for planarity testing in somealgorithm (de Fraysseix and Rosentiehl 1980) with 2consecutive DFS.
2. Algorithms for strongly connected components by Kosaraju1978, Sharir 1981In our framework,1) DFS(G )2) DFS(G−, postd)
3. To compute efficiently the diameter of a graph usingsuccessive BFS
5eme Cours : Parcours de graphes MPRI 2012–2013
Composition of Searches
Linear time recognition algorithms for interval graphs
I Booth and Lueker 1976, using PQ-trees.
I Korte and Mohring 1981 using LexBFS and ModifiedPQ-trees.
I Hsu and Ma 1995, using modular decomposition and avariation on Maximal Cardinality Search.
I Corneil, Olariu and Stewart SODA 1998, using a series of 5+1special consecutive LexBFS, published in 2010.
I M.H, McConnell, Paul and Viennot 2000, using LexBFS andpartition refinement on maximal cliques (a kind of LexBFS oncliques and minimal separators).
I New ! Peng Li, Yaokun Wu, using 3 +1 special LexBFS, 2011
5eme Cours : Parcours de graphes MPRI 2012–2013
Composition of Searches
Repeated LexBFS
Require: G = (V ,E )Ensure: an ordering σσ ← LexBFS(G)for i = 2 to |V | doσ ← LexBFS+(G,σ)
end for
Algorithm 1: LexBFS+ multi-sweep
5eme Cours : Parcours de graphes MPRI 2012–2013
Composition of Searches
Property
If G = (V ,E ) is an interval graph, that the previous algorithmfinds a fixed point in less than |V | iterations
5eme Cours : Parcours de graphes MPRI 2012–2013
Composition of Searches
C1
C2
C3C4
C5
C6
C7
ab
cde f
gh
i
j
k
LexBFS(G, c) : c, d, e, a, f, g, h, i, j, k, b
LexBFS(G, c) C2 C3 C4 C5 C6 C7 C1
5eme Cours : Parcours de graphes MPRI 2012–2013
Composition of Searches
C1
C2
C3C4
C5
C6
C7
ab
cde f
gh
i
j
k
LexBFS(G , c) : c, d, e, a, f, g, h, i, j, k, bLexBFS+(LexBFS(G , c)) : b, a, i, h, d, c, g, f, e, j, k
LexBFS(G , c) C2 C3 C4 C5 C6 C7 C1
LexBFS+(LexBFS(G , c)) C1 C5 C4 C3 C2 C6 C7
5eme Cours : Parcours de graphes MPRI 2012–2013
Composition of Searches
C1
C2
C3C4
C5
C6
C7
ab
cde f
gh
i
j
k
LexBFS+(LexBFS(G , c)) : b, a, i, h, d, c, g, f, e, j, kLexBFS3+(G , c) : k, c, j, h, g, d, a, i, f, e, b
LexBFS(G , c) C2 C3 C4 C5 C6 C7 C1
LexBFS2+(G , c) C1 C5 C4 C3 C2 C6 C7
LexBFS3+(G , c) C7 C6 C4 C5 C3 C2 C1
5eme Cours : Parcours de graphes MPRI 2012–2013
Composition of Searches
C1
C2
C3C4
C5
C6
C7
ab
cde f
gh
i
j
k
LexBFS3+(G , c) : k, c, j, h, g, d, a, i, f, e, bLexBFS4+(G , c) : b, a, e, d, c, f, g, h, i, j, k
LexBFS(G , c) C2 C3 C4 C5 C6 C7 C1
LexBFS2+(G , c) C1 C5 C4 C3 C2 C6 C7
LexBFS3+(G , c) C7 C6 C4 C5 C3 C2 C1
LexBFS4+(G , c) C1 C2 C3 C4 C5 C6 C7
5eme Cours : Parcours de graphes MPRI 2012–2013
Composition of Searches
Generalization to comparability graphs
Question
If G = (V ,E ) is co-comparability graph, what can be said ?Is the series (LBFS+(G ))i periodic (with a period less than |V | ) ?i.e. ∃i < j ≤ n such that :(LBFS+(G ))i = (LBFS+(G ))j .Is (LBFS+(G ))i a cocomp ordering ?
5eme Cours : Parcours de graphes MPRI 2012–2013
Composition of Searches
Lemma 1
For every cocomp graph G , it exists a cocomp order which is aLexBFS order.
Lemma 2
If σ is a cocomp order, then (LBFS+(G , σ) is still a cocomp order.
5eme Cours : Parcours de graphes MPRI 2012–2013
Composition of Searches
LBFS OrderingsLBFS OrderingsCocomp ordersCocomp orders
Another way to produce a transitive orientation in linear time
5eme Cours : Parcours de graphes MPRI 2012–2013
Composition of Searches
Some applications
Three applications :
1. Hamiltonicity on co-comparability graphs, D. Corneil, B.Dalton, M.H. 2010
2. New linear extensions for partial orders D. Corneil, M.H., E.Kohler, 2012
3. Exact diameter computations using a series of BFS, P.Crescenzi, R. Grossi, M.H., L. Lanzi, A. Marino, 2011.
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
Introduction
4 points conditions
Lexicographic Breadth First Search LexBFS
MNS
Les parcours *
Composition of Searches
Diameter computations and the 4-sweep method
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
Diameter computations
” While theoretical work on models of computation and methodsfor analyzing algorithms has had enormous payoffs, we are notdone. In many situations, simple algorithms do well. We don’tunderstand why ! Developing means for predicting the performanceof algorithms and heuristics on real data and on real computers isa grand challenge in algorithms.” Challenges for Theory ofComputing by :CONDON, EDELSBRUNNER, EMERSON, FORTNOW, HABER,KARP, LEIVANT, LIPTON, LYNCH, PARBERRY,PAPADIMITRIOU, RABIN, ROSENBERG, ROYER, SAVAGE,SELMAN, SMITH, TARDOS, AND VITTER, Report for anNSF-sponsored workshop on research in theoretical computerscience.
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
Basics Definitions
Definitions :
Let G be an undirected graph :
I exc(x) = maxy∈G{distance(x , y)} excentricity
I diam(G ) = maxx∈G{exc(x)} diameter
I radius(G ) = minx∈G{exc(x)}I x ∈ V is a center of G , if exc(x) = radius(G )
First remarks of the definitions
distance computed in # edgesIf x and y belong to different connected components d(x , y) =∞.diameter : Max Max Minradius : Min Max Min
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
Trivial bounds
For any graph G :radius(G ) ≤ diam(G ) ≤ 2radius(G ) and ∀e ∈ G ,diam(G ) ≤ diam(G − e)
These bounds are tight
I If G is a path of length 2K, then diam(G ) = 2k = 2radius(G ),and G admits a unique center, i.e. the middle of the path.
I If radius(G ) = diam(G ), then Center(G ) = V . All vertices arecenters (as for example in a cycle).
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
If 2.radius(G ) = diam(G ), then *roughly* G has a tree shape (atleast it works for trees).But there is no nice characterization of this class of graphs.
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
Diameter
Applications
1. A graph parameter which measures the quality of services of anetwork, in terms of worst cases, when all have a unitary cost.Find critical edges e s.t. diam(G − e) > diam(G )
2. Many distributed algorithms can be analyzed with thisparameter (when a flooding technique is used to spreadinformation over the network or to construct routing tables).
3. Verify the small world hypothesis in some large socialnetworks, using J. Kleinberg’s definition of small world graphs.
4. Compute the diameter of the Internet graph, or some Webgraphs, i.e. massive data.
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
FAQ
Usual questions on diameter, centers and radius :
I What is the best Program (resp. algorithm) available ?
I What is the complexity of diameter, center and radiuscomputations ?
I How to compute or approximate the diameter of huge graphs ?
I Find a center (or all centers) in a network, (in order to installserveurs).
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
Some notes
1. I was asked first this problem in 1980 by France Telecom forthe phone network (FT granted a PhD).
2. Marc Lesk obtained his PhD in 1984 with the title :Couplages maximaux et diametres de graphes.Maximum matchings and diameter computations
3. But, with very little practical results.
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
I Our aim is to design an algorithm or heuristic to compute thediameter of very large graphs
I Any algorithm that computes all distances between all pairs ofvertices, complexity O(n3) or O(nm). As for example with |V |successive Breadth First Searches in O(n(n + m)).
I Best known complexity for an exact algorithm is O( n3
log2n)
I At most O(Diam(G )) matrix multiplications.
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
1. Let us consider the procedure called : 2 consecutive BFS
Data: A graph G = (V ,E )
Result: u, v two vertices
Choose a vertex w ∈ Vu ← BFS(w)v ← BFS(u)
Where BFS stands for Breadth First Search.Therefore it is a linear procedure
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
Intuition behind the procedure
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
I FolkloreIf G is a tree, diam(G ) = d(u, v)Easy using Jordan’s theorem.
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
First theorem
Camille Jordan 1869 :
A tree admits one or two centers depending on the parity of itsdiameter and furthermore all chains of maximum length starting atany vertex contain this (resp. these) centers.
And radius(G ) = ddiam(G)2 e
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
Unfortunately it is not an algorithm !
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
Certificates for the diameter
To give a certificate diam(G ) = k , it is enough to provide :
I two vertices x , y s.t. d(x , y) = k (diam(G ) ≥ k).
I a subgraph H ⊂ G with diam(H) = k (diam(G ) ≤ k).H may belong to a class of graphs on which diametercomputations can be done in linear time.
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
Experimental results : M.H., M.Latapy, C. Magnien 2007
Randomized BFS procedure
Data: A graph G = (V ,E )
Result: u, v two vertices
Repeat α times :Randomly Choose a vertex w ∈ Vu ← BFS(w)v ← BFS(u)Select the vertices u0, v0 s.t. distance(u0, v0) is maximal.
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
1. This procedure gives a vertex u0 such that :exc(u0) ≤ diam(G ) i.e. a lower bound of the diameter.
2. Use a spanning tree as a partial subgraph to obtain an upperbound by computing its exact diameter in linear time.
3. Spanning trees given by the BFS.
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
I The Program and some Data on Web graphs or P-2-Pnetworks can be found
I http://www-rp.lip6.fr/~magnien/Diameter
I 2 millions of vertices, diameter 32 within 1
I Further experimentations by Crescenzi, Grossi, Marino (inESA 2010)which confirm the excellence of the lower bound usingBFS ! ! ! !
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
I Since α is a constant (≤ 1000), this method is still in lineartime and works extremely well on huge graphs (Web graphs,Internet . . .)
I How can we explain the success of such a method ?
I Due to the many counterexamples for the 2 consecutive BFSprocedure. An explanation is necessary !
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
2 kind of explanations
The method is good or the data used was good.
Partial answer
The method also works on several models of random graphs.So let us try to prove the first fact
Restriction
First we are going to focus our study on the 2 consecutive BFS.
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
Chordal graphs
1. A graph is chordal if it has no chordless cycle of length ≥ 4 .
2. If G is a chordal graph, Corneil, Dragan, H., Paul 2001, usinga variant called 2 consecutive LexBFSd(u, v) ≤ diam(G ) ≤ d(u, v) + 1
3. Generalized by Corneil, Dragan, Kohler 2003 using 2consecutive BFS :d(u, v) ≤ diam(G ) ≤ d(u, v) + 1
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
The 4-sweep method :Crescenzi, Grossi, MH, Lanzi,Marino 2011
L = max{ecc(a1), ecc(a2)} and R = min{ecc(r), ecc(m1)}
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
Ce n’est pas un algorithme !
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
An exact algorithm !
Compute the excentricity of the leaves of the treewith a stop condition.Complexity is O(nm) in the worst case, but often linear in practice.
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
iFub an exact O(mn) algorithm
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
Bad example
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
Results,
Diametre Facebook = 41 ! Backstrom, Boldi, Rosa, Uganden,Vigna 2011
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
Up to now
At least 2 new searches with no applications yet2 consecutive LBFS enough to recognize cographs4-5 consecutive LBFS are enough to capture the structure intervalgraphs(similar result for co-comparability graphs) ?
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
Easy extensions
1. To weighted graphs by replacing BFS with Dijkstra’s algorithm
2. To directed graphs
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
Some Perspectives
1. Extend diameter results to efficient computation of centers(one or all)
2. Understand why the 4-sweep method works so well (analogywith Quicksort) 1
3. Uses a series of graph search for preprocessing when faced tohard combinatorial problems (already used in biologicalapplications of interval graphs and for quadratic integerprogramming) Consecutive Ones property (C1P) (find a goodordering of the columns of the matrix such that in each rowthe ones are consecutive) A kind of filtering process !
4. A theory of graph searches : searchoids special cases ofgreedoids ? Develop theoretical tools to analyze multisweepalgorithms and prove fixed points properties using latticetheory.
1. Sujets de stages MPRI possibles
5eme Cours : Parcours de graphes MPRI 2012–2013
Diameter computations and the 4-sweep method
Hints for future work
1. Develop approximation algorithms even for polynomialproblems but applied on huge data on which only linear timealgorithms can be processed.
2. Apply to max flow problems in competition with spectralgraph theory a la PageRank
3. Reconsider consecutive ones property and planarity
4. Community detection in networks (using LexDFS ?) 2
2. Sujets de stages MPRI possibles