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�
hal-00134605, version 1 - 2 Mar 2007
Vin ent Limouzy1
Fabiende Montgoler1
Mi haël Rao1
Abstra tNLC-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 byk
. 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 anO(n
4
log(n))
re ognitionalgorithm. Complexityforre ognitionofNLC-
k
,k
≥ 3
,isstillunknown. In thispaperwe improve Johansson's resultdowntoO(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, fork
≥ 3
, re olouringisuselessforprimeNLC-2graphs. Thatallowustoproposea anoni alde ompositionofbi- 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,weshowthatthereisatmostO(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 thisO(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 esV
andasetofedgesE
. ForagraphG
,V
(G)
denote itssetofverti es,E(G)
its setofedges,n(G) = |V (G)|
andm(G) = |E(G)|
(orV
,E
,n
andm
if1
LIAFA,Université Paris7. {limouzy,fm,rao}liafa.jussieu. fr. Resear hsupportedbythe Fren hANR proje tGraphDe ompositionsandAlgorithms(GRAAL)
thegraphis lear inthe ontext).
N
(x) = {y ∈ V : {x, y} ∈ E}
denotestheneighbourhood ofthe vertexx
,andN[x] = N (v) ∪ {v}
. ForW
⊆ V
,G[W ] = (W, E ∩ W
2
)
denotethegraph indu ed by
W
. LetA
andB
betwodisjointsubsetsofV
. ThenwenoteA
1
B
ifforall(a, b) ∈ A × B
,then{a, b} ∈ E
,andwenoteA
B
0 ifforall(a, b) ∈ A × B
,then{a, b} 6∈ E
. Two graphsG
= (V, E)
andG
′
= (V
′
, E
′
)
are isomorphi (noted
G
≃ G
′
) ifthere is a bije tionϕ
: V → V
′
su h that{x, y} ∈ E ⇔ {ϕ(x), ϕ(y)} ∈ E
′
,for allu, v
∈ V
.A
k
-labelling (or labelling) is a fun tionl
: V → {1, . . . , k}
. Ak
-labelled graph is a pair of a graphG
= (V, E)
and ak
-labellingl
onV
. 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. Letk
be apositive integer. The lassof NLC-k
graphsis dened re ursively bythe following operations.•
For alli
∈ {1, . . . , k}
,·(i)
is inNLC-k
,where·(i)
is thegraph withone vertexlabelledi
.•
LetG
1
= (V
1
, E
1
, l
1
)
andG
2
= (V
2
, E
2
, l
2
)
be NLC-k
and letS
⊆ {1, . . . , k}
2
. Then
G
1
×
S
G
2
isin NLC-k
,whereG
1
×
S
G
2
= (V, E, l)
withV
= 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)
ifu
∈ V
1
l
2
(u)
ifu
∈ V
2
.•
LetR
: {1, . . . , k} → {1, . . . , k}
andG
= (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 isak
-labelling ofG
su h that(G, l)
is inNLC-k
. Ak
-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 allu
∈ V \ X
, then eitherN
(u) ∩ X = ∅
orX
⊆ 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 setsX
andX
′
overlap ifX
∩ X
′
,X
\ X
′
andX
′
\ X
arenon-empty. A module
X
isstrong if there is no moduleX
′
su h that
X
andX
′
overlap. Let
M
′
(G)
be the set of modules, let
M(G)
be theset of strong modules ofG
, and letP(G) = {M
1
, . . . , M
k
}
be themaximal (w.r.t. in lusion)members ofM(G) \ {V }
.Theorem 1. [11℄Let
G
= (V, E)
be a graph su h that|V | ≥ 2
. Then:•
ifG
is not onne ted, thenP(G)
isthe set of onne ted omponents ofG
,•
ifG
is not onne ted, thenP(G)
isthe set of onne ted omponents ofG
,•
ifG
andG
are onne ted, thenP(G)
is a partition ofV
and is formed with the maximal members ofM
′
\ {V }
.
Inall ases,
P(G)
isa partitionofV
,andG
anbede omposedintoG[M
1
], . . . , G[M
k
]
. The hara teristi graphG
∗
of a graph
G
is the graph of vertex setP(G)
and twoP, P
′
∈ P(G)
are adja ent if there is an edge between
P
andP
′
in
G
(and so there is no non-edges sin eP
andP
′
are two modules). The re ursive de omposition of a graph by this operation gives
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
andM(G)
. Note that|M(G)| ≤ 2 × n − 1
. ForM
∈ M(G)
, letG
M
= G[M ]
andG
∗
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 ofG
isNLC-k
.Moreover,aNLC-
k
expressionforG
anbeeasily onstru tedfromthemodularde omposition andfrom NLC-k
expressions ofprimegraphs. Onprimegraphs, NLC-2re ognition is easier: Lemma 3. [14℄ LetG
be a primegraph. ThenG
isNLC-2 if andonly if there is a2
-labellingl
su h that(G, l)
isNLC-2ρ
-free.Bi-partitive family. A bipartition of
V
is a pair{X, Y }
su h thatX
∩ Y = ∅
,X
∪ Y = V
andX
andY
are both non empty. Two bipartitions{X, Y }
and{X
′
, Y
′
}
overlap ifX
∩ Y
,X
∩ Y
′
,X
′
∩ Y
andX
′
∩ Y
′
are nonempty. A family
F
ofbipartitions ofV
is bipartitive if(1) forallv
∈ 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
(whereX∆Y = (X \ Y ) ∪ (Y \ X)
). Bipartitive families arevery lose to partitive families[1 ℄,whi h generalisepropertiesof modules inagraph.Amember
{X, Y }
ofa bipartitive familyF
isstrong ifthereisno{X
′
, Y
′
}
su h that
{X, Y }
and{X
′
, Y
′
}
overlap. Let
T
beatree. For anedgee
inthetree,{C
1
e
, C
e
2
}
denotethebipartition ofleavesofT
su hthattwoleavesareinthesamesetifandonlyifthepathbetween themavoidse
. Similarly,foran internalnodeα
,{C
1
α
, . . . , C
d(α)
α
}
denotethepartition ofleavesofT
su hthat twoleavesareinthe same setifand only ifthepath between them avoidα
.Theorem 4. [3℄ Let
F
be a bipartitive family onV
. Then there is an unique unrooted treeT
, alled the representative treeofF
, su h that the set of leaves ofT
isV
, the internal nodes ofT
are labelled degenerateor prime, and- for every edge
e
ofT
,{C
1
e
, C
e
2
}
is a strong member ofF
, and there is no other strong member inF
,- for every node
α
labelled degenerate,and for every∅ ( I ( {1, . . . , d(α)}
,{∪
i∈I
C
α
i
, V
\ ∪
i∈I
C
α
i
}
isinF
,and there is no other member inF
.Split de omposition. A split in a graph
G
= (V, E)
is a bipartition{X, Y }
ofV
su h that thesetof verti es inX
having a neighbour inY
have thesame neighbourhood inY
(i.e., for allu, v
∈ X
su hthatN
(u) ∩ Y 6= ∅
andN
(v) ∩ Y 6= ∅
,thenN
(u) ∩ Y = N (v) ∩ Y
). A o-split ina graphG
is a splitinG
. 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 graphG
. For alli
∈ {1, . . . , d(α)}
letv
i
∈ C
i
α
su h thatN
(v
i
) \ C
i
α
6= ∅
. Sin eG
is onne ted, su h av
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 hthatforallu, 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 graphG
. For alli
∈ {1, . . . , d(α)}
letv
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℄.3 Re ognition of NLC-2 graphs
3.1 NLC-2
ρ
-free anoni al de ompositionInthis se tion,
G
= (V, E, l)
isa 2-labelled graph su h thatevery mono- olouredmodule (i.e. a moduleM
su h that∀v, v
′
∈ M
,
l(v) = l(v
′
)
)hassize
1
. A ouple(X, Y )
isa ut ifX
∪ Y = V
,X
∩ Y = ∅
,X
6= ∅
andY
6= ∅
. LetS
⊆ {1, 2} × {1, 2}
. A ut(X, Y )
is aS
- ut ofG
iffor allu
∈ X
andv
∈ Y
, then{u, v} ∈ E
if and only if(l(u), l(v)) ∈ S
. ForS
⊆ {1, 2} × {1, 2}
letF
S
(G)
be thesetofS
- utofG
.Denition 5 (Symmetry). We say that
S
∈ {1, 2} × {1, 2}
is symmetri if(1, 2) ∈ S ⇐⇒
(2, 1) ∈ S
,otherwisewesaythatS
isnon-symmetri .Denition 6 (Degenerate property). Afamily
F
of utshasthedegenerate property ifthere isapartitionP
ofV
su hthatfor all∅ ( X ( P
,(
S
X
∈X
X,
S
Y
∈P\X
Y
)
isinF
,andthere isno others utinF
.Lemma 7. For every symmetri
S
⊆ {1, 2} × {1, 2}
,F
S
(G)
has the degenerate property. Proof. The familyF
{}
(G)
has the degenerate property sin e(X, Y )
is a{}
- ut if and only if there is no edges betweenX
andY
(P
is exa tly the onne ted omponents). ForW
⊆ V
, letG|W = (V, E∆W
2
, l)
. For
i
∈ {1, 2}
letV
i
= {v ∈ V : l(v) = i}
. LetG
1
= G|V
1
,G
2
= G|V
2
andG
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
′
)
inF
,eitherX
⊆ X
′
orX
′
⊆ X
.Lemma 9. For every non-symmetri
S
⊆ {1, 2} × {1, 2}
,F
S
(G)
has the linear property. Proof. CaseS
= {(1, 2)}
: suppose thatX
\ X
′
and
X
′
\ X
are both non-empty. Then if
u
∈
X
\ X
′
is labelled
1
andv
∈ X
′
\ X
is labelled
2
,u
andv
hasto be adja ent and non-adja ent, ontradi tion. ThusX
\ X
′
and
X
′
\ X
aremono- oloured. Nowsupposew.l.o.g. thatallverti es in
X∆X
′
are labelled
1
. ThenX∆X
′
is adja ent to all verti es labelled
2
inY
∩ Y
′
and non adja ent to all verti es labelled
1
inY
∩ 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.Input: A
2
-labelled graphG
= (V, E, l)
Output: ANLC-2
ρ
-freede omposition tree,or failifG
is not NLC-2ρ
-free if|V | = 1
thenreturnthe leaf·(l(v))
(whereV
= {v}
)1
Let
S
be the setof subsetsof{1, 2} × {1, 2}
andσ
bethelexi ographi orderofS
2forea h
S
∈ S
w.r.t.σ
do 3Compute
P
S
(G)
,andP
′
S
(G)
ifS
is non-symmetri (see algorithm 2) 4if
|P
S
(G)| > 1
then 5Create anew
×
S
nodeβ
6forea h
P
∈ P
S
(G)
(w.r.t.P
′
S
(G)
ifS
is non-symmetri ) do 7make NLC-2
ρ
-free de omposition tree ofG[P ]
bea hildofβ
. 8return the tree rooted at
β
9fail withNot NLC-2
ρ
-free 10Algorithm 1: Computationof the NLC-2
ρ
-free anoni alde omposition treeFor
S
⊆ {1, 2} × {1, 2}
, letP
S
(G)
denote the unique partition ofV
su h that (1) for all(X, Y ) ∈ F
S
(G)
andP
∈ P
S
(G)
,P
⊆ X
orP
⊆ Y
,and (2) for allP, P
′
∈ P
,
P
6= P
′
,there is a
(X, Y ) ∈ F
S
(G)
su h thatP
⊆ X
andP
′
⊆ Y
,orP
⊆ Y
andP
′
⊆ X
. For a non-symmetriS
∈ {1, 2} × {1, 2}
, letP
′
S
(G) = (P
1
, . . . , P
k
)
denote the unique orderingof elements inP
S
(G)
su hthat for all(X, Y ) ∈ F
S
(G)
,thereis al
su hthatX
= ∪
i∈{1,...,l}
P
i
.Lemma 10. If
G
is in NLC-2ρ
-free, then there is aS
⊆ {1, 2} × {1, 2}
su h thatF
S
(G)
is non-empty.Proof. If
G
is NLC-2ρ
-free, thenthereis aS
⊆ {1, 2} × {1, 2}
,and two graphsG
1
andG
2
su h thatG
= G
1
×
S
G
2
. Thus(V (G
1
), V (G
2
)) ∈ F
S
(G)
andF
S
(G)
isnon empty.Lemma 11. Let
G
= (V, E, l)
2-labelled graph andletS
⊆ {1, 2} × {1, 2}
. IfG
is NLC-2ρ
-free andhasnomono- olourednon-trivialmodule,thenforallP
∈ P
S
(G)
,G[P ]
hasnomono- oloured non-trivialmodule.Proof. If
M
is amono- oloured moduleofG[P ]
,thenM
isa mono- olouredmodule ofG
. Con-tradi tion.Lemma 12. Let
G
= (V, E, l)
2-labelled graph and letS
⊆ {1, 2} × {1, 2}
. ThenG
is NLC-2ρ
-free if andonlyif for allP
∈ P
S
(G)
,G[P ]
isNLC-2ρ
-free.Proof. Theonlyif isimmediate. Nowsupposethatfor all
P
∈ P
S
(G)
,G[P ]
isNLC-2ρ
-free. IfS
issymmetri ,letP
S
(G) = {P
1
, . . . , P
|P
S
(G)|
}
. ThenG
= ((G[P
1
]×
S
G[P
2
])×
S
. . .
×
S
G[P
|P
S
(G)|
]
, andG
is NLC-2ρ
-free. Otherwise, ifS
isnon-symmetri , letP
′
S
(G) = (P
1
, . . . , P
|P
S
(G)|
)
. ThenG
= ((G[P
1
] ×
S
G[P
2
]) ×
S
. . .
×
S
G[P
|P
S
(G)|
]
,andG
isNLC-2ρ
-free.The NLC-2
ρ
-free de omposition tree of a2
-labelled graphG
is a rooted tree su h that the leavesare theverti es ofG
,and the internal nodesarelabelled by×
S
,withS
⊆ {1, 2} × {1, 2}
. An internal node is degenerated ifS
is symmetri , and linear ifS
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 ifwexatotalorderonthesubsetsof
{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 ofa2
-labelled prime graph, orfailsifG
isnot NLC-2ρ
-free.Algorithm 2 omputes
P
S
andP
′
S
for a2
-labelled primegraphG
andS
⊆ {1, 2} × {1, 2}
in lineartime. Weneedsomeadditionaldenitionsforthisalgorithmanditsproofof orre tness. AInput: A
2
-labelled graphG
,andS
⊆ {1, 2} × {1, 2}
Output:P
S
ifS
issymmetri ,P
′
S
ifS
is non-symmetriV
i
← {v : v ∈ V
andl(v) = i}
; 1if
(1, 1) ∈ S
thenC
1
←
o- onne ted omponentsofG[V
1
]
; 2else
C
1
←
onne ted omponents ofG[V
1
]
; 3if
(2, 2) ∈ S
thenC
2
←
o- onne ted omponentsofG[V
2
]
; 4else
C
2
←
onne ted omponents ofG[V
2
]
; 5B = (C
1
,
C
2
, E
j
, E
m
) ←
thebipartite trigraphbetween theelements ofC
1
andC
2
; 6if
S
∩ {(1, 2), (2, 1)} = ∅
then 7return onne ted omponents of
(C
1
,
C
2
, E
j
∪ E
m
)
8else if
S
∩ {(1, 2), (2, 1)} = {(1, 2), (2, 1)}
then 9return onne ted omponents of the bi- omplement of
(C
1
,
C
2
, E
j
)
10else Sear h allsemi-joins of
B
(see appendix) ; 11Algorithm 2: Computationof
P
S
andP
′
S
bipartite graphisatriplet
(X, Y, E)
su hthatE
⊆ X ×Y
. Thebi- omplementofabipartitegraph(X, Y, E)
isthebipartitegraph(X, Y, (X × Y ) \ E)
. Abipartitetrigraph(BT)isabipartitegraph withtwotypesofedges: thejoin edgesandthemixed edges. ItisdenotedbyB = (X, Y, E
j
, E
m
)
whereE
j
are the set of join edges, andE
m
the set of mixed edges. A BT-module in a BT is aM
⊆ X
orM
⊆ Y
su h thatM
is a module in(X, Y, E
j
)
and there is no mixed edges betweenM
and(X ∪ Y ) \ M
. Forv
∈ X ∪ Y
, letN
j
(v) = {u ∈ X ∪ Y : {u, v} ∈ E
j
}
andN
m
(v) = {u ∈ X ∪ Y : {u, v} ∈ E
m
}
. Letd
j
(v) = |N
j
(v)|
andd
m
(v) = |N
m
(v)|
. A semi-join inaBT(X, Y, E
j
, E
m
)
isa ut(A, B)
ofX
∪ Y
,su hthatthere isno edgesbetweenA
∩ Y
andB
∩ X
,and thereisonly join edges betweenA
∩ X
andB
∩ Y
.Inalgorithm2,
B
isobtainedfromthegraphG
. Verti esofX
orrespondtosubsetsofverti es labelled1
inG
, and verti es ofY
orrespond to subsets of verti es labelled2
. There is a join edgebetweenM
andM
′
in
B
ifM
1M
′
in
G
,and there isa mixed edgebetweenM
∈ X
andM
′
∈ Y
inB
ifthereis at leastan edgeand anon-edge betweenM
andM
′
in
G
. Su h agraphB
an easily be built in linear time from a given graphG
. It su es to onsider a list and an array bounded by the number of omponent inG
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 size1
. Let(x
1
, . . . , x
|X|
)
beX
sorted by(d
j
(x), d
m
(x))
in lexi ographi de reasing order. If(A, B)
is a semi-joinofG
, then there is ak
∈ {0, . . . , |X|}
su h thatA
∩ X = {x
1
, . . . , x
k
}
.Lemma 14. Let
k
∈ {0, . . . , |X|}
andk
′
∈ {0, . . . , |Y |}
. Then
(A, (X ∪ Y ) \ A)
, whereA
=
{x
1
, . . . , x
k
, y
1
, . . . , y
k
′
}
,isasemi-joinofG
ifandonlyifP
k
i=1
d
j
(x
i
)−
P
k
′
i=1
d
j
(y
i
) = k×(|Y |−k
′
)
andP
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)
isaS
- ut. If(1, 1) 6∈ S
,thenthereisnoedgebetweenA∩V
1
andB
∩V
1
,thus(A, B)
annot uta omponentC
1
(andsimilarlyfor(1, 1) ∈ S
,andforC
2
). Now we work on the BTB = (C
1
,
C
2
, E
j
, E
m
)
. IfS
∩ {(1, 2), (2, 1)} = ∅
,thenS
- uts orrespond exa tly to onne ted omponents ofB
, and ifS
∩ {(1, 2), (2, 1)} = {(1, 2), (2, 1)}
thenS
- uts orrespond exa tly to onne ted omponents of the BT ofG
,whi h is(C
1
,
C
2
,
(C
1
× C
2
) \ (E
j
∪
E
m
), E
m
)
. Finally,ifS
is non-symmetri ,S
- uts orrespond to semi-joinsofB
(seeappendix).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
andY
), 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 inO(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 }
ofV
isa2
-bimodule ifX
anbepartitioned intoX
1
andX
2
,andY
intoY
1
andY
2
su hthatforall(i, j) ∈ {1, 2}× {1, 2}
,theneitherX
i
0
Y
j
or
X
i
1Y
j
. It is easy to see that if{X, Y }
is a2
-bimodule ifand only if{X, Y }
is a split, a o-split or abi-join. Moreover, ifmin(|X|, |Y |) > 1
then{X, Y }
annot be both of them in the same time(sin eG
isprime).Let
l
: V → {1, 2}
be a 2-labelling. Thens(l)
denote the 2-labelling onV
su h that for allv
∈ V
,s(l)(v) = 1
ifandonly ifl(v) = 2
.Denition 18 (Labelling indu ed by a
2
-bimodule). Let{X, Y }
be a2
-bimodule. We dene the labellingl
: V → {1, 2}
ofG
indu ed by{X, Y }
. If|X| = |Y | = 1
, thenl(x) = 1
andl(y) = 2
, whereX
= {x}
andY
= {y}
. If|X| = 1
, thenl(v) = 1
iv
∈ N [x]
. Similarly if|Y | = 1
,thenl(v) = 1
iv
∈ N [y]
. Nowwe supposemin(|X|, |Y |) > 1
. If{X, Y }
isa split,then theset of verti es inX
witha neighbourY
and theset of verti es inY
witha neighbour inX
islabelled1
,others verti es arelabelled2
. If{X, Y }
is a o-split, thena labelling ofG
indu ed by{X, Y }
isalabellingofG
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,thenthereistwopossibleslabellingl
1
andl
2
, withl
1
= s(l
2
)
. If{X, Y }
is a2
-bimoduleofG
andl
a labelling indu edby{X, Y }
,then every mono- olouredmodule hassize1
(sin eG
is primeand|V | ≥ 3
).Denition 19 (Good
2
-bimodule). A2
-bimodule{X, Y }
is good if the graphG
with the labellingindu ed by{X, Y }
isNLC-2ρ
-free. Thefollowingproposition omes immediatelyfrom lemma3.Proposition 20.
G
isNLC-2 if andonly ifG
has a good2
-bimodule.Lemma 21. If
G
has a good2
-bimodule{X, Y }
whi h is a split, thenG
has a good2
-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
}
. Letl
: V → {1, 2}
bethelabellingofG
indu edby{X, Y }
. For alli
∈ {1, . . . , d(α)}
,(G[C
i
α
], l|
C
i
α
)
is NLC-2ρ
-free (wherel|
W
isthe fun tionl
restri tedatW
). Letl
′
be the
2
-labelling ofV
su h that for alli
, andv
∈ C
i
α
,l(v) = 1
if and only ifv
has a neighbour outside ofC
i
α
. For alli
, eitherl|
C
i
α
= l
′
|
C
i
α
, or∀v ∈ C
i
α
,l(v) = 2
. Then for alli
,(G[C
i
α
], l
′
|
C
i
α
)
isNLC-2
ρ
-free,andthus(G, l
′
)
isNLC-2
ρ
-free. Sin ethereisadominatingvertex inthe hara teristi graphofα
, there is aj
su h that the labelling indu ed bythe strong split{C
α
j
, V
\ C
α
j
}
isl
′
. Thus thestrong split
{C
j
Input: A graph
G
Result: Yes i
G
is NLC-2S ←
thesetofstrong splits, o-splitsand bi-joinsofG
; forea h{X, Y } ∈ S
dol
←
thelabellingofG
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
saythatifG
hasagood2
-bimodule{X, Y }
whi hisa o-split, thenG
hasagood2
-bimodule whi his astrong o-split. The following lemma issimilar to Lemma 21. Lemma22. IfG
hasa good2
-bimodule{X, Y }
whi hisa bi-join,thenG
has agood2
-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, ifG
is NLC-2, then it has a good strong2
-bimodule and the algorithm returnsYes.Theset
S
anbe omputed usingalgorithms for omputingsplitde ompositiononG
andG
, and bi-join de omposition onG
. Note that it is not required to usea lineartime algorithm for splitde omposition [5 ℄: some simpler algorithms run inO(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
hasO(n)
elements. Testingifa2
-bimodule isgood takesO(nm)
usingalgorithm 1. Sototal runningtime isO(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 graphsThefollowingpropositionsaredire t onsequen esofproperties(linearanddegenerate)of
S
- uts. Proposition25. ConsiderasymmetriS
∈ {1, 2}×{1, 2}
. TwographsG
andH
are isomorphi ifandonlyif there isa bije tionπ
betweenP
S
(G)
andP
S
(H)
su h that forallP
∈ P
S
(G)
,G[P ]
isisomorphi toH[π(P )]
.Proposition 26. Let a non-symmetri
S
∈ {1, 2} × {1, 2}
and letG
andH
be two graphs. LetP
′
S
(G) = (P
1
, . . . , P
k
)
andP
′
S
(H) = (P
1
′
, . . . , P
k
′
′
)
thenG
andH
are isomorphi if and only ifk
= k
′
andfor all
i
∈ {1, . . . , k}
,G[P
i
]
isisomorphi toH[P
′
i
]
.By theprevious 2 propositions,two NLC-2
ρ
-free 2-labelled graphsG
andH
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 doneinO(nm)
time.Input: Two primeNLC-2graphs
G
andH
Result: Yes ifG
≃ H
,No otherwiseS ←
thesetofstrong splits, o-splitsand bi-joinsofG
;S
′
←
thesetof strong splits, o-splitsand bi-joinsof
H
;if there isno good
2
-bimodule inS
thenfail withG
is notNLC-2;{X, Y } ←
a good2
-bimoduleinS
;l
←
the labellingofG
indu ed by{X, Y }
; forea h{X
′
, Y
′
} ∈ S
′
su h that
{X
′
, Y
′
}
is good do
l
′
←
thelabellingofH
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 thatG
≃ H
andletπ
: V (G) → V (H)
beabije tionsu hthat{u, v} ∈ E(G)
i(π(u), π(v)) ∈ E(H)
. Then{X
′
, Y
′
}
withX
′
= π(X)
andY
′
= π(Y )
is a good
2
-bimodule ifH
. Ifmin(|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
andS
′
anbe omputedin
O(n
2
)
timeusinglineartimealgorithmsfor omputing splitde omposition on
G
andG
,and bi-joinde omposition onG
. The setsS
andS
′
have
O(n)
elements. Testif a2
-bimoduleis good takeO(nm)
using algorithm 1, and test iftwo2
-labelled prime graphsareisomorphi take alsoO(nm)
. Thus the total runningtimeisO(n
2
m)
.
4.3 Graph isomorphism on NLC-2 graphs
Itiseasy toshowthatgraphisomorphism onprimeNLC-2graphs withan additionallabels into
{1, . . . , q}
an be done inO(n
2
m)
time. For that, we add the additional label of
v
at the leaf orrespondingtov
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)
andM(H)
be themodular de omposition ofG
andH
. ForM
∈ M(G)
, letG
M
beG[M ]
, and forM
∈ M(H)
, letH
M
beH[M ]
. LetG
∗
M
be the hara teristi graph ofG
M
(note that|V (G
∗
M
)|
is the number of hildren ofM
in the modular de omposition tree). LetM
(i,∗)
= {M ∈ M(G) ∪ M(H) : |M | = i}
, letM
(∗,j)
= {M ∈ M(G) ∪ M(H) : |V (G
∗
M
)| = j}
and letM
(i,j)
= M
(i,∗)
∩ M
(∗,j)
. Note thatP
n
j=1
(M
(∗,j)
× j)
is the number of verti es inG
plus the number of edges inthe modular de omposition tree,and thus isat most3n − 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 )
andl(M
′
)
areset,
G
M
andG
M
′
areisomorphi ifandonly ifl(M ) = l(M
′
)
Input: Two NLC-2graphs
G
andH
Result: Yes ifG
≃ H
,No otherwiseforevery
M
∈ M(G) ∪ M(H)
su h that|M | = 1
dol(M ) ← 1
; fori
from2
ton
dofor
j
from2
toi
doCompute the partition
P
ofM
(i,j)
su hthatM
andM
′
areinthesame lass of
P
ifand onlyif(G
∗
M
, l) ≃ (G
∗
M
′
, l)
. ; forea hP
∈ P
doa
←
a newlabel(an integer not inImg(l)
) ; For allM
∈ P
,l(M ) ← a
;Algorithm 5: Isomorphism onNLC-2graphs
total time
f
(n, m)
of thisalgorithm isO(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.
A.1 Proof of lemma 13
Let
G
= (X, Y, E
j
, E
m
)
beaBTsu hthateveryBT-modulehassize1
. 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-joinofG
,thenthere isak
∈ {0, . . . , |X|}
su h thatA
∩ X = {x
1
, . . . , x
k
}
.Proof. For all
v
∈ A ∩ X
,d
j
(v) ≥ |B ∩ Y |
, and for allv
∈ B ∩ X
,d
j
(v) ≤ |B ∩ Y |
. Moreover, if there is av
∈ B ∩ X
withd
j
(v) = |B ∩ Y |
, thend
m
(v) = 0
. LetC
= {v ∈ X : d
j
(v) =
|B ∩ Y |
andd
m
(v) = 0}
. ThenC
is a BT-module ofG
, and thus|C| ≤ 1
. Every vertex inA
∩ X \ C
arebeforeeveryvertexinB
∩ X \ C
intheordering. Moreover,if|C| > 0
,thenverti es inA
∩ X \ C
arebeforethe vertexinC
,and verti es inB
∩ X \ C
are after thevertexinC
in theordering.A.2 Proof of lemma 14
Let
k
∈ {0, . . . , |X|}
andk
′
∈ {0, . . . , |Y |}
. Then
(A, (X ∪ Y ) \ A)
, whereA
=
{x
1
, . . . , x
k
, y
1
, . . . , y
k
′
}
,isasemi-joinofG
ifandonlyifP
k
i=1
d
j
(x
i
) −
P
k
′
i=1
d
j
(y
i
) =
k
× (|Y | − k
′
)
andP
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
thenumberofjoinedgesbetweenA
∩ X
andB
∩ Y
,b
the numberofjoinedgesbetweenA
∩ X
andA
∩ Y
,andc
thenumber ofmixededges betweenA
∩ X
andA
∩ Y
. Note thata
≤ k(|Y | − k
′
)
,a
+ b =
P
k
i=1
d
j
(x
i
)
andb
≤
P
k
′
i=1
d
j
(y
i
)
, thusa
≥ k(|Y | − k
′
)
. So we havea
= k(|Y | − k
′
)
,and
P
k
′
i=1
d
j
(y
i
) − b = 0
. In other words, there is onlyjoinedgesbetweenA
∩ X
andB
∩ Y
,and thereisnojoinedges betweenA
∩ Y
andB
∩ X
. Now sin e there is only join edges betweenA
∩ X
andB
∩ Y
,c
=
P
k
i=1
d
m
(x
i
) =
P
k
′
i=1
d
m
(y
i
)
, thus there isno mixededges betweenA
∩ Y
andB
∩ X
.A.3 Algorithm to ompute
P
′
S
whenS
is non-symmetriProof. 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
)
ands
′
m
=
P
k
′
i=1
d
m
(y
i
)
. InB
, every BT-modulehassize1
, otherwisethereisamono- olouredmoduleinG
ofsizeatleast2
. If(A, B)
isasemi-join,thenby lemma13on(C
1
,
C
2
, E
j
, E
m
)
and(C
2
,
C
1
, E
j
, E
m
)
,thereisaa
andb
su hthatA∩C
1
= {x
1
, . . . , x
a
}
andA
∩ C
2
= {y
1
, . . . , y
b
}
. At anytime,(A
′
,
(C
1
∪ C
2
) \ A
′
)
withA
′
= {x
1
, . . . , x
l
, y
1
, . . . , y
l
′
}
is the last semi-join found. Atk
= a
, the while line 12 will stop whens
j
− s
′
j
= k × (|C
2
| − k
′
)
sin e for every
v
∈ A ∩ C
2
,d
j
(v) ≤ k
,ands
′
j
+ k × (|C
2
| − k
′
)
de rease withk
′
. Moreover, when thewhileloop stops,
s
m
= s
′
m
sin es
′
m
in rease withk
′
. Thus ifb
6= k
′
,then{y
k
′
+1
, . . . y
b
}
isa BT-module andb
= k
′
+ 1
(sin e every BT-module has size
1
). In all ases the algorithm nds(A, B)
,and addsthe partition inP
′
.
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)
.Input: A
2
-labelled graphG
,anda non-symmetriS
⊆ {1, 2} × {1, 2}
Output:P
′
S
V
i
← {v : v ∈ V
andl(v) = i}
; 1if
(1, 1) ∈ S
thenC
1
←
o- onne ted omponentsofG[V
1
]
; 2else
C
1
←
onne ted omponents ofG[V
1
]
; 3if
(2, 2) ∈ S
thenC
2
←
o- onne ted omponentsofG[V
2
]
; 4else
C
2
←
onne ted omponents ofG[V
2
]
; 5B = (C
1
,
C
2
, E
j
, E
m
) ←
thebipartite trigraphbetween theelements ofC
1
andC
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))
; 8P
′
← ()
;l
← 0
;l
′
← 0
;k
′
← 0
;k
← 0
; 9s
j
← 0
;s
m
← 0
;s
′
j
← 0
;s
′
m
← 0
; 10 whilek
≤ |C
1
|
do 11 whiles
j
− s
′
j
< k
× (|C
2
| − k
′
)
or (s
j
− s
′
j
= k × (|C
2
| − k
′
)
ands
m
> s
′
m
) do 12k
′
← k
′
+ 1
;s
′
j
← s
′
j
+ d
j
(y
k
′
)
;s
′
m
← s
′
m
+ d
m
(y
k
′
)
; 13 ifs
j
− s
′
j
= k × (|C
2
| − k
′
)
ands
m
= s
′
m
then 14add
{x
l+1
, . . . , x
k
} ∪ {y
l
′
+1
. . . , y
k
′
}
at theend ofP
′
;l
← k
;l
′
← k
′
; 15 ifs
j
− s
′
j
− d
j
(y
k+1
) = k × (|C
2
| − k
′
− 1)
ands
m
= s
′
m
+ d
m
(y
k+1
)
then 16k
′
← k
′
+ 1
;s
′
j
← s
′
j
+ d
j
(y
k
′
)
;s
′
m
← s
′
m
+ d
m
(y
k
′
)
; 17add