. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
.
...
Complexity of Merging Ordered Documents
Antoine Amarilli1 M. Lamine Ba1 Daniel Deutch2 Pierre Senellart1
1Télécom ParisTech, Paris, France
2Tel Aviv University, Tel Aviv, Israel
November 20, 2013
1/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Version control
Version control software (VCS) for line-based textual data.
Also, tree-shaped documents:
⇒ Texts (sections, paragraphs)
⇒ XML
⇒ Code
⇒ ...
Main problem: solvingconflicts.
2/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
DAG of versions
..
V3a
.
V2b
.
V3b .
V1
.
V2a
.
V4 (merged)
.
Root
3/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Conflict resolution
We mustmerge conflicting versions:
..
..
A.
....
..
. C ..
..
B
⇝ ..
..
A...
..
B...
..
D
and
..
..
A.
....
..
C...
..
F .
....
..
. B ..
..
E
and..
..
A.
....
..I .
....
..
G...
..
H .
....
..
. C ..
..
B
⇒ How can such conflicts beresolved?
4/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Importance of order
Use of probabilistic XML for versioning already investigated:
⇒ M. Lamine Ba, T. Abdessalem, P. Senellart.
Uncertain Version Control in Open Collaborative Editing of Tree-Structured Documents.
DocEng’13, Florence, Italy.
⇒ M. Lamine Ba, T. Abdessalem, P. Senellart.
Merging Uncertain Multi-Version XML Documents.
DChanges’13, Florence, Italy.
Does not take orderinto account on child nodes.
Important source of uncertainty!
....
Root...
..
New-1
....
Root...
..
New-2
⇝
....
Root. ....
..
New-2 .
..
..
New-1
or
....
Root. ....
..
New-1 .
..
..
New-2
5/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Representing the merge
The actual merge is chosenby the user.
Computing all possible mergesis unreasonable.
Ideally, derive astrong representation systemto represent the possible merges, merges of merges, etc.
Here: study the complexity of a decision problem:
Input. Set of documentsDto merge.
Possible worldWof the merge.
Output. IsW really a possible mergeof D?
We restrict the study to an ordered listfor now.
(List of childrenfor a tree of height 1.)
6/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Table of contents
1... Introduction
2... Merge model
3... Merge without IDs
4... Merge with move
5... Conclusion
7/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Edition
Base version Bwith items and unique IDs.
Insert operation to insert a new node with a fresh ID.
# Section 1 Introduction 2 Problem 3 Conclusion
# Section 1 Introduction 2 Problem 4 Extension 5 Related work 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 3 Conclusion
8/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Edition
Base version Bwith items and unique IDs.
Insert operation to insert a new node with a fresh ID.
# Section 1 Introduction 2 Problem 3 Conclusion
# Section 1 Introduction 2 Problem 4 Extension 5 Related work 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 3 Conclusion
8/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Edition
Base version Bwith items and unique IDs.
Insert operation to insert a new node with a fresh ID.
# Section 1 Introduction 2 Problem 3 Conclusion
# Section 1 Introduction 2 Problem 4 Extension 5 Related work 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 3 Conclusion
8/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Edition
Base version Bwith items and unique IDs.
Insert operation to insert a new node with a fresh ID.
# Section 1 Introduction 2 Problem 3 Conclusion
# Section 1 Introduction 2 Problem 4 Extension 5 Related work 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 3 Conclusion
8/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Merge
Union of the nodes: D1∪D2.
Consistent order with the individual documents.
# Section 1 Introduction 2 Problem 4 Extension 5 Related work 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 4 Extension 7 Extension 5 Related work 3 Conclusion
9/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Merge
Union of the nodes: D1∪D2.
Consistent order with the individual documents.
# Section 1 Introduction 2 Problem 4 Extension 5 Related work 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 4 Extension 7 Extension 5 Related work 3 Conclusion
9/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Merge
Union of the nodes: D1∪D2.
Consistent order with the individual documents.
# Section 1 Introduction 2 Problem 4 Extension 5 Related work 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 4 Extension 7 Extension 5 Related work 3 Conclusion
9/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Merge
Union of the nodes: D1∪D2.
Consistent order with the individual documents.
# Section 1 Introduction 2 Problem 4 Extension 5 Related work 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 4 Extension 7 Extension 5 Related work 3 Conclusion
9/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Possible worlds
Exponentiallymany merges (|D1|+|D2|
|D1|
)
PTIME algorithm to check if a world is a possible merge.
Given possible worldW with IDs, do the following:
Verify thedomain.
For everypairx<y,
For everydocumentDcontaining bothxandy, Checkifx<yin D.
# Section 1 Introduction 2 Problem 4 Extension 5 Related work 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 5 Related work 4 Extension 3 Conclusion
10/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Possible worlds
Exponentiallymany merges (|D1|+|D2|
|D1|
)
PTIME algorithm to check if a world is a possible merge.
Given possible worldW with IDs, do the following:
Verify thedomain.
For everypairx<y,
For everydocumentDcontaining bothxandy, Checkifx<yin D.
# Section 1 Introduction 2 Problem 4 Extension 5 Related work 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 5 Related work 4 Extension 3 Conclusion
10/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Possible worlds
Exponentiallymany merges (|D1|+|D2|
|D1|
)
PTIME algorithm to check if a world is a possible merge.
Given possible worldW with IDs, do the following:
Verify thedomain.
For everypairx<y,
For everydocumentDcontaining bothxandy, Checkifx<yin D.
# Section 1 Introduction 2 Problem 4 Extension 5 Related work 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 5 Related work 4 Extension 3 Conclusion
10/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Possible worlds
Exponentiallymany merges (|D1|+|D2|
|D1|
)
PTIME algorithm to check if a world is a possible merge.
Given possible worldW with IDs, do the following:
Verify thedomain.
For everypairx<y,
For everydocumentDcontaining bothxandy, Checkifx<yin D.
# Section 1 Introduction 2 Problem 4 Extension 5 Related work 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 5 Related work 4 Extension
3 Conclusion 10/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Possible worlds
Exponentiallymany merges (|D1|+|D2|
|D1|
)
PTIME algorithm to check if a world is a possible merge.
Given possible worldW with IDs, do the following:
Verify thedomain.
For everypairx<y,
For everydocumentDcontaining bothxandy, Checkifx<yin D.
# Section 1 Introduction 2 Problem 4 Extension 5 Related work 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 5 Related work 4 Extension 3 Conclusion 10/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Table of contents
1... Introduction
2... Merge model
3... Merge without IDs
4... Merge with move
5... Conclusion
11/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Possible worlds, without IDs
We may not have the IDsin W (e.g., user input).
Ambiguity about how to match elements!
# Section 1 Introduction 2 Problem 4 Extension 5 Related work 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 3 Conclusion
Section Introduction Preliminaries Problem Extension Related work Extension Conclusion
12/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Possible worlds, without IDs
We may not have the IDsin W (e.g., user input).
Ambiguity about how to match elements!
# Section 1 Introduction 2 Problem 4 Extension 5 Related work 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 3 Conclusion
Section Introduction Preliminaries Problem Extension Related work Extension Conclusion
12/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Possible worlds, without IDs
We may not have the IDsin W (e.g., user input).
Ambiguity about how to match elements!
# Section 1 Introduction 2 Problem 4 Extension 5 Related work 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 3 Conclusion
Section Introduction Preliminaries Problem Extension Related work Extension Conclusion
12/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Possible worlds, without IDs
We may not have the IDsin W (e.g., user input).
Ambiguity about how to match elements!
# Section 1 Introduction 2 Problem 4 Extension 5 Related work 3 Conclusion
# Section 1 Introduction 6 Preliminaries 2 Problem 7 Extension 3 Conclusion
Section Introduction Preliminaries Problem Extension Related work Extension Conclusion
12/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Dynamic algorithm
Ambiguity makes it look like the problem is hard In fact a dynamic algorithmsolves it inO(n2).
Show it on anexample.
# Label
1 A
3 A
4 B
2 B
# Label
1 A
5 A
2 B
6 A
Label A A A B B A
13/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Dynamic algorithm
Ambiguity makes it look like the problem is hard In fact a dynamic algorithmsolves it inO(n2).
Show it on anexample.
# Label
1 A
3 A
4 B
2 B
# Label
1 A
5 A
2 B
6 A
Label A A A B B A
13/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Dynamic algorithm
Ambiguity makes it look like the problem is hard In fact a dynamic algorithmsolves it inO(n2).
Show it on anexample.
# Label
1 A
3 A
4 B
2 B
# Label
1 A
5 A
2 B
6 A
Label A A A B B A
13/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Dynamic algorithm
Ambiguity makes it look like the problem is hard In fact a dynamic algorithmsolves it inO(n2).
Show it on anexample.
# Label
1 A
3 A
4 B
2 B
# Label
1 A
5 A
2 B
6 A
Label A A A B B A
13/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Dynamic algorithm (example)
Set of documents D:
A1 A3B4 B2. A1 A5B2 A6.
Possible world W: A A A B B A.
A1 A3 B4 B2 ·
A1 A5 B2 A6
·
14/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Dynamic algorithm (example)
Set of documents D:
A1 A3B4 B2. A1 A5B2 A6.
Possible world W: A A A B B A.
A1 A3 B4 B2 ·
A1 A5 B2 A6
·
14/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Dynamic algorithm (example)
Set of documents D:
A1 A3B4 B2. A1 A5B2 A6.
Possible world W: A A A B B A.
A1 A3 B4 B2 ·
A1 A
A5 A A B
B2 A B B
A6 A
· ·
14/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Dynamic algorithm (example)
Set of documents D:
A1 A3B4 B2. A1 A5B2 A6.
Possible world W: A A A B B A.
A1 A3 B4 B2 ·
A1 A
A5 A A B
B2 A B B
A6 A
· ·– ·
14/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Dynamic algorithm (example)
Set of documents D:
A1 A3B4 B2. A1 A5B2 A6.
Possible world W: A A A B B A.
A1 A3 B4 B2 ·
A1 A
A5 A A B
B2 A B B
A6 A –↓
· ·– ·
14/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Dynamic algorithm (example)
Set of documents D:
A1 A3B4 B2. A1 A5B2 A6.
Possible world W: A A A B B A.
A1 A3 B4 B2 ·
A1 A
A5 A A B
B2 A B B– ↘
A6 A –↓
· ·– ·
14/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Dynamic algorithm (example)
Set of documents D:
A1 A3B4 B2. A1 A5B2 A6.
Possible world W: A A A B B A.
A1 A3 B4 B2 ·
A1 A
A5 A A B
B2 A B –→ B– ↘
A6 A –↓
· ·– ·
14/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Dynamic algorithm (example)
Set of documents D:
A1 A3B4 B2. A1 A5B2 A6.
Possible world W: A A A B B A.
A1 A3 B4 B2 ·
A1 A
A5 A A B
B2 A– → B –→ B– ↘
A6 A –↓
· ·– ·
14/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Dynamic algorithm (example)
Set of documents D:
A1 A3B4 B2. A1 A5B2 A6.
Possible world W: A A A B B A.
A1 A3 B4 B2 ·
A1 A
A5 A A B– •
B2 A– → B –→ B– ↘
A6 A –↓
· ·– ·
14/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Dynamic algorithm (example)
Set of documents D:
A1 A3B4 B2. A1 A5B2 A6.
Possible world W: A A A B B A.
A1 A3 B4 B2 ·
A1 A
A5 A A –↓ B– •
B2 A– → B –→ B– ↘
A6 A –↓
· ·– ·
14/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Dynamic algorithm (example)
Set of documents D:
A1 A3B4 B2. A1 A5B2 A6.
Possible world W: A A A B B A.
A1 A3 B4 B2 ·
A1 A
A5 A–→↓ A –↓ B– •
B2 A– → B –→ B– ↘
A6 A –↓
· ·– ·
14/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Dynamic algorithm (example)
Set of documents D:
A1 A3B4 B2. A1 A5B2 A6.
Possible world W: A A A B B A.
A1 A3 B4 B2 ·
A1 A– ↘
A5 A–→↓ A –↓ B– •
B2 A– → B –→ B– ↘
A6 A –↓
· ·– ·
14/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
More documents
If we havemultiple documents to merge (sayk).
Generalized dynamic algorithmis inO(nk).
Hence, PTIME for fixedk.
What if kis not fixed?
Certainly it is still in NP.
In fact, it is NP-hard (reduction from MinSAT).
Thanks: http://cstheory.stackexchange.com/a/19081/
15/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Table of contents
1... Introduction
2... Merge model
3... Merge without IDs
4... Merge with move
5... Conclusion
16/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Conflicts
Move operation to move arbitrary nodes.
Documents can disagree.
# Section 1 Problem A 2 Problem B
# Section 1 Problem A 2 Problem B 3 Conclusion
# Section 4 Intro 2 Problem B 1 Problem A
17/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Conflicts
Move operation to move arbitrary nodes.
Documents can disagree.
# Section 1 Problem A 2 Problem B
# Section 1 Problem A 2 Problem B 3 Conclusion
# Section 4 Intro 2 Problem B 1 Problem A
17/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Conflicts
Move operation to move arbitrary nodes.
Documents can disagree.
# Section 1 Problem A 2 Problem B
# Section 1 Problem A 2 Problem B 3 Conclusion
# Section 4 Intro 2 Problem B 1 Problem A
17/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Conflicts
Move operation to move arbitrary nodes.
Documents can disagree.
# Section 1 Problem A 2 Problem B
# Section 1 Problem A 2 Problem B 3 Conclusion
# Section 4 Intro 2 Problem B 1 Problem A
17/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Merge
Order isarbitrary if documents disagree.
However, try to maintain order withindocuments.
# Section 1 Problem A 2 Problem B 3 Conclusion
# Section 4 Intro 2 Problem B 1 Problem A
# Section 4 Intro 1 Problem A 2 Problem B 3 Conclusion
⇒ Only onething to decide here.
18/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Merge
Order isarbitrary if documents disagree.
However, try to maintain order withindocuments.
# Section 1 Problem A 2 Problem B 3 Conclusion
# Section 4 Intro 2 Problem B 1 Problem A
# Section 4 Intro 1 Problem A 2 Problem B 3 Conclusion
⇒ Only onething to decide here.
18/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Merge
Order isarbitrary if documents disagree.
However, try to maintain order withindocuments.
# Section 1 Problem A 2 Problem B 3 Conclusion
# Section 4 Intro 2 Problem B 1 Problem A
# Section 4 Intro 1 Problem A 2 Problem B 3 Conclusion
⇒ Only onething to decide here.
18/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Merge
Order isarbitrary if documents disagree.
However, try to maintain order withindocuments.
# Section 1 Problem A 2 Problem B 3 Conclusion
# Section 4 Intro 2 Problem B 1 Problem A
# Section 4 Intro 1 Problem A 2 Problem B 3 Conclusion
⇒ Only onething to decide here.
18/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Merge
Order isarbitrary if documents disagree.
However, try to maintain order withindocuments.
# Section 1 Problem A 2 Problem B 3 Conclusion
# Section 4 Intro 2 Problem B 1 Problem A
# Section 4 Intro 1 Problem A 2 Problem B 3 Conclusion
⇒ Only onething to decide here.
18/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Weird cases
Sometimes weird!
# Section 1 Problem A 3 Transition A-B 2 Problem B
# Section 2 Problem B 4 Transition B-A 1 Problem A
# Section 2 Problem B 4 Transition B-A 1 Problem A 3 Transition A-B
⇒ Satisfy a maximal subsetof the original constraints.
⇒ It is still in NPto decide if something is a possible world.
⇒ It is NP-hard even for 2 documents (from Unary 3-partition).
⇒ Thanks: http://cstheory.stackexchange.com/a/19415/
19/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Weird cases
Sometimes weird!
# Section 1 Problem A 3 Transition A-B 2 Problem B
# Section 2 Problem B 4 Transition B-A 1 Problem A
# Section 2 Problem B 4 Transition B-A 1 Problem A 3 Transition A-B
⇒ Satisfy a maximal subsetof the original constraints.
⇒ It is still in NPto decide if something is a possible world.
⇒ It is NP-hard even for 2 documents (from Unary 3-partition).
⇒ Thanks: http://cstheory.stackexchange.com/a/19415/
19/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Weird cases
Sometimes weird!
# Section 1 Problem A 3 Transition A-B 2 Problem B
# Section 2 Problem B 4 Transition B-A 1 Problem A
# Section 2 Problem B 4 Transition B-A 1 Problem A 3 Transition A-B
⇒ Satisfy a maximal subsetof the original constraints.
⇒ It is still in NPto decide if something is a possible world.
⇒ It is NP-hard even for 2 documents (from Unary 3-partition).
⇒ Thanks: http://cstheory.stackexchange.com/a/19415/
19/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Weird cases
Sometimes weird!
# Section 1 Problem A 3 Transition A-B 2 Problem B
# Section 2 Problem B 4 Transition B-A 1 Problem A
# Section 2 Problem B 4 Transition B-A 1 Problem A 3 Transition A-B
⇒ Satisfy a maximal subsetof the original constraints.
⇒ It is still in NPto decide if something is a possible world.
⇒ It is NP-hard even for 2 documents (from Unary 3-partition).
⇒ Thanks: http://cstheory.stackexchange.com/a/19415/
19/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Weird cases
Sometimes weird!
# Section 1 Problem A 3 Transition A-B 2 Problem B
# Section 2 Problem B 4 Transition B-A 1 Problem A
# Section 2 Problem B 4 Transition B-A 1 Problem A 3 Transition A-B
⇒ Satisfy a maximal subsetof the original constraints.
⇒ It is still in NPto decide if something is a possible world.
⇒ It is NP-hard even for 2 documents (from Unary 3-partition).
⇒ Thanks: http://cstheory.stackexchange.com/a/19415/
19/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Weird cases
Sometimes weird!
# Section 1 Problem A 3 Transition A-B 2 Problem B
# Section 2 Problem B 4 Transition B-A 1 Problem A
# Section 2 Problem B 4 Transition B-A 1 Problem A 3 Transition A-B
⇒ Satisfy a maximal subsetof the original constraints.
⇒ It is still in NPto decide if something is a possible world.
⇒ It is NP-hard even for 2 documents (from Unary 3-partition).
⇒ Thanks: http://cstheory.stackexchange.com/a/19415/
19/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Table of contents
1... Introduction
2... Merge model
3... Merge without IDs
4... Merge with move
5... Conclusion
20/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Nested hierarchies
Necessary for XML.
Hardness results still holds.
Dynamic algorithm can be extended:
When solving the problem for twoforests:
Solve foreach pairof children.
Use the dynamic algorithm to solve the childsequence.
When solving the problem for twotrees:
Check equality of theroot labels.
Solve theforestsof children.
21/27
. . . . . Introduction
. . . Merge model
. . . .
Merge without IDs
. . .
Merge with move
. . Conclusion
Relational algebra
Add orderto relational databases.
Allow arbitraryrelational operations.
Trackprovenance of the data.
Use provenance for order uncertainty.
Connected with provenance foraggregates.
22/27
. . . .
Supplementary material
Thanks!
Thanks for your attention!
(Work in progress, questions and feedback welcome.)
23/27
. . . .
Supplementary material
Hardness of multiple documents
Reduction fromMinSAT:
Input. n clauses ±xi∨ ±xj,kvariables, integerd Output. can we avoid satisfying >d clauses?
IDs:
e+i for+xi,e−i for−xi
cifor clausei Labels:
Clause, for clauses, Vari for variablei Document setD:
e±i cj if±xioccurs incj
Possible world W:
Vari from 1 tok Clausen−dtimes Vari from 1 tok Clausedtimes
24/27
. . . .
Supplementary material
Hardness of multiple documents (example)
MinSAT instance:
C1:x∨y C2:¬x∨ ¬y d= 0
Encoding (D, andW):
# Label e+x Varx c1 Clause
# Label e+y Vary c1 Clause
# Label e−x Varx c2 Clause
# Label e−y Vary c2 Clause
Label Varx Vary Clause Clause Varx Vary
Thanks: http://cstheory.stackexchange.com/a/19081/
25/27
. . . .
Supplementary material
Hardness of multiple documents (example)
MinSAT instance:
C1:x∨y C2:¬x∨ ¬y d= 0
Encoding (D, andW):
# Label e+x Varx c1 Clause
# Label e+y Vary c1 Clause
# Label e−x Varx c2 Clause
# Label e−y Vary c2 Clause
Label Varx Vary Clause Clause Varx Vary
Thanks: http://cstheory.stackexchange.com/a/19081/
25/27
. . . .
Supplementary material
Hardness of multiple documents (example)
MinSAT instance:
C1:x∨y C2:¬x∨ ¬y d= 0
Encoding (D, andW):
# Label e+x Varx c1 Clause
# Label e+y Vary c1 Clause
# Label e−x Varx c2 Clause
# Label e−y Vary c2 Clause
Label Varx Vary Clause Clause Varx Vary
Thanks: http://cstheory.stackexchange.com/a/19081/
25/27
. . . .
Supplementary material
Hardness of multiple documents (example)
MinSAT instance:
C1:x∨y C2:¬x∨ ¬y d= 0
Encoding (D, andW):
# Label e+x Varx c1 Clause
# Label e+y Vary c1 Clause
# Label e−x Varx c2 Clause
# Label e−y Vary c2 Clause
Label Varx Vary Clause Clause Varx Vary
Thanks: http://cstheory.stackexchange.com/a/19081/
25/27
. . . .
Supplementary material
Hardness of multiple documents (example)
MinSAT instance:
C1:x∨y C2:¬x∨ ¬y d= 0
Encoding (D, andW):
# Label e+x Varx c1 Clause
# Label e+y Vary c1 Clause
# Label e−x Varx c2 Clause
# Label e−y Vary c2 Clause
Label Varx Vary Clause Clause Varx Vary
Thanks: http://cstheory.stackexchange.com/a/19081/
25/27
. . . .
Supplementary material
Hardness of multiple documents (example)
MinSAT instance:
C1:x∨y C2:¬x∨ ¬y d= 0
Encoding (D, andW):
# Label e+x Varx c1 Clause
# Label e+y Vary c1 Clause
# Label e−x Varx c2 Clause
# Label e−y Vary c2 Clause
Label Varx Vary Clause Clause Varx Vary Thanks: http://cstheory.stackexchange.com/a/19081/
25/27
. . . .
Supplementary material
Hardness
Merging two versions is already NP-complete.
Reduction fromUnary 3-partition:
Input. 3mintegersni in unary, and integerB.
Output. can we partition in triples with sumalwaysB?
Create two blocksper integerni:
Bothstartwith an element labeledOpen.
Bothcontainnielements labeledItem:
⇒ First block in one order.
⇒ Second block in reverse order.
Bothendwith an element labeledClose.
Document setD:
D1: concatenate all blocks in one order.
D2: concatenate all blocks in the reverse order.
Possible world W:
Open3,ItemB,Close3. Repeatmtimes.
26/27