• Aucun résultat trouvé

NLC-2 graph recognition and isomorphism

N/A
N/A
Protected

Academic year: 2021

Partager "NLC-2 graph recognition and isomorphism"

Copied!
13
0
0

Texte intégral

(1)

HAL Id: hal-00134605

https://hal.archives-ouvertes.fr/hal-00134605

Submitted on 2 Mar 2007

HAL is a multi-disciplinary open access

archive for the deposit and dissemination of

sci-entific research documents, whether they are

pub-lished or not. The documents may come from

teaching and research institutions in France or

abroad, or from public or private research centers.

L’archive ouverte pluridisciplinaire HAL, est

destinée au dépôt et à la diffusion de documents

scientifiques de niveau recherche, publiés ou non,

émanant des établissements d’enseignement et de

recherche français ou étrangers, des laboratoires

publics ou privés.

NLC-2 graph recognition and isomorphism

Vincent Limouzy, Fabien de Montgolfier, Michaël Rao

To cite this version:

Vincent Limouzy, Fabien de Montgolfier, Michaël Rao. NLC-2 graph recognition and isomorphism.

Graph-Theoretic Concepts in Computer Science 33rd International Workshop, WG 2007, Dornburg,

Germany, June 21-23, 2007., Jun 2007, Dornburg, Germany. pp.86-98, �10.1007/978-3-540-74839-7_9�.

�hal-00134605�

(2)

hal-00134605, version 1 - 2 Mar 2007

Vin ent Limouzy

1

Fabiende Montgoler

1

Mi haël Rao

1

Abstra t

NLC-widthisavariantof lique-widthwithmanyappli ationingraphalgorithmi . This paperisdevotedtographsofNLC-widthtwo. Aftergivingnewstru tural propertiesof the lass,weproposea

O(n

2

m)

-timealgorithm,improvingJohansson'salgorithm[14℄.Moreover, ouralogrithmissimpletounderstand. Theabovepropertiesandalgorithmallowustopropose arobust

O(n

2

m)

-timeisomorphismalgorithmforNLC-2graphs.Asfarasweknow,itisthe rstpolynomial-timealgorithm.

1 Introdu tion

NLC-width is a graph parameter introdu ed by Wanke [16 ℄. This notion is tightly related to

lique-width introdu ed by Cour elle et al. [2℄. Both parameters were introdu ed to generalise the well known tree-width. The motivation on resear h about su h width parameter is that, whenthewidth(NLC-, lique-ortree-width) isbounded bya onstant,thenmanyNP- omplete

problems anbesolvedinpolynomial(even linear)time, ifthede omposition isprovided. Su h parameters give insights on graph stru tural properties. Unfortunately, nding the minimumNLC-width of the graphwasshownto be NP-hard byGurskiet al. [12 ℄. Some results

however are known. Let NLC-

k

be the lass of graph of NLC width bounded by

k

. NLC-1 is exa tly the lass of ographs. Probe- ographs, bi- ographs and weak-bisplit graphs [9℄ belong to NLC-2. Johansson[14 ℄ proved that re ognising NLC-2graphs is polynomial and provided an

O(n

4

log(n))

re ognitionalgorithm. Complexityforre ognitionofNLC-

k

,

k

≥ 3

,isstillunknown. In thispaperwe improve Johansson's resultdownto

O(n

2

m)

. Our approa h relies ongraph de ompositions. We establish the tight links thatexist between NLC-2graphs andtheso- alled modularde omposition, splitde omposition, and bi-joinde omposition.

NLC-2 an be dened as a graph olouring problem. Unlike NLC-

k

lasses, for

k

≥ 3

, re olouringisuselessforprimeNLC-2graphs. Thatallowustoproposea anoni alde omposition

ofbi- oloured NLC-2graphs, denedas ertainbi- oloured splitoperations. Thisde omposition an be omputed in

O(nm)

time if the olouring is provided. If a graph is prime, there using splitandbi-joinde ompositions,weshowthatthereisatmost

O(n)

olouringsto he k. Finally, modular de omposition properties allowto redu eNLC-2 graph de omposition to primeNLC-2 graphde omposition. Se tion 3 explains this

O(n

2

m)

-time de omposition algorithm.

In Se tion 4is proposed an isomorphism algorithm. Using modular, split andbi-join de om-positions and the anoni alNLC-2de omposition, isomorphism between two NLC-2graphs an

be tested in

O(n

2

m)

time.

2 Preliminaries

Agraph

G

= (V, E)

ispairofasetofverti es

V

andasetofedges

E

. Foragraph

G

,

V

(G)

denote itssetofverti es,

E(G)

its setofedges,

n(G) = |V (G)|

and

m(G) = |E(G)|

(or

V

,

E

,

n

and

m

if

1

LIAFA,Université Paris7. {limouzy,fm,rao}liafa.jussieu. fr. Resear hsupportedbythe Fren hANR proje tGraphDe ompositionsandAlgorithms(GRAAL)

(3)

thegraphis lear inthe ontext).

N

(x) = {y ∈ V : {x, y} ∈ E}

denotestheneighbourhood ofthe vertex

x

,and

N[x] = N (v) ∪ {v}

. For

W

⊆ V

,

G[W ] = (W, E ∩ W

2

)

denotethegraph indu ed by

W

. Let

A

and

B

betwodisjointsubsetsof

V

. Thenwenote

A

1

B

ifforall

(a, b) ∈ A × B

,then

{a, b} ∈ E

,andwenote

A

B

0 ifforall

(a, b) ∈ A × B

,then

{a, b} 6∈ E

. Two graphs

G

= (V, E)

and

G

= (V

, E

)

are isomorphi (noted

G

≃ G

) ifthere is a bije tion

ϕ

: V → V

su h that

{x, y} ∈ E ⇔ {ϕ(x), ϕ(y)} ∈ E

,for all

u, v

∈ V

.

A

k

-labelling (or labelling) is a fun tion

l

: V → {1, . . . , k}

. A

k

-labelled graph is a pair of a graph

G

= (V, E)

and a

k

-labelling

l

on

V

. It is denoted by

(G, l)

or by

(V, E, l)

. Two labelled graphs

(V, E, l)

and

(V

, E

, l

)

are isomorphi if there is a bije tion

ϕ

: V → V

su h that

{u, v} ∈ E ⇔ {ϕ(x), ϕ(y)} ∈ E

and

l(u) = l

(ϕ(u))

for all

u, v

∈ V

.

NLC-

k

lasses. Let

k

be apositive integer. The lassof NLC-

k

graphsis dened re ursively bythe following operations.

For all

i

∈ {1, . . . , k}

,

·(i)

is inNLC-

k

,where

·(i)

is thegraph withone vertexlabelled

i

.

Let

G

1

= (V

1

, E

1

, l

1

)

and

G

2

= (V

2

, E

2

, l

2

)

be NLC-

k

and let

S

⊆ {1, . . . , k}

2

. Then

G

1

×

S

G

2

isin NLC-

k

,where

G

1

×

S

G

2

= (V, E, l)

with

V

= V

1

∪ V

2

,

E

= E

1

∪ E

2

∪ {{u, v} : u ∈ V

1

, v

∈ V

2

,

(l

1

(u), l

2

(v)) ∈ S}

andfor all

u

∈ V

,

l(u) =

(

l

1

(u)

if

u

∈ V

1

l

2

(u)

if

u

∈ V

2

.

Let

R

: {1, . . . , k} → {1, . . . , k}

and

G

= (V, E, l)

be NLC-

k

. Then

ρ

R

(G)

is in NLC-

k

, where

ρ

R

(G) = (V, E, l

)

su hthat

l

(u) = R(l(u))

for all

u

∈ V

.

A graphis NLC-

k

ifthere isa

k

-labelling of

G

su h that

(G, l)

is inNLC-

k

. A

k

-labelled graph isNLC-

k ρ

-free ifit an be onstru ted withoutthe

ρ

R

operation.

Modules and modularde omposition. Amodule inagraph isa non-emptysubset

X

⊆ V

su h that for all

u

∈ V \ X

, then either

N

(u) ∩ X = ∅

or

X

⊆ N (u)

. A module is trivial if

|X| ∈ {1, |V |}

. A graph is prime (w.r.t. modular de omposition) if all its modules are trivial. Two sets

X

and

X

overlap if

X

∩ X

,

X

\ X

and

X

\ X

arenon-empty. A module

X

isstrong if there is no module

X

su h that

X

and

X

overlap. Let

M

(G)

be the set of modules, let

M(G)

be theset of strong modules of

G

, and let

P(G) = {M

1

, . . . , M

k

}

be themaximal (w.r.t. in lusion)members of

M(G) \ {V }

.

Theorem 1. [11℄Let

G

= (V, E)

be a graph su h that

|V | ≥ 2

. Then:

if

G

is not onne ted, then

P(G)

isthe set of onne ted omponents of

G

,

if

G

is not onne ted, then

P(G)

isthe set of onne ted omponents of

G

,

if

G

and

G

are onne ted, then

P(G)

is a partition of

V

and is formed with the maximal members of

M

\ {V }

.

Inall ases,

P(G)

isa partitionof

V

,and

G

anbede omposedinto

G[M

1

], . . . , G[M

k

]

. The hara teristi graph

G

of a graph

G

is the graph of vertex set

P(G)

and two

P, P

∈ P(G)

are adja ent if there is an edge between

P

and

P

in

G

(and so there is no non-edges sin e

P

and

P

are two modules). The re ursive de omposition of a graph by this operation gives

(4)

de omposition tree are exa tly the strong modules, so in the following we make no distin tion between the modular de omposition of

G

and

M(G)

. Note that

|M(G)| ≤ 2 × n − 1

. For

M

∈ M(G)

, let

G

M

= G[M ]

and

G

M

its hara teristi graph.

Lemma 2. [14℄ Let

G

be a graph.

G

is NLC-

k

if and only if every hara teristi graph in the modular de omposition of

G

isNLC-

k

.

Moreover,aNLC-

k

expressionfor

G

anbeeasily onstru tedfromthemodularde omposition andfrom NLC-

k

expressions ofprimegraphs. Onprimegraphs, NLC-2re ognition is easier: Lemma 3. [14℄ Let

G

be a primegraph. Then

G

isNLC-2 if andonly if there is a

2

-labelling

l

su h that

(G, l)

isNLC-2

ρ

-free.

Bi-partitive family. A bipartition of

V

is a pair

{X, Y }

su h that

X

∩ Y = ∅

,

X

∪ Y = V

and

X

and

Y

are both non empty. Two bipartitions

{X, Y }

and

{X

, Y

}

overlap if

X

∩ Y

,

X

∩ Y

,

X

∩ Y

and

X

∩ Y

are nonempty. A family

F

ofbipartitions of

V

is bipartitive if(1) forall

v

∈ V

,

{{v}, V \ {v}} ∈ F

and(2)for all

{X, Y }

and

{X

, Y

}

in

F

su hthat

{X, Y }

and

{X

, Y

}

overlap,then

{X ∩ X

, Y

∪ Y

}

,

{X ∩ Y

, Y

∪ X

}

,

{Y ∩ X

, X

∪ Y

}

,

{Y ∩ Y

, X

∪ X

}

and

{X∆X

, X∆Y

}

arein

F

(where

X∆Y = (X \ Y ) ∪ (Y \ X)

). Bipartitive families arevery lose to partitive families[1 ℄,whi h generalisepropertiesof modules inagraph.

Amember

{X, Y }

ofa bipartitive family

F

isstrong ifthereisno

{X

, Y

}

su h that

{X, Y }

and

{X

, Y

}

overlap. Let

T

beatree. For anedge

e

inthetree,

{C

1

e

, C

e

2

}

denotethebipartition ofleavesof

T

su hthattwoleavesareinthesamesetifandonlyifthepathbetween themavoids

e

. Similarly,foran internalnode

α

,

{C

1

α

, . . . , C

d(α)

α

}

denotethepartition ofleavesof

T

su hthat twoleavesareinthe same setifand only ifthepath between them avoid

α

.

Theorem 4. [3℄ Let

F

be a bipartitive family on

V

. Then there is an unique unrooted tree

T

, alled the representative treeof

F

, su h that the set of leaves of

T

is

V

, the internal nodes of

T

are labelled degenerateor prime, and

- for every edge

e

of

T

,

{C

1

e

, C

e

2

}

is a strong member of

F

, and there is no other strong member in

F

,

- for every node

α

labelled degenerate,and for every

∅ ( I ( {1, . . . , d(α)}

,

{∪

i∈I

C

α

i

, V

\ ∪

i∈I

C

α

i

}

isin

F

,and there is no other member in

F

.

Split de omposition. A split in a graph

G

= (V, E)

is a bipartition

{X, Y }

of

V

su h that thesetof verti es in

X

having a neighbour in

Y

have thesame neighbourhood in

Y

(i.e., for all

u, v

∈ X

su hthat

N

(u) ∩ Y 6= ∅

and

N

(v) ∩ Y 6= ∅

,then

N

(u) ∩ Y = N (v) ∩ Y

). A o-split ina graph

G

is a splitin

G

. Thefamily of splitina onne ted graph is abipartitive family [4℄. The splitde ompositiontree isthe representativetreeof thefamily ofsplits,and anbe omputed in linear time[5 ℄. Let

α

be an internal node of the split de omposition tree of a onne ted graph

G

. For all

i

∈ {1, . . . , d(α)}

let

v

i

∈ C

i

α

su h that

N

(v

i

) \ C

i

α

6= ∅

. Sin e

G

is onne ted, su h a

v

i

alwaysexists.

G[{v

1

, . . . , v

d(α)

}]

denotethe hara teristi graph of

α

. The hara teristi graph ofa degeneratenodeis a omplete graph or astar [4 ℄.

Bi-joinde omposition. Abi-join inagraphisabipartition

{X, Y }

su hthatforall

u, v

∈ X

,

{N (u)∩ Y, Y \N (u)} = {N (v)∩ Y, Y \N (v)}

. Thefamilyofbi-joinsinagraphisbipartitive. The bi-joinde omposition tree istherepresentativetreeofthefamilyofbi-joins,and anbe omputed inlinear time [7, 8℄. Let

α

be an internal node of the bi-join de omposition tree of a graph

G

. For all

i

∈ {1, . . . , d(α)}

let

v

i

∈ C

i

α

.

G[{v

1

, . . . , v

d(α)

}]

denotethe hara teristi graph of

α

. The hara teristi graph of a degenerate node is a omplete bipartite graph or a disjoint union of two omplete graphs [7,8℄.

(5)

3 Re ognition of NLC-2 graphs

3.1 NLC-2

ρ

-free anoni al de omposition

Inthis se tion,

G

= (V, E, l)

isa 2-labelled graph su h thatevery mono- olouredmodule (i.e. a module

M

su h that

∀v, v

∈ M

,

l(v) = l(v

)

)hassize

1

. A ouple

(X, Y )

isa ut if

X

∪ Y = V

,

X

∩ Y = ∅

,

X

6= ∅

and

Y

6= ∅

. Let

S

⊆ {1, 2} × {1, 2}

. A ut

(X, Y )

is a

S

- ut of

G

iffor all

u

∈ X

and

v

∈ Y

, then

{u, v} ∈ E

if and only if

(l(u), l(v)) ∈ S

. For

S

⊆ {1, 2} × {1, 2}

let

F

S

(G)

be thesetof

S

- utof

G

.

Denition 5 (Symmetry). We say that

S

∈ {1, 2} × {1, 2}

is symmetri if

(1, 2) ∈ S ⇐⇒

(2, 1) ∈ S

,otherwisewesaythat

S

isnon-symmetri .

Denition 6 (Degenerate property). Afamily

F

of utshasthedegenerate property ifthere isapartition

P

of

V

su hthatfor all

∅ ( X ( P

,

(

S

X

∈X

X,

S

Y

∈P\X

Y

)

isin

F

,andthere isno others utin

F

.

Lemma 7. For every symmetri

S

⊆ {1, 2} × {1, 2}

,

F

S

(G)

has the degenerate property. Proof. The family

F

{}

(G)

has the degenerate property sin e

(X, Y )

is a

{}

- ut if and only if there is no edges between

X

and

Y

(

P

is exa tly the onne ted omponents). For

W

⊆ V

, let

G|W = (V, E∆W

2

, l)

. For

i

∈ {1, 2}

let

V

i

= {v ∈ V : l(v) = i}

. Let

G

1

= G|V

1

,

G

2

= G|V

2

and

G

12

= (G|V

1

)|V

2

.

• F

{(1,1)}

(G) = F

{}

(G

1

)

,

F

{(2,2)}

(G) = F

{}

(G

2

)

,

F

{(1,1),(2,2)}

(G) = F

{}

(G

12

)

,

• F

{(1,1),(1,2),(2,1),(2,2)}

(G) = F

{}

(G)

,

F

{(1,2),(2,1),(2,2)}

(G) = F

{}

(G

1

)

,

F

{(1,1),(1,2),(2,1)}

(G) = F

{}

(G

2

)

,

F

{(1,2),(2,1)}

(G) = F

{}

(G

12

)

.

Thus for every symmetri

S

⊆ {1, 2} × {1, 2}

,

F

S

(G)

hasthedegenerateproperty.

Denition 8 (Linear property). A family

F

of uts has thelinear property iffor all

(X, Y )

and

(X

, Y

)

in

F

,either

X

⊆ X

or

X

⊆ X

.

Lemma 9. For every non-symmetri

S

⊆ {1, 2} × {1, 2}

,

F

S

(G)

has the linear property. Proof. Case

S

= {(1, 2)}

: suppose that

X

\ X

and

X

\ X

are both non-empty. Then if

u

X

\ X

is labelled

1

and

v

∈ X

\ X

is labelled

2

,

u

and

v

hasto be adja ent and non-adja ent, ontradi tion. Thus

X

\ X

and

X

\ X

aremono- oloured. Nowsupposew.l.o.g. thatallverti es in

X∆X

are labelled

1

. Then

X∆X

is adja ent to all verti es labelled

2

in

Y

∩ Y

and non adja ent to all verti es labelled

1

in

Y

∩ Y

. Moreover

X∆X

is non adja ent to all verti es in

X

∩ X

. Thus

X∆X

is a mono- oloured module, and

|X∆X

| ≥ 2

. Contradi tion. For others non-symmetri

S

,webring ba kto ase

{(1, 2)}

like intheproof oflemma 7.

(6)

Input: A

2

-labelled graph

G

= (V, E, l)

Output: ANLC-2

ρ

-freede omposition tree,or failif

G

is not NLC-2

ρ

-free if

|V | = 1

thenreturnthe leaf

·(l(v))

(where

V

= {v}

)

1

Let

S

be the setof subsetsof

{1, 2} × {1, 2}

and

σ

bethelexi ographi orderof

S

2

forea h

S

∈ S

w.r.t.

σ

do 3

Compute

P

S

(G)

,and

P

S

(G)

if

S

is non-symmetri (see algorithm 2) 4

if

|P

S

(G)| > 1

then 5

Create anew

×

S

node

β

6

forea h

P

∈ P

S

(G)

(w.r.t.

P

S

(G)

if

S

is non-symmetri ) do 7

make NLC-2

ρ

-free de omposition tree of

G[P ]

bea hildof

β

. 8

return the tree rooted at

β

9

fail withNot NLC-2

ρ

-free 10

Algorithm 1: Computationof the NLC-2

ρ

-free anoni alde omposition tree

For

S

⊆ {1, 2} × {1, 2}

, let

P

S

(G)

denote the unique partition of

V

su h that (1) for all

(X, Y ) ∈ F

S

(G)

and

P

∈ P

S

(G)

,

P

⊆ X

or

P

⊆ Y

,and (2) for all

P, P

∈ P

,

P

6= P

,there is a

(X, Y ) ∈ F

S

(G)

su h that

P

⊆ X

and

P

⊆ Y

,or

P

⊆ Y

and

P

⊆ X

. For a non-symmetri

S

∈ {1, 2} × {1, 2}

, let

P

S

(G) = (P

1

, . . . , P

k

)

denote the unique orderingof elements in

P

S

(G)

su hthat for all

(X, Y ) ∈ F

S

(G)

,thereis a

l

su hthat

X

= ∪

i∈{1,...,l}

P

i

.

Lemma 10. If

G

is in NLC-2

ρ

-free, then there is a

S

⊆ {1, 2} × {1, 2}

su h that

F

S

(G)

is non-empty.

Proof. If

G

is NLC-2

ρ

-free, thenthereis a

S

⊆ {1, 2} × {1, 2}

,and two graphs

G

1

and

G

2

su h that

G

= G

1

×

S

G

2

. Thus

(V (G

1

), V (G

2

)) ∈ F

S

(G)

and

F

S

(G)

isnon empty.

Lemma 11. Let

G

= (V, E, l)

2-labelled graph andlet

S

⊆ {1, 2} × {1, 2}

. If

G

is NLC-2

ρ

-free andhasnomono- olourednon-trivialmodule,thenforall

P

∈ P

S

(G)

,

G[P ]

hasnomono- oloured non-trivialmodule.

Proof. If

M

is amono- oloured moduleof

G[P ]

,then

M

isa mono- olouredmodule of

G

. Con-tradi tion.

Lemma 12. Let

G

= (V, E, l)

2-labelled graph and let

S

⊆ {1, 2} × {1, 2}

. Then

G

is NLC-2

ρ

-free if andonlyif for all

P

∈ P

S

(G)

,

G[P ]

isNLC-2

ρ

-free.

Proof. Theonlyif isimmediate. Nowsupposethatfor all

P

∈ P

S

(G)

,

G[P ]

isNLC-2

ρ

-free. If

S

issymmetri ,let

P

S

(G) = {P

1

, . . . , P

|P

S

(G)|

}

. Then

G

= ((G[P

1

S

G[P

2

])×

S

. . .

×

S

G[P

|P

S

(G)|

]

, and

G

is NLC-2

ρ

-free. Otherwise, if

S

isnon-symmetri , let

P

S

(G) = (P

1

, . . . , P

|P

S

(G)|

)

. Then

G

= ((G[P

1

] ×

S

G[P

2

]) ×

S

. . .

×

S

G[P

|P

S

(G)|

]

,and

G

isNLC-2

ρ

-free.

The NLC-2

ρ

-free de omposition tree of a

2

-labelled graph

G

is a rooted tree su h that the leavesare theverti es of

G

,and the internal nodesarelabelled by

×

S

,with

S

⊆ {1, 2} × {1, 2}

. An internal node is degenerated if

S

is symmetri , and linear if

S

is non-symmetri . By lemmas10,11 and12,

G

isNLC-2

ρ

-freeifand onlyifithasaNLC-2

ρ

-free de ompositiontree. Thisde ompositiontreeisnot unique. Butwe andene a anoni al de omposition tree ifwex

atotalorderonthesubsetsof

{1, 2} × {1, 2}

(forexample,thelexi ographi order). Iftwographs are isomorphi , then they have the same anoni al de omposition tree. Algorithm 1 omputes the anoni alde ompositiontree ofa

2

-labelled prime graph, orfailsif

G

isnot NLC-2

ρ

-free.

Algorithm 2 omputes

P

S

and

P

S

for a

2

-labelled primegraph

G

and

S

⊆ {1, 2} × {1, 2}

in lineartime. Weneedsomeadditionaldenitionsforthisalgorithmanditsproofof orre tness. A

(7)

Input: A

2

-labelled graph

G

,and

S

⊆ {1, 2} × {1, 2}

Output:

P

S

if

S

issymmetri ,

P

S

if

S

is non-symmetri

V

i

← {v : v ∈ V

and

l(v) = i}

; 1

if

(1, 1) ∈ S

then

C

1

o- onne ted omponentsof

G[V

1

]

; 2

else

C

1

onne ted omponents of

G[V

1

]

; 3

if

(2, 2) ∈ S

then

C

2

o- onne ted omponentsof

G[V

2

]

; 4

else

C

2

onne ted omponents of

G[V

2

]

; 5

B = (C

1

,

C

2

, E

j

, E

m

) ←

thebipartite trigraphbetween theelements of

C

1

and

C

2

; 6

if

S

∩ {(1, 2), (2, 1)} = ∅

then 7

return onne ted omponents of

(C

1

,

C

2

, E

j

∪ E

m

)

8

else if

S

∩ {(1, 2), (2, 1)} = {(1, 2), (2, 1)}

then 9

return onne ted omponents of the bi- omplement of

(C

1

,

C

2

, E

j

)

10

else Sear h allsemi-joins of

B

(see appendix) ; 11

Algorithm 2: Computationof

P

S

and

P

S

bipartite graphisatriplet

(X, Y, E)

su hthat

E

⊆ X ×Y

. Thebi- omplementofabipartitegraph

(X, Y, E)

isthebipartitegraph

(X, Y, (X × Y ) \ E)

. Abipartitetrigraph(BT)isabipartitegraph withtwotypesofedges: thejoin edgesandthemixed edges. Itisdenotedby

B = (X, Y, E

j

, E

m

)

where

E

j

are the set of join edges, and

E

m

the set of mixed edges. A BT-module in a BT is a

M

⊆ X

or

M

⊆ Y

su h that

M

is a module in

(X, Y, E

j

)

and there is no mixed edges between

M

and

(X ∪ Y ) \ M

. For

v

∈ X ∪ Y

, let

N

j

(v) = {u ∈ X ∪ Y : {u, v} ∈ E

j

}

and

N

m

(v) = {u ∈ X ∪ Y : {u, v} ∈ E

m

}

. Let

d

j

(v) = |N

j

(v)|

and

d

m

(v) = |N

m

(v)|

. A semi-join inaBT

(X, Y, E

j

, E

m

)

isa ut

(A, B)

of

X

∪ Y

,su hthatthere isno edgesbetween

A

∩ Y

and

B

∩ X

,and thereisonly join edges between

A

∩ X

and

B

∩ Y

.

Inalgorithm2,

B

isobtainedfromthegraph

G

. Verti esof

X

orrespondtosubsetsofverti es labelled

1

in

G

, and verti es of

Y

orrespond to subsets of verti es labelled

2

. There is a join edgebetween

M

and

M

in

B

if

M

1

M

in

G

,and there isa mixed edgebetween

M

∈ X

and

M

∈ Y

in

B

ifthereis at leastan edgeand anon-edge between

M

and

M

in

G

. Su h agraph

B

an easily be built in linear time from a given graph

G

. It su es to onsider a list and an array bounded by the number of omponent in

G

with the same olour. The following lemmas are lose toobservations in[9℄,but dealwithBT insteadofbipartite graphs(proofsaregiven in appendix).

Lemma 13. Let

G

= (X, Y, E

j

, E

m

)

be a BT su h that every BT-module has size

1

. Let

(x

1

, . . . , x

|X|

)

be

X

sorted by

(d

j

(x), d

m

(x))

in lexi ographi de reasing order. If

(A, B)

is a semi-joinof

G

, then there is a

k

∈ {0, . . . , |X|}

su h that

A

∩ X = {x

1

, . . . , x

k

}

.

Lemma 14. Let

k

∈ {0, . . . , |X|}

and

k

∈ {0, . . . , |Y |}

. Then

(A, (X ∪ Y ) \ A)

, where

A

=

{x

1

, . . . , x

k

, y

1

, . . . , y

k

}

,isasemi-joinof

G

ifandonlyif

P

k

i=1

d

j

(x

i

)−

P

k

i=1

d

j

(y

i

) = k×(|Y |−k

)

and

P

k

i=1

d

m

(x

i

) −

P

k

i=1

d

m

(y

i

) = 0

.

Theorem 15. Algorithm 2 is orre t and runs in linear time.

Proof. Corre tness: Supposethat

(A, B)

isa

S

- ut. If

(1, 1) 6∈ S

,thenthereisnoedgebetween

A∩V

1

and

B

∩V

1

,thus

(A, B)

annot uta omponent

C

1

(andsimilarlyfor

(1, 1) ∈ S

,andfor

C

2

). Now we work on the BT

B = (C

1

,

C

2

, E

j

, E

m

)

. If

S

∩ {(1, 2), (2, 1)} = ∅

,then

S

- uts orrespond exa tly to onne ted omponents of

B

, and if

S

∩ {(1, 2), (2, 1)} = {(1, 2), (2, 1)}

then

S

- uts orrespond exa tly to onne ted omponents of the BT of

G

,whi h is

(C

1

,

C

2

,

(C

1

× C

2

) \ (E

j

E

m

), E

m

)

. Finally,if

S

is non-symmetri ,

S

- uts orrespond to semi-joinsof

B

(seeappendix).

(8)

inlineartime [13 , 6 ℄. The instru tions onlines[2-5,8℄ an bedone witha BFS ona graph or its omplement. Itis easy to see thatwe an do a BFS on thebi- omplement inlineartime (like a BFS on a omplement graph, withtwo vertex lists for

X

and

Y

), so instru tion line 10 an be doneinlineartime. Finally,the operationsat line 11aredone inlineartime(seeappendix).

Theseresults an be summarizedas:

Theorem16. Algorithm1 omputesthe anoni alNLC-2

ρ

-freede ompositiontree ofa2-labelled graph in

O(nm)

time.

3.2 NLC-2 de omposition of a prime graph

Inthis se tion,

G

isan unlabelled prime (w.r.t. modularde omposition) graph, with

|V | ≥ 3

. Denition17(

2

-bimodule). Abipartition

{X, Y }

of

V

isa

2

-bimodule if

X

anbepartitioned into

X

1

and

X

2

,and

Y

into

Y

1

and

Y

2

su hthatforall

(i, j) ∈ {1, 2}× {1, 2}

,theneither

X

i

0

Y

j

or

X

i

1

Y

j

. It is easy to see that if

{X, Y }

is a

2

-bimodule ifand only if

{X, Y }

is a split, a o-split or abi-join. Moreover, if

min(|X|, |Y |) > 1

then

{X, Y }

annot be both of them in the same time(sin e

G

isprime).

Let

l

: V → {1, 2}

be a 2-labelling. Then

s(l)

denote the 2-labelling on

V

su h that for all

v

∈ V

,

s(l)(v) = 1

ifandonly if

l(v) = 2

.

Denition 18 (Labelling indu ed by a

2

-bimodule). Let

{X, Y }

be a

2

-bimodule. We dene the labelling

l

: V → {1, 2}

of

G

indu ed by

{X, Y }

. If

|X| = |Y | = 1

, then

l(x) = 1

and

l(y) = 2

, where

X

= {x}

and

Y

= {y}

. If

|X| = 1

, then

l(v) = 1

i

v

∈ N [x]

. Similarly if

|Y | = 1

,then

l(v) = 1

i

v

∈ N [y]

. Nowwe suppose

min(|X|, |Y |) > 1

. If

{X, Y }

isa split,then theset of verti es in

X

witha neighbour

Y

and theset of verti es in

Y

witha neighbour in

X

islabelled

1

,others verti es arelabelled

2

. If

{X, Y }

is a o-split, thena labelling of

G

indu ed by

{X, Y }

isalabellingof

G

indu edbythesplit

{X, Y }

. Finallyif

{X, Y }

isabi-join,

l

issu h that

{v ∈ X : l(v) = 1}

is a join with

{v ∈ Y : l(v) = 1}

and

{v ∈ X : l(v) = 2}

is a joinwith

{v ∈ Y : l(v) = 2}

. Notethatif

{X, Y }

isabi-join,thenthereistwopossibleslabelling

l

1

and

l

2

, with

l

1

= s(l

2

)

. If

{X, Y }

is a

2

-bimoduleof

G

and

l

a labelling indu edby

{X, Y }

,then every mono- olouredmodule hassize

1

(sin e

G

is primeand

|V | ≥ 3

).

Denition 19 (Good

2

-bimodule). A

2

-bimodule

{X, Y }

is good if the graph

G

with the labellingindu ed by

{X, Y }

isNLC-2

ρ

-free. Thefollowingproposition omes immediatelyfrom lemma3.

Proposition 20.

G

isNLC-2 if andonly if

G

has a good

2

-bimodule.

Lemma 21. If

G

has a good

2

-bimodule

{X, Y }

whi h is a split, then

G

has a good

2

-bimodule whi his a strong split.

Proof. There is a node

α

in the split de omposition tree and

∅ ( I ( {1, . . . , d(α)}

su h that

{X, Y } = {∪

i∈I

C

α

i

,

i6∈I

C

α

i

}

. Let

l

: V → {1, 2}

bethelabellingof

G

indu edby

{X, Y }

. For all

i

∈ {1, . . . , d(α)}

,

(G[C

i

α

], l|

C

i

α

)

is NLC-2

ρ

-free (where

l|

W

isthe fun tion

l

restri tedat

W

). Let

l

be the

2

-labelling of

V

su h that for all

i

, and

v

∈ C

i

α

,

l(v) = 1

if and only if

v

has a neighbour outside of

C

i

α

. For all

i

, either

l|

C

i

α

= l

|

C

i

α

, or

∀v ∈ C

i

α

,

l(v) = 2

. Then for all

i

,

(G[C

i

α

], l

|

C

i

α

)

isNLC-2

ρ

-free,andthus

(G, l

)

isNLC-2

ρ

-free. Sin ethereisadominatingvertex inthe hara teristi graphof

α

, there is a

j

su h that the labelling indu ed bythe strong split

{C

α

j

, V

\ C

α

j

}

is

l

. Thus thestrong split

{C

j

(9)

Input: A graph

G

Result: Yes i

G

is NLC-2

S ←

thesetofstrong splits, o-splitsand bi-joinsof

G

; forea h

{X, Y } ∈ S

do

l

thelabellingof

G

indu edby

{X, Y }

;

if

(G[X], G[Y ], l)

is NLC-2

ρ

-free thenreturnYes ; returnNo ;

Algorithm 3: Re ognition of primeNLC-2graphs

Previouslemma on

G

saythatif

G

hasagood

2

-bimodule

{X, Y }

whi hisa o-split, then

G

hasagood

2

-bimodule whi his astrong o-split. The following lemma issimilar to Lemma 21. Lemma22. If

G

hasa good

2

-bimodule

{X, Y }

whi hisa bi-join,then

G

has agood

2

-bimodule whi his a strong bi-join.

Theorem 23. Algorithm 3 re ognises primeNLC-2 graphs, andits time omplexity is

O(n

2

m)

.

Proof. Trivially if the algorithm return Yes, then

G

is NLC-2. On the other hand, by proposi-tion 20, and lemmas 21 and 22, if

G

is NLC-2, then it has a good strong

2

-bimodule and the algorithm returnsYes.

Theset

S

anbe omputed usingalgorithms for omputingsplitde ompositionon

G

and

G

, and bi-join de omposition on

G

. Note that it is not required to usea lineartime algorithm for splitde omposition [5 ℄: some simpler algorithms run in

O(n

2

m)

[4, 10℄. [7, 8 ℄show that bi-join

de omposition anbe omputedinlineartime,usingaredu tiontomodularde omposition. But therealso,modularde ompositionalgorithmssimplerthan[15 ℄maybeused. Theset

S

has

O(n)

elements. Testingifa

2

-bimodule isgood takes

O(nm)

usingalgorithm 1. Sototal runningtime is

O(n

2

m)

.

3.3 NLC-2 de omposition

Usinglemma 2,modular de omposition and algorithm 3,we get:

Theorem 24. NLC-2 graphs an be re ognised in

O(n

2

m)

, and a NLC-2expression an be

gen-erated in the sametime.

4 Graph isomorphism on NLC-2 graphs

4.1 Graph Isomorphism on NLC-2

ρ

-free prime graphs

Thefollowingpropositionsaredire t onsequen esofproperties(linearanddegenerate)of

S

- uts. Proposition25. Considerasymmetri

S

∈ {1, 2}×{1, 2}

. Twographs

G

and

H

are isomorphi ifandonlyif there isa bije tion

π

between

P

S

(G)

and

P

S

(H)

su h that forall

P

∈ P

S

(G)

,

G[P ]

isisomorphi to

H[π(P )]

.

Proposition 26. Let a non-symmetri

S

∈ {1, 2} × {1, 2}

and let

G

and

H

be two graphs. Let

P

S

(G) = (P

1

, . . . , P

k

)

and

P

S

(H) = (P

1

, . . . , P

k

)

then

G

and

H

are isomorphi if and only if

k

= k

andfor all

i

∈ {1, . . . , k}

,

G[P

i

]

isisomorphi to

H[P

i

]

.

By theprevious 2 propositions,two NLC-2

ρ

-free 2-labelled graphs

G

and

H

areisomorphi ifand only ifthere is an isomorphism between their anoni al NLC-2

ρ

-free de omposition tree whi h respe ts the order of hildren of linearnodes. Thisisomorphism an be tested inlinear time,thus isomorphism of NLC-2

ρ

-free graphs anbe donein

O(nm)

time.

(10)

Input: Two primeNLC-2graphs

G

and

H

Result: Yes if

G

≃ H

,No otherwise

S ←

thesetofstrong splits, o-splitsand bi-joinsof

G

;

S

thesetof strong splits, o-splitsand bi-joinsof

H

;

if there isno good

2

-bimodule in

S

thenfail with 

G

is notNLC-2;

{X, Y } ←

a good

2

-bimodulein

S

;

l

the labellingof

G

indu ed by

{X, Y }

; forea h

{X

, Y

} ∈ S

su h that

{X

, Y

}

is good do

l

thelabellingof

H

indu ed by

{X

, Y

}

;

if

|X| > 1

and

|Y | > 1

and

{X, Y }

isa bi-join then if

(G, l) ≃ (H, l

)

or

(G, l) ≃ (H, s(l

))

thenreturn Yes ; else if

(G, l) ≃ (H, l

)

thenreturn Yes ;

returnNo ;

Algorithm 4: Isomorphismfor primeNLC-2graphs

4.2 Graph isomorphism on prime NLC-2 graphs

Theorem 27. Algorithm4 test isomorphismbetween two primeNLC-2 graphs intime

O(n

2

m)

.

Proof. If the algorithm returns yes, then trivially

G

≃ H

. On the other hand suppose that

G

≃ H

andlet

π

: V (G) → V (H)

beabije tionsu hthat

{u, v} ∈ E(G)

i

(π(u), π(v)) ∈ E(H)

. Then

{X

, Y

}

with

X

= π(X)

and

Y

= π(Y )

is a good

2

-bimodule if

H

. If

min(|X|, |Y |) > 1

and

{X

, Y

}

isabi-join,thenbydenitionthereistwolabellingindu edby

{X, Y }

,and

(G, l) ≃

(H, l

)

or

(G, l) ≃ (H, s(l

))

. Otherwise the labellingis unique and

(G, l) ≃ (H, l

)

. Thesets

S

and

S

anbe omputedin

O(n

2

)

timeusinglineartimealgorithmsfor omputing splitde omposition on

G

and

G

,and bi-joinde omposition on

G

. The sets

S

and

S

have

O(n)

elements. Testif a

2

-bimoduleis good take

O(nm)

using algorithm 1, and test iftwo

2

-labelled prime graphsareisomorphi take also

O(nm)

. Thus the total runningtimeis

O(n

2

m)

.

4.3 Graph isomorphism on NLC-2 graphs

Itiseasy toshowthatgraphisomorphism onprimeNLC-2graphs withan additionallabels into

{1, . . . , q}

an be done in

O(n

2

m)

time. For that, we add the additional label of

v

at the leaf orrespondingto

v

inthe NLC-2

ρ

-freede ompositiontree.

We show that we an do graph isomorphism on NLC-2 graphs in time

O(n

2

m)

, using the modular de omposition and algorithm 4. Let

M(G)

and

M(H)

be themodular de omposition of

G

and

H

. For

M

∈ M(G)

, let

G

M

be

G[M ]

, and for

M

∈ M(H)

, let

H

M

be

H[M ]

. Let

G

M

be the hara teristi graph of

G

M

(note that

|V (G

M

)|

is the number of hildren of

M

in the modular de omposition tree). Let

M

(i,∗)

= {M ∈ M(G) ∪ M(H) : |M | = i}

, let

M

(∗,j)

= {M ∈ M(G) ∪ M(H) : |V (G

M

)| = j}

and let

M

(i,j)

= M

(i,∗)

∩ M

(∗,j)

. Note that

P

n

j=1

(M

(∗,j)

× j)

is the number of verti es in

G

plus the number of edges inthe modular de omposition tree,and thus isat most

3n − 2

.

Theorem 28. Algorithm 5 testsisomorphism between two NLC-2 graphs in time

O(n

2

m)

.

Proof. The orre tness omes from the fa t that at ea h step, for all

M, M

∈ M(G) ∪ M(H)

su hthat

l(M )

and

l(M

)

areset,

G

M

and

G

M

areisomorphi ifandonly if

l(M ) = l(M

)

(11)

Input: Two NLC-2graphs

G

and

H

Result: Yes if

G

≃ H

,No otherwise

forevery

M

∈ M(G) ∪ M(H)

su h that

|M | = 1

do

l(M ) ← 1

; for

i

from

2

to

n

do

for

j

from

2

to

i

do

Compute the partition

P

of

M

(i,j)

su hthat

M

and

M

areinthesame lass of

P

ifand onlyif

(G

M

, l) ≃ (G

M

, l)

. ; forea h

P

∈ P

do

a

a newlabel(an integer not in

Img(l)

) ; For all

M

∈ P

,

l(M ) ← a

;

Algorithm 5: Isomorphism onNLC-2graphs

total time

f

(n, m)

of thisalgorithm is

O(n

2

m)

sin e (big Oh isomitted):

f

(n, m) ≤

X

i

X

j

j

2

m

|M

(i,j)

|

2

 ≤ m

X

j

j

2

X

i

|M

(i,j)

|

2



!

≤ m

X

j

j

2

|M

(∗,j)

|

2

 ≤ m

X

j



j|M

(∗,j)

|



2



≤ n

2

m.

Referen es

[1℄ M.Chein,M.Habib,andM.C.Maurer. Partitivehypergraphs. Dis reteMath.,37(1):3550,1981. [2℄ B.Cour elle,J.Engelfriet,andG.Rozenberg. Handle-rewritinghypergraphgrammars. J. Comput.

Syst. S i.,46(2):218270,1993.

[3℄ W.H.CunnighamandJ.Edmonds.A ombinatorialde ompositiontheory.Canad.J.Math.,32:734 765,1980.

[4℄ William H. Cunningham. De omposition of dire ted graphs. SIAMJ. Algebrai Dis rete Methods, 3(2):214228,1982.

[5℄ E. Dahlhaus. Parallelalgorithms forhierar hi al lusteringand appli ationsto split de omposition andparitygraphre ognition. J.Algorithms,36(2):205240,2000.

[6℄ E.Dahlhaus,J.Gustedt,andR.M.M Connell. Partially omplementedrepresentationsofdigraphs. Dis reteMath.Theor.Comput. S i.,5(1):147168,2002.

[7℄ F. de Montgoler and M. Rao. The bi-join de omposition. In ICGT, volume 22 of ENDM, pages 173177,2005.

[8℄ F.deMontgolerandM.Rao. Bipartitivesfamiliesandthebi-joinde omposition. Te hni alreport, https://hal.ar hives-ouvertes.fr/hal-00132862,2005.

[9℄ J.-L. Fouquet, V. Giakoumakis, and J.-M. Vanherpe. Bipartite graphs totally de omposable by anoni alde omposition. Internat.J. Found.Comput.S i., 10(4):513533,1999.

[10℄ C.P.Gabor,K.J.Supowit,andW.-L.Hsu. Re ognizing ir legraphsinpolynomialtime. J.ACM, 36(3):435473,1989.

[11℄ T.Gallai. TransitivorientierbareGraphen. A taMath. A ad. S i.Hungar.,18:2566,1967.

[12℄ F. Gurskiand E. Wanke. Minimizing NLC-widthis NP-Complete. InWG,volume3787 ofLNCS, pages6980,2005.

[13℄ M.Habib,C.Paul,andL.Viennot. Partitionrenementte hniques: Aninterestingalgorithmi tool kit. Internat.J. Found. Comput.S i., 10(2):147170,1999.

[14℄ Ö.Johansson.NLC 2

-de ompositioninpolynomialtime.Internat.J.Found.Comput.S i.,11(3):373 395,2000.

[15℄ R. M. M Connell and J. P. Spinrad. Modular de omposition and transitiveorientation. Dis rete Math., 201(1-3):189241,1999.

(12)

A.1 Proof of lemma 13

Let

G

= (X, Y, E

j

, E

m

)

beaBTsu hthateveryBT-modulehassize

1

. Let

(x

1

, . . . , x

|X|

)

be

X

sorted by

(d

j

(x), d

m

(x))

inlexi ographi de reasing order. If

(A, B)

is a semi-joinof

G

,thenthere isa

k

∈ {0, . . . , |X|}

su h that

A

∩ X = {x

1

, . . . , x

k

}

.

Proof. For all

v

∈ A ∩ X

,

d

j

(v) ≥ |B ∩ Y |

, and for all

v

∈ B ∩ X

,

d

j

(v) ≤ |B ∩ Y |

. Moreover, if there is a

v

∈ B ∩ X

with

d

j

(v) = |B ∩ Y |

, then

d

m

(v) = 0

. Let

C

= {v ∈ X : d

j

(v) =

|B ∩ Y |

and

d

m

(v) = 0}

. Then

C

is a BT-module of

G

, and thus

|C| ≤ 1

. Every vertex in

A

∩ X \ C

arebeforeeveryvertexin

B

∩ X \ C

intheordering. Moreover,if

|C| > 0

,thenverti es in

A

∩ X \ C

arebeforethe vertexin

C

,and verti es in

B

∩ X \ C

are after thevertexin

C

in theordering.

A.2 Proof of lemma 14

Let

k

∈ {0, . . . , |X|}

and

k

∈ {0, . . . , |Y |}

. Then

(A, (X ∪ Y ) \ A)

, where

A

=

{x

1

, . . . , x

k

, y

1

, . . . , y

k

}

,isasemi-joinof

G

ifandonlyif

P

k

i=1

d

j

(x

i

) −

P

k

i=1

d

j

(y

i

) =

k

× (|Y | − k

)

and

P

k

i=1

d

m

(x

i

) −

P

k

i=1

d

m

(y

i

) = 0

.

Proof. TheIf partisbydenition. Now letus onsidertheOnly if part. Letus assumethat thedegree onditionholds. Wewilldenote

a

thenumberofjoinedgesbetween

A

∩ X

and

B

∩ Y

,

b

the numberofjoinedgesbetween

A

∩ X

and

A

∩ Y

,and

c

thenumber ofmixededges between

A

∩ X

and

A

∩ Y

. Note that

a

≤ k(|Y | − k

)

,

a

+ b =

P

k

i=1

d

j

(x

i

)

and

b

P

k

i=1

d

j

(y

i

)

, thus

a

≥ k(|Y | − k

)

. So we have

a

= k(|Y | − k

)

,and

P

k

i=1

d

j

(y

i

) − b = 0

. In other words, there is onlyjoinedgesbetween

A

∩ X

and

B

∩ Y

,and thereisnojoinedges between

A

∩ Y

and

B

∩ X

. Now sin e there is only join edges between

A

∩ X

and

B

∩ Y

,

c

=

P

k

i=1

d

m

(x

i

) =

P

k

i=1

d

m

(y

i

)

, thus there isno mixededges between

A

∩ Y

and

B

∩ X

.

A.3 Algorithm to ompute

P

S

when

S

is non-symmetri

Proof. Corre tness: Algorithm6generatesallthesemi-joinsof

B

. Atanytime,

s

j

=

P

k

i=1

d

j

(x

i

)

,

s

m

=

P

k

i=1

d

m

(x

i

)

,

s

j

=

P

k

i=1

d

j

(y

i

)

and

s

m

=

P

k

i=1

d

m

(y

i

)

. In

B

, every BT-modulehassize

1

, otherwisethereisamono- olouredmodulein

G

ofsizeatleast

2

. If

(A, B)

isasemi-join,thenby lemma13on

(C

1

,

C

2

, E

j

, E

m

)

and

(C

2

,

C

1

, E

j

, E

m

)

,thereisa

a

and

b

su hthat

A∩C

1

= {x

1

, . . . , x

a

}

and

A

∩ C

2

= {y

1

, . . . , y

b

}

. At anytime,

(A

,

(C

1

∪ C

2

) \ A

)

with

A

= {x

1

, . . . , x

l

, y

1

, . . . , y

l

}

is the last semi-join found. At

k

= a

, the while line 12 will stop when

s

j

− s

j

= k × (|C

2

| − k

)

sin e for every

v

∈ A ∩ C

2

,

d

j

(v) ≤ k

,and

s

j

+ k × (|C

2

| − k

)

de rease with

k

. Moreover, when thewhileloop stops,

s

m

= s

m

sin e

s

m

in rease with

k

. Thus if

b

6= k

,then

{y

k

+1

, . . . y

b

}

isa BT-module and

b

= k

+ 1

(sin e every BT-module has size

1

). In all ases the algorithm nds

(A, B)

,and addsthe partition in

P

.

Complexity: Aswe see inproof of theorem15, every instru tionlines [2-5℄ an be done in

linear time, and learly every instru tion lines [6-22℄ an be done inlinear time, thus the total runningtimeis

O(n + m)

.

(13)

Input: A

2

-labelled graph

G

,anda non-symmetri

S

⊆ {1, 2} × {1, 2}

Output:

P

S

V

i

← {v : v ∈ V

and

l(v) = i}

; 1

if

(1, 1) ∈ S

then

C

1

o- onne ted omponentsof

G[V

1

]

; 2

else

C

1

onne ted omponents of

G[V

1

]

; 3

if

(2, 2) ∈ S

then

C

2

o- onne ted omponentsof

G[V

2

]

; 4

else

C

2

onne ted omponents of

G[V

2

]

; 5

B = (C

1

,

C

2

, E

j

, E

m

) ←

thebipartite trigraphbetween theelements of

C

1

and

C

2

; 6

(x

1

, . . . , x

|C

1

|

) ← C

1

sorted by lexi ographi orderon

(−d

j

(v), −d

m

(v))

; 7

(y

1

, . . . , y

|C

2

|

) ← C

2

sortedbylexi ographi order on

(d

j

(v), d

m

(v))

; 8

P

← ()

;

l

← 0

;

l

← 0

;

k

← 0

;

k

← 0

; 9

s

j

← 0

;

s

m

← 0

;

s

j

← 0

;

s

m

← 0

; 10 while

k

≤ |C

1

|

do 11 while

s

j

− s

j

< k

× (|C

2

| − k

)

or (

s

j

− s

j

= k × (|C

2

| − k

)

and

s

m

> s

m

) do 12

k

← k

+ 1

;

s

j

← s

j

+ d

j

(y

k

)

;

s

m

← s

m

+ d

m

(y

k

)

; 13 if

s

j

− s

j

= k × (|C

2

| − k

)

and

s

m

= s

m

then 14

add

{x

l+1

, . . . , x

k

} ∪ {y

l

+1

. . . , y

k

}

at theend of

P

;

l

← k

;

l

← k

; 15 if

s

j

− s

j

− d

j

(y

k+1

) = k × (|C

2

| − k

− 1)

and

s

m

= s

m

+ d

m

(y

k+1

)

then 16

k

← k

+ 1

;

s

j

← s

j

+ d

j

(y

k

)

;

s

m

← s

m

+ d

m

(y

k

)

; 17

add

{y

k

}

at the end of

P

;

l

← k

; 18

k

← k + 1

;

s

j

← s

j

+ d

j

(x

k

)

;

s

m

← s

m

+ d

m

(x

k

)

; 19 remove

form

P

,ifany; 20 if

(2, 1) ∈ S

thenreverse

P

; 21 return

P

22 Algorithm 6: Computationof

P

S

when

S

is non-symmetri

Références

Documents relatifs

As observed at the end of Section 6.2, Theorem 6.6 suggests that, given a Markov chain with restart specified by a stochastic graph G and a distribution v, we should try to obtain

Formally prove that this equation is mass conser- vative and satisfies the (weak) maximum principle.. 4) Dynamic estimate on the entropy and the first

We define a partition of the set of integers k in the range [1, m−1] prime to m into two or three subsets, where one subset consists of those integers k which are &lt; m/2,

Our conditions for term by term integration may be regarded as derived from those of Helly by assigning the properties of uniform continuity, or uniform

In this paper we focus on the Syntactic Isomorphism of CNF Boolean For- mulas (CSFI): given two CNF Boolean formulas ϕ(a 1 ,. We prove that this problem is GI-complete: in

Seemingly inescapable consequences of the physiologist's account of perception appear to demolish not just the credentials of some other theory of perception, but the

“I think one of the problems is that on issues of language, race, culture, ethnicity, religion, white politicians in power particularly, silence themselves for fear of rebuke from

The problem of deciding the existence of a SEPI from G to G’ is NP-complete, but show that when G is fixed, this problem can be decided in constant-time (hint: this