Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
.
...... Complexity of Merging Ordered Documents
Antoine Amarilli1 M. Lamine Ba1Daniel Deutch2 Pierre Senellart1
1Télécom ParisTech, Paris, France2Tel 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: solving conflicts.
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 must merge 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 be resolved?
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 ofTree-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 order into account on child nodes.Important source of uncertainty!
....Root...
..New-1
....Root...
..New-2⇝
....Root.....
..New-2.
..
..New-1or
....Root.....
..New-1.
..
..New-2
5/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Representing the merge
The actual merge is chosen by the user.Computing all possible merges is unreasonable.Ideally, derive a strong representation system to represent thepossible merges, merges of merges, etc.Here: study the complexity of a decision problem:
Input. Set of documents D to merge.Possible world W of the merge.
Output. Is W really a possible merge of D?We restrict the study to an ordered list for now.(List of children for 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 B with items and unique IDs.Insert operation to insert a new node with a fresh ID.
# Section1 Introduction2 Problem3 Conclusion
# Section1 Introduction2 Problem4 Extension5 Related work3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension3 Conclusion
8/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Edition
Base version B with items and unique IDs.Insert operation to insert a new node with a fresh ID.
# Section1 Introduction2 Problem3 Conclusion
# Section1 Introduction2 Problem4 Extension5 Related work3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension3 Conclusion
8/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Edition
Base version B with items and unique IDs.Insert operation to insert a new node with a fresh ID.
# Section1 Introduction2 Problem3 Conclusion
# Section1 Introduction2 Problem4 Extension5 Related work3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension3 Conclusion
8/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Edition
Base version B with items and unique IDs.Insert operation to insert a new node with a fresh ID.
# Section1 Introduction2 Problem3 Conclusion
# Section1 Introduction2 Problem4 Extension5 Related work3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension3 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.
# Section1 Introduction2 Problem4 Extension5 Related work3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem4 Extension7 Extension5 Related work3 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.
# Section1 Introduction2 Problem4 Extension5 Related work3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem4 Extension7 Extension5 Related work3 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.
# Section1 Introduction2 Problem4 Extension5 Related work3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem4 Extension7 Extension5 Related work3 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.
# Section1 Introduction2 Problem4 Extension5 Related work3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem4 Extension7 Extension5 Related work3 Conclusion
9/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Possible worlds
Exponentially many merges(|D1|+|D2|
|D1|)
PTIME algorithm to check if a world is a possible merge.Given possible world W with IDs, do the following:
Verify the domain.For every pair x < y,
For every document D containing both x and y,Check if x < y in D.
# Section1 Introduction2 Problem4 Extension5 Related work3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension5 Related work4 Extension3 Conclusion
10/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Possible worlds
Exponentially many merges(|D1|+|D2|
|D1|)
PTIME algorithm to check if a world is a possible merge.Given possible world W with IDs, do the following:
Verify the domain.For every pair x < y,
For every document D containing both x and y,Check if x < y in D.
# Section1 Introduction2 Problem4 Extension5 Related work3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension5 Related work4 Extension3 Conclusion
10/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Possible worlds
Exponentially many merges(|D1|+|D2|
|D1|)
PTIME algorithm to check if a world is a possible merge.Given possible world W with IDs, do the following:
Verify the domain.For every pair x < y,
For every document D containing both x and y,Check if x < y in D.
# Section1 Introduction2 Problem4 Extension5 Related work3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension5 Related work4 Extension3 Conclusion
10/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Possible worlds
Exponentially many merges(|D1|+|D2|
|D1|)
PTIME algorithm to check if a world is a possible merge.Given possible world W with IDs, do the following:
Verify the domain.For every pair x < y,
For every document D containing both x and y,Check if x < y in D.
# Section1 Introduction2 Problem4 Extension5 Related work3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension5 Related work4 Extension3 Conclusion 10/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Possible worlds
Exponentially many merges(|D1|+|D2|
|D1|)
PTIME algorithm to check if a world is a possible merge.Given possible world W with IDs, do the following:
Verify the domain.For every pair x < y,
For every document D containing both x and y,Check if x < y in D.
# Section1 Introduction2 Problem4 Extension5 Related work3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension5 Related work4 Extension3 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 IDs in W (e.g., user input).Ambiguity about how to match elements!
# Section1 Introduction2 Problem4 Extension5 Related work3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension3 Conclusion
SectionIntroductionPreliminariesProblemExtensionRelated workExtensionConclusion
12/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Possible worlds, without IDs
We may not have the IDs in W (e.g., user input).Ambiguity about how to match elements!
# Section1 Introduction2 Problem4 Extension5 Related work3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension3 Conclusion
SectionIntroductionPreliminariesProblemExtensionRelated workExtensionConclusion
12/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Possible worlds, without IDs
We may not have the IDs in W (e.g., user input).Ambiguity about how to match elements!
# Section1 Introduction2 Problem4 Extension5 Related work3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension3 Conclusion
SectionIntroductionPreliminariesProblemExtensionRelated workExtensionConclusion
12/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Possible worlds, without IDs
We may not have the IDs in W (e.g., user input).Ambiguity about how to match elements!
# Section1 Introduction2 Problem4 Extension5 Related work3 Conclusion
# Section1 Introduction6 Preliminaries2 Problem7 Extension3 Conclusion
SectionIntroductionPreliminariesProblemExtensionRelated workExtensionConclusion
12/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Dynamic algorithm
Ambiguity makes it look like the problem is hardIn fact a dynamic algorithm solves it in O(n2).Show it on an example.
# Label1 A3 A4 B2 B
# Label1 A5 A2 B6 A
LabelAAABBA
13/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Dynamic algorithm
Ambiguity makes it look like the problem is hardIn fact a dynamic algorithm solves it in O(n2).Show it on an example.
# Label1 A3 A4 B2 B
# Label1 A5 A2 B6 A
LabelAAABBA
13/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Dynamic algorithm
Ambiguity makes it look like the problem is hardIn fact a dynamic algorithm solves it in O(n2).Show it on an example.
# Label1 A3 A4 B2 B
# Label1 A5 A2 B6 A
LabelAAABBA
13/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Dynamic algorithm
Ambiguity makes it look like the problem is hardIn fact a dynamic algorithm solves it in O(n2).Show it on an example.
# Label1 A3 A4 B2 B
# Label1 A5 A2 B6 A
LabelAAABBA
13/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Dynamic algorithm (example)
Set of documents D:A1 A3 B4 B2.A1 A5 B2 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 A3 B4 B2.A1 A5 B2 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 A3 B4 B2.A1 A5 B2 A6.
Possible world W: A A A B B A.A1 A3 B4 B2 ·
A1 AA5 A A BB2 A B BA6 A· ·
14/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Dynamic algorithm (example)
Set of documents D:A1 A3 B4 B2.A1 A5 B2 A6.
Possible world W: A A A B B A.A1 A3 B4 B2 ·
A1 AA5 A A BB2 A B BA6 A· · – ·
14/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Dynamic algorithm (example)
Set of documents D:A1 A3 B4 B2.A1 A5 B2 A6.
Possible world W: A A A B B A.A1 A3 B4 B2 ·
A1 AA5 A A BB2 A B BA6 A – ↓· · – ·
14/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Dynamic algorithm (example)
Set of documents D:A1 A3 B4 B2.A1 A5 B2 A6.
Possible world W: A A A B B A.A1 A3 B4 B2 ·
A1 AA5 A A BB2 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 A3 B4 B2.A1 A5 B2 A6.
Possible world W: A A A B B A.A1 A3 B4 B2 ·
A1 AA5 A A BB2 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 A3 B4 B2.A1 A5 B2 A6.
Possible world W: A A A B B A.A1 A3 B4 B2 ·
A1 AA5 A A BB2 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 A3 B4 B2.A1 A5 B2 A6.
Possible world W: A A A B B A.A1 A3 B4 B2 ·
A1 AA5 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 A3 B4 B2.A1 A5 B2 A6.
Possible world W: A A A B B A.A1 A3 B4 B2 ·
A1 AA5 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 A3 B4 B2.A1 A5 B2 A6.
Possible world W: A A A B B A.A1 A3 B4 B2 ·
A1 AA5 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 A3 B4 B2.A1 A5 B2 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 have multiple documents to merge (say k).Generalized dynamic algorithm is in O(nk).Hence, PTIME for fixed k.What if k is 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.
# Section1 Problem A2 Problem B
# Section1 Problem A2 Problem B3 Conclusion
# Section4 Intro2 Problem B1 Problem A
17/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Conflicts
Move operation to move arbitrary nodes.Documents can disagree.
# Section1 Problem A2 Problem B
# Section1 Problem A2 Problem B3 Conclusion
# Section4 Intro2 Problem B1 Problem A
17/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Conflicts
Move operation to move arbitrary nodes.Documents can disagree.
# Section1 Problem A2 Problem B
# Section1 Problem A2 Problem B3 Conclusion
# Section4 Intro2 Problem B1 Problem A
17/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Conflicts
Move operation to move arbitrary nodes.Documents can disagree.
# Section1 Problem A2 Problem B
# Section1 Problem A2 Problem B3 Conclusion
# Section4 Intro2 Problem B1 Problem A
17/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Merge
Order is arbitrary if documents disagree.However, try to maintain order within documents.
# Section1 Problem A2 Problem B3 Conclusion
# Section4 Intro2 Problem B1 Problem A
# Section4 Intro1 Problem A2 Problem B3 Conclusion
⇒ Only one thing to decide here.
18/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Merge
Order is arbitrary if documents disagree.However, try to maintain order within documents.
# Section1 Problem A2 Problem B3 Conclusion
# Section4 Intro2 Problem B1 Problem A
# Section4 Intro1 Problem A2 Problem B3 Conclusion
⇒ Only one thing to decide here.
18/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Merge
Order is arbitrary if documents disagree.However, try to maintain order within documents.
# Section1 Problem A2 Problem B3 Conclusion
# Section4 Intro2 Problem B1 Problem A
# Section4 Intro1 Problem A2 Problem B3 Conclusion
⇒ Only one thing to decide here.
18/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Merge
Order is arbitrary if documents disagree.However, try to maintain order within documents.
# Section1 Problem A2 Problem B3 Conclusion
# Section4 Intro2 Problem B1 Problem A
# Section4 Intro1 Problem A2 Problem B3 Conclusion
⇒ Only one thing to decide here.
18/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Merge
Order is arbitrary if documents disagree.However, try to maintain order within documents.
# Section1 Problem A2 Problem B3 Conclusion
# Section4 Intro2 Problem B1 Problem A
# Section4 Intro1 Problem A2 Problem B3 Conclusion
⇒ Only one thing to decide here.
18/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Weird cases
Sometimes weird!
# Section1 Problem A3 Transition A-B2 Problem B
# Section2 Problem B4 Transition B-A1 Problem A
# Section2 Problem B4 Transition B-A1 Problem A3 Transition A-B
⇒ Satisfy a maximal subset of the original constraints.⇒ It is still in NP to 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!
# Section1 Problem A3 Transition A-B2 Problem B
# Section2 Problem B4 Transition B-A1 Problem A
# Section2 Problem B4 Transition B-A1 Problem A3 Transition A-B
⇒ Satisfy a maximal subset of the original constraints.⇒ It is still in NP to 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!
# Section1 Problem A3 Transition A-B2 Problem B
# Section2 Problem B4 Transition B-A1 Problem A
# Section2 Problem B4 Transition B-A1 Problem A3 Transition A-B
⇒ Satisfy a maximal subset of the original constraints.⇒ It is still in NP to 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!
# Section1 Problem A3 Transition A-B2 Problem B
# Section2 Problem B4 Transition B-A1 Problem A
# Section2 Problem B4 Transition B-A1 Problem A3 Transition A-B
⇒ Satisfy a maximal subset of the original constraints.⇒ It is still in NP to 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!
# Section1 Problem A3 Transition A-B2 Problem B
# Section2 Problem B4 Transition B-A1 Problem A
# Section2 Problem B4 Transition B-A1 Problem A3 Transition A-B
⇒ Satisfy a maximal subset of the original constraints.
⇒ It is still in NP to 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!
# Section1 Problem A3 Transition A-B2 Problem B
# Section2 Problem B4 Transition B-A1 Problem A
# Section2 Problem B4 Transition B-A1 Problem A3 Transition A-B
⇒ Satisfy a maximal subset of the original constraints.⇒ It is still in NP to 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 two forests:Solve for each pair of children.Use the dynamic algorithm to solve the child sequence.
When solving the problem for two trees:Check equality of the root labels.Solve the forests of children.
21/27
. . . . .Introduction
. . .Merge model
. . . .Merge without IDs
. . .Merge with move
. .Conclusion
Relational algebra
Add order to relational databases.Allow arbitrary relational operations.Track provenance of the data.Use provenance for order uncertainty.Connected with provenance for aggregates.
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 from MinSAT:Input. n clauses ±xi ∨ ±xj, k variables, integer d
Output. can we avoid satisfying > d clauses?IDs:
e+i for +xi, e−i for −xici for clause i
Labels:Clause, for clauses,Vari for variable i
Document set D:e±i cj if ±xi occurs in cj
Possible world W:Vari from 1 to kClause n − d timesVari from 1 to kClause d times
24/27
. . . .Supplementary material
Hardness of multiple documents (example)
MinSAT instance:C1 : x ∨ yC2 : ¬x ∨ ¬yd = 0
Encoding (D, and W):
# Labele+x Varxc1 Clause
# Labele+y Varyc1 Clause
# Labele−x Varxc2 Clause
# Labele−y Varyc2 Clause
LabelVarxVaryClauseClauseVarxVary
Thanks: http://cstheory.stackexchange.com/a/19081/
25/27
. . . .Supplementary material
Hardness of multiple documents (example)
MinSAT instance:C1 : x ∨ yC2 : ¬x ∨ ¬yd = 0
Encoding (D, and W):
# Labele+x Varxc1 Clause
# Labele+y Varyc1 Clause
# Labele−x Varxc2 Clause
# Labele−y Varyc2 Clause
LabelVarxVaryClauseClauseVarxVary
Thanks: http://cstheory.stackexchange.com/a/19081/
25/27
. . . .Supplementary material
Hardness of multiple documents (example)
MinSAT instance:C1 : x ∨ yC2 : ¬x ∨ ¬yd = 0
Encoding (D, and W):
# Labele+x Varxc1 Clause
# Labele+y Varyc1 Clause
# Labele−x Varxc2 Clause
# Labele−y Varyc2 Clause
LabelVarxVaryClauseClauseVarxVary
Thanks: http://cstheory.stackexchange.com/a/19081/
25/27
. . . .Supplementary material
Hardness of multiple documents (example)
MinSAT instance:C1 : x ∨ yC2 : ¬x ∨ ¬yd = 0
Encoding (D, and W):
# Labele+x Varxc1 Clause
# Labele+y Varyc1 Clause
# Labele−x Varxc2 Clause
# Labele−y Varyc2 Clause
LabelVarxVaryClauseClauseVarxVary
Thanks: http://cstheory.stackexchange.com/a/19081/
25/27
. . . .Supplementary material
Hardness of multiple documents (example)
MinSAT instance:C1 : x ∨ yC2 : ¬x ∨ ¬yd = 0
Encoding (D, and W):
# Labele+x Varxc1 Clause
# Labele+y Varyc1 Clause
# Labele−x Varxc2 Clause
# Labele−y Varyc2 Clause
LabelVarxVaryClauseClauseVarxVary
Thanks: http://cstheory.stackexchange.com/a/19081/
25/27
. . . .Supplementary material
Hardness of multiple documents (example)
MinSAT instance:C1 : x ∨ yC2 : ¬x ∨ ¬yd = 0
Encoding (D, and W):
# Labele+x Varxc1 Clause
# Labele+y Varyc1 Clause
# Labele−x Varxc2 Clause
# Labele−y Varyc2 Clause
LabelVarxVaryClauseClauseVarxVary
Thanks: http://cstheory.stackexchange.com/a/19081/25/27
. . . .Supplementary material
Hardness
Merging two versions is already NP-complete.Reduction from Unary 3-partition:
Input. 3m integers ni in unary, and integer B.Output. can we partition in triples with sum always B?
Create two blocks per integer ni:Both start with an element labeled Open.Both contain ni elements labeled Item:⇒ First block in one order.⇒ Second block in reverse order.
Both end with an element labeled Close.Document set D:
D1: concatenate all blocks in one order.D2: concatenate all blocks in the reverse order.
Possible world W:Open3, ItemB, Close3.Repeat m times.
26/27
. . . .Supplementary material
Hardness (intuition and example)
Induced order constraints:All Item elements are incomparable.Open and Close precede and follow all of their Item’s.Open, Item, Close blocks are incomparable among them.
3-partition instance: {1, 1, 1, 2, 3, 4}, B = 6.Open, Item, CloseOpen, Item, CloseOpen, Item, CloseOpen, Item2, CloseOpen, Item3, CloseOpen, Item4, Close
⇒ Open3, Item6, Close3, Open3, Item6, Close3.
Thanks: http://cstheory.stackexchange.com/a/19415/
27/27
. . . .Supplementary material
Hardness (intuition and example)
Induced order constraints:All Item elements are incomparable.Open and Close precede and follow all of their Item’s.Open, Item, Close blocks are incomparable among them.
3-partition instance: {1, 1, 1, 2, 3, 4}, B = 6.Open, Item, CloseOpen, Item, CloseOpen, Item, CloseOpen, Item2, CloseOpen, Item3, CloseOpen, Item4, Close
⇒ Open3, Item6, Close3, Open3, Item6, Close3.
Thanks: http://cstheory.stackexchange.com/a/19415/
27/27
. . . .Supplementary material
Hardness (intuition and example)
Induced order constraints:All Item elements are incomparable.Open and Close precede and follow all of their Item’s.Open, Item, Close blocks are incomparable among them.
3-partition instance: {1, 1, 1, 2, 3, 4}, B = 6.Open, Item, CloseOpen, Item, CloseOpen, Item, CloseOpen, Item2, CloseOpen, Item3, CloseOpen, Item4, Close
⇒ Open3, Item6, Close3, Open3, Item6, Close3.
Thanks: http://cstheory.stackexchange.com/a/19415/
27/27
. . . .Supplementary material
Hardness (intuition and example)
Induced order constraints:All Item elements are incomparable.Open and Close precede and follow all of their Item’s.Open, Item, Close blocks are incomparable among them.
3-partition instance: {1, 1, 1, 2, 3, 4}, B = 6.Open, Item, CloseOpen, Item, CloseOpen, Item, CloseOpen, Item2, CloseOpen, Item3, CloseOpen, Item4, Close
⇒ Open3, Item6, Close3, Open3, Item6, Close3.
Thanks: http://cstheory.stackexchange.com/a/19415/
27/27
. . . .Supplementary material
Hardness (intuition and example)
Induced order constraints:All Item elements are incomparable.Open and Close precede and follow all of their Item’s.Open, Item, Close blocks are incomparable among them.
3-partition instance: {1, 1, 1, 2, 3, 4}, B = 6.Open, Item, CloseOpen, Item, CloseOpen, Item, CloseOpen, Item2, CloseOpen, Item3, CloseOpen, Item4, Close
⇒ Open3, Item6, Close3, Open3, Item6, Close3.
Thanks: http://cstheory.stackexchange.com/a/19415/
27/27
. . . .Supplementary material
Hardness (intuition and example)
Induced order constraints:All Item elements are incomparable.Open and Close precede and follow all of their Item’s.Open, Item, Close blocks are incomparable among them.
3-partition instance: {1, 1, 1, 2, 3, 4}, B = 6.Open, Item, CloseOpen, Item, CloseOpen, Item, CloseOpen, Item2, CloseOpen, Item3, CloseOpen, Item4, Close
⇒ Open3, Item6, Close3, Open3, Item6, Close3.
Thanks: http://cstheory.stackexchange.com/a/19415/
27/27
. . . .Supplementary material
Hardness (intuition and example)
Induced order constraints:All Item elements are incomparable.Open and Close precede and follow all of their Item’s.Open, Item, Close blocks are incomparable among them.
3-partition instance: {1, 1, 1, 2, 3, 4}, B = 6.Open, Item, CloseOpen, Item, CloseOpen, Item, CloseOpen, Item2, CloseOpen, Item3, CloseOpen, Item4, Close
⇒ Open3, Item6, Close3, Open3, Item6, Close3.
Thanks: http://cstheory.stackexchange.com/a/19415/
27/27
. . . .Supplementary material
Hardness (intuition and example)
Induced order constraints:All Item elements are incomparable.Open and Close precede and follow all of their Item’s.Open, Item, Close blocks are incomparable among them.
3-partition instance: {1, 1, 1, 2, 3, 4}, B = 6.Open, Item, CloseOpen, Item, CloseOpen, Item, CloseOpen, Item2, CloseOpen, Item3, CloseOpen, Item4, Close
⇒ Open3, Item6, Close3, Open3, Item6, Close3.
Thanks: http://cstheory.stackexchange.com/a/19415/
27/27