How to Attack the NP-Complete Dag Realization
Problem in Practice
Annabell Berger and Matthias Müller-Hannemann
Institut für Informatik
Martin-Luther-Universität Halle-Wittenberg
http://www.informatik.uni-halle.de
June 7, 2012
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
1
Introduction
The Dag Realization Problem
Problem (dag realization problem)
Given is a finite sequence S := ba11 , . . . , bann with ai , bi ∈ Z+
0.
Does there exist a dag (acyclic digraph without parallel arcs)
G = (V , A) with the labeled vertex set V := {v1 , . . . , vn } such
that we have indegree dG− (vi ) = ai and outdegree dG+ (vi ) = bi for
all vi ∈ V ?
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
2
Introduction
The Dag Realization Problem
Problem (dag realization problem)
Given is a finite sequence S := ba11 , . . . , bann with ai , bi ∈ Z+
0.
Does there exist a dag (acyclic digraph without parallel arcs)
G = (V , A) with the labeled vertex set V := {v1 , . . . , vn } such
that we have indegree dG− (vi ) = ai and outdegree dG+ (vi ) = bi for
all vi ∈ V ?
In case the answer is “yes” we call
sequence S dag sequence
dag G a dag realization
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
2
Introduction
The Dag Realization Problem – an Example
Given
0is a1sequence
2
0
2
,
,
,
2
1
3
2 , 1 ,
2
0
,
2
0
.
Find an acyclic digraph with corresponding vertex degrees.
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
3
Introduction
Terminology
Classification of tuples
ai
bi
source tuple: ai = 0 and bi > 0
sink tuple: ai > 0 and bi = 0
stream tuple: ai > 0 and bi > 0
Assumptions:
no zero tuples 00
Pn
Pn
i=1 ai =
i=1 bi (necessary for realization)
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
4
Introduction
Digraph Realization is Easy
Problem (digraph realization problem)
Given is a finite sequence S := ba11 , . . . , bann with ai , bi ∈ Z+
0.
Does there exist a digraph (without parallel arcs) G = (V , A) with
the labeled vertex set V := {v1 , . . . , vn } such that we have
indegree dG− (vi ) = ai and outdegree dG+ (vi ) = bi for all vi ∈ V ?
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
5
Introduction
Digraph Realization is Easy
Problem (digraph realization problem)
Given is a finite sequence S := ba11 , . . . , bann with ai , bi ∈ Z+
0.
Does there exist a digraph (without parallel arcs) G = (V , A) with
the labeled vertex set V := {v1 , . . . , vn } such that we have
indegree dG− (vi ) = ai and outdegree dG+ (vi ) = bi for all vi ∈ V ?
Two different approaches with polynomial running time:
1
recursive algorithms
(KLEITMAN, WANG 1973) — choose an
arbitrary tuple baii and reduce from bi lexicographical largest
tuples the aj by “one”
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
5
Introduction
Digraph Realization is Easy
Problem (digraph realization problem)
Given is a finite sequence S := ba11 , . . . , bann with ai , bi ∈ Z+
0.
Does there exist a digraph (without parallel arcs) G = (V , A) with
the labeled vertex set V := {v1 , . . . , vn } such that we have
indegree dG− (vi ) = ai and outdegree dG+ (vi ) = bi for all vi ∈ V ?
Two different approaches with polynomial running time:
1
2
recursive algorithms
(KLEITMAN, WANG 1973) — choose an
arbitrary tuple baii and reduce from bi lexicographical largest
tuples the aj by “one”
complete characterization of digraph sequences (GALE 1957,
RYSER 1957, FULKERSON 1960, CHEN 1966) — check a
polynomial number of inequalities (in the size n)
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
5
Introduction
Complexity of Dag Realization
Theorem (Nichterlein 2011)
The dag realization problem is (strongly) NP-complete.
Proof: by reduction from 3-PARTITION
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
6
Introduction
Complexity of Dag Realization
Theorem (Nichterlein 2011)
The dag realization problem is (strongly) NP-complete.
Proof: by reduction from 3-PARTITION
Theorem (Hartung and Nichterlein 2012)
The dag realization problem is fixed parameter tractable with
respect to the parameter maximum degree ∆.
Note: This is a mere classification result. The running time of
their FPT algorithm is ∆∆
c
2012
Berger and Müller-Hannemann
∆O(∆)
· n!
MLU Halle-Wittenberg
Dag Realization
6
Introduction
Realization with a Fixed Topological Order
Realization with a prescribed
topological
order
a1
an
Input: sequence S := b1 , . . . , bn
topological order v1 < v2 , < · · · < vn
Task: Find a dag realization according to the given top. order
Greedy works (linear-time algorithm):
connect first non-source vertex vi with vertex degree baii with
the ai largest sources
reduce baii to b0i , and the source out-degrees by one →
yields new sequence S 0
we proved:
if and only if these steps fail, the sequence is not realizable
This shows: Hardness lies in finding a feasible topological order
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
7
Introduction
Overview: Our Contribution
randomized
deterministic
polynomially solvable
special classes:
general realization
algorithm
opposed sequences
recursive approach,
exponential time
(a feasible top. order
can be determined
efficiently)
four different approaches
topological order
is chosen randomly
special strategy:
lex−max strategy
(linear−time heuristic)
we made experiments for all these variants
experiments show: it is hard to find sequences which we
cannot solve in polynomial time
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
8
Opposed Sequences
Opposed Relation
Definition (opposed relation)
Given are c1 := ba11 ∈ Z2 and c2 :=
c1 ≤opp c2 ⇔ (a1 ≤ a2 ∧ b1 ≥ b2 ).
c
2012
Berger and Müller-Hannemann
a2
b2
MLU Halle-Wittenberg
∈ Z2 . We define:
Dag Realization
9
Opposed Sequences
Opposed Relation
Definition (opposed relation)
Given are c1 := ba11 ∈ Z2 and c2 :=
c1 ≤opp c2 ⇔ (a1 ≤ a2 ∧ b1 ≥ b2 ).
a2
b2
∈ Z2 . We define:
Opposed relation defines a partial order
1
reflexive, transitive and antisymmetric relation
2
it is not possible to compare all tuples c1 and c2 .
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
9
Opposed Sequences
Opposed Relation
Definition (opposed relation)
Given are c1 := ba11 ∈ Z2 and c2 :=
c1 ≤opp c2 ⇔ (a1 ≤ a2 ∧ b1 ≥ b2 ).
a2
b2
∈ Z2 . We define:
Opposed relation defines a partial order
1
reflexive, transitive and antisymmetric relation
2
it is not possible to compare all tuples c1 and c2 .
Example:
2
3
<opp
c
2012
Berger and Müller-Hannemann
3
1
but
2
2
,
3
3
are not comparable
MLU Halle-Wittenberg
Dag Realization
9
Opposed Sequences
Opposed Sequences
Definition (opposed sequence)
We denote a sequence as opposed sequence, when it is possible to
number all tuples (except
for “sinks”
and “sources”) in a chain
such that we have baii ≤opp bai+1
.
i+1
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
10
Opposed Sequences
Opposed Sequences
Definition (opposed sequence)
We denote a sequence as opposed sequence, when it is possible to
number all tuples (except
for “sinks”
and “sources”) in a chain
such that we have baii ≤opp bai+1
.
i+1
0
0
Example:
,
,
2
1
| {z }
“sources”
1
3
≤opp
2
2
≤opp
2
1
2
2
,
,
0
0
| {z }
“sinks 00
Note: It is possible to sort all tuples (except for “sinks” and
“sources”) so that we have ai ≤ ai+1 and bi ≥ bi+1 for all
indices i.
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
10
Opposed Sequences
Realization of Opposed Sequences
We order an opposed sequence S containing at least one tuple (non-sink,
non-source) such that:
1
at the beginning all source tuples build a decreasing sequence with
respect to their bi ,
2
at the end all sink tuples build an increasing sequence with respect
to their ai ,
3
number all remaining tuples (non-sinks
andnon-sources) in a chain
aimin
such that we have baii ≤opp bai+1
,
let
be the first of them
bi
i+1
min
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
11
Opposed Sequences
Realization of Opposed Sequences
We order an opposed sequence S containing at least one tuple (non-sink,
non-source) such that:
1
at the beginning all source tuples build a decreasing sequence with
respect to their bi ,
2
at the end all sink tuples build an increasing sequence with respect
to their ai ,
3
number all remaining tuples (non-sinks
andnon-sources) in a chain
aimin
such that we have baii ≤opp bai+1
,
let
be the first of them
bi
i+1
min
Theorem (opposed sequences, FCT 2011)
An opposed sequence S is a dag sequence if and only if there exist at
least aimin source
tuples inS and if
S 0 := b10−1 , . . . , ba 0 −1 , ba 0 +1 , . . . , bi 0 −1 , bi0 , baiimin +1
, . . . , bann
+1
imin
imin
min
min
min
is a dag sequence.
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
11
Opposed Sequences
An Algorithmic Example
step 0
0
2
,
c
2012
Berger and Müller-Hannemann
0
1
,
2
3
,
2
2
MLU Halle-Wittenberg
,
2
1
,
1
0
,
2
0
Dag Realization
12
Opposed Sequences
An Algorithmic Example
step 0
step 1
0
2 ,
0
2−1 ,
c
2012
Berger and Müller-Hannemann
0
1 ,
0
1−1 ,
2
3 ,
2−2
3 ,
2
2,
2
2 ,
MLU Halle-Wittenberg
2
1,
2
1 ,
1
0,
1
0 ,
2
0
2
0
Dag Realization
12
Opposed Sequences
An Algorithmic Example
step 0
step 1
step 2
0
2 ,
0
,
2−1
0
1 ,
c
2012
Berger and Müller-Hannemann
0
1 ,
0
1−1 ,
X
2
3 ,
2−2
3 ,
0
3 ,
2
2,
2
2,
2
2 ,
MLU Halle-Wittenberg
2
1,
2
1,
2
1 ,
1
0,
1
0,
1
0 ,
2
0
2
0
2
0
Dag Realization
12
Opposed Sequences
An Algorithmic Example
step
step
step
step
0
1
2
3
0
2 ,
0
,
2−1
0
1 ,
0
1−1 ,
c
2012
Berger and Müller-Hannemann
0
1 ,
0
1−1 ,
X
X
2
3 ,
2−2
3 ,
0
3 ,
0
3−1 ,
2
2,
2
2,
2
2 ,
2−2
2 ,
MLU Halle-Wittenberg
2
1,
2
1,
2
1,
2
1 ,
1
0,
1
0,
1
0,
1
0 ,
2
0
2
0
2
0
2
0
Dag Realization
12
Opposed Sequences
An Algorithmic Example
step
step
step
step
step
0
1
2
3
4
0
2 ,
0
,
2−1
0
1 ,
0
1−1 ,
X
c
2012
Berger and Müller-Hannemann
0
1 ,
0
1−1 ,
X
X
X
2
3 ,
2−2
3 ,
0
3 ,
0
,
3−1
0
2 ,
2
2,
2
2,
2
2 ,
2−2
2 ,
0
2 ,
MLU Halle-Wittenberg
2
1,
2
1,
2
1,
2
1,
2
1 ,
1
0,
1
0,
1
0,
1
0,
1
0 ,
2
0
2
0
2
0
2
0
2
0
Dag Realization
12
Opposed Sequences
An Algorithmic Example
step
step
step
step
step
step
0
1
2
3
4
5
0
2 ,
0
,
2−1
0
1 ,
0
1−1 ,
X
X
c
2012
Berger and Müller-Hannemann
0
1 ,
0
1−1 ,
X
X
X
X
2
3 ,
2−2
3 ,
0
3 ,
0
,
3−1
0
2 ,
0
2−1 ,
2
2,
2
2,
2
2 ,
2−2
2 ,
0
2 ,
0
2−1 ,
MLU Halle-Wittenberg
2
1,
2
1,
2
1,
2
1,
2
1 ,
2−2
1 ,
1
0,
1
0,
1
0,
1
0,
1
0,
1
0 ,
2
0
2
0
2
0
2
0
2
0
2
0
Dag Realization
12
Opposed Sequences
An Algorithmic Example
0
0
2
2
2
1
step 0
2 ,
1 ,
3 ,
2,
1,
0,
0
0
2−2
2
2
1
step 1
,
2−1
1−1 ,
3 ,
2,
1,
0,
0
0
2
2
1
step 2
X
1 ,
3 ,
2 ,
1,
0,
0
0
2−2
2
1
step 3
X
,
1−1 ,
3−1
2 ,
1,
0,
0
0
2
1
step 4
X
X
2 ,
2 ,
1 ,
0,
0
0
2−2
1
step 5
X
X
,
,
2−1
2−1
1 ,
0,
0
0
0
1
step 6
X
X
,
,
,
1
1
1
0 ,
– source-sink-sequence!
We apply an algorithm for digraphs (Kleitman, Wang 1973):
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
2
0
2
0
2
0
2
0
2
0
2
0
2
0
Dag Realization
12
Opposed Sequences
An Algorithmic Example
0
0
2
2
2
1
step 0
2 ,
1 ,
3 ,
2,
1,
0,
0
0
2−2
2
2
1
step 1
,
2−1
1−1 ,
3 ,
2,
1,
0,
0
0
2
2
1
step 2
X
1 ,
3 ,
2 ,
1,
0,
0
0
2−2
2
1
step 3
X
,
1−1 ,
3−1
2 ,
1,
0,
0
0
2
1
step 4
X
X
2 ,
2 ,
1 ,
0,
0
0
2−2
1
step 5
X
X
,
,
2−1
2−1
1 ,
0,
0
0
0
1
step 6
X
X
,
,
,
1
1
1
0 ,
– source-sink-sequence!
We apply an algorithm for digraphs (Kleitman, Wang 1973):
0
0
1
step 7
X
X
X
1 ,
1 ,
0 ,
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
2
0
2
0
2
0
2
0
2
0
2
0
2
0
1
0
Dag Realization
12
Opposed Sequences
An Algorithmic Example
0
0
2
2
2
1
step 0
2 ,
1 ,
3 ,
2,
1,
0,
0
0
2−2
2
2
1
step 1
,
2−1
1−1 ,
3 ,
2,
1,
0,
0
0
2
2
1
step 2
X
1 ,
3 ,
2 ,
1,
0,
0
0
2−2
2
1
step 3
X
,
1−1 ,
3−1
2 ,
1,
0,
0
0
2
1
step 4
X
X
2 ,
2 ,
1 ,
0,
0
0
2−2
1
step 5
X
X
,
,
2−1
2−1
1 ,
0,
0
0
0
1
step 6
X
X
,
,
,
1
1
1
0 ,
– source-sink-sequence!
We apply an algorithm for digraphs (Kleitman, Wang 1973):
0
0
1
step 7
X
X
X
1 ,
1,
0 ,
0
step 8
X
X
X
X
X
1 ,
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
2
0
2
0
2
0
2
0
2
0
2
0
2
0
1
0
1
0
Dag Realization
12
Opposed Sequences
An Algorithmic Example
0
0
2
2
2
1
step 0
2 ,
1 ,
3 ,
2,
1,
0,
0
0
2−2
2
2
1
step 1
,
2−1
1−1 ,
3 ,
2,
1,
0,
0
0
2
2
1
step 2
X
1 ,
3 ,
2 ,
1,
0,
0
0
2−2
2
1
step 3
X
,
1−1 ,
3−1
2 ,
1,
0,
0
0
2
1
step 4
X
X
2 ,
2 ,
1 ,
0,
0
0
2−2
1
step 5
X
X
,
,
2−1
2−1
1 ,
0,
0
0
0
1
step 6
X
X
,
,
,
1
1
1
0 ,
– source-sink-sequence!
We apply an algorithm for digraphs (Kleitman, Wang 1973):
0
0
1
step 7
X
X
X
1 ,
1,
0 ,
0
step 8
X
X
X
X
X
1 ,
Note: This algorithm can be implemented to run in time
O(m + n) using a “bucket” technique.
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
2
0
2
0
2
0
2
0
2
0
2
0
2
0
1
0
1
0
Dag Realization
12
Our Realization Algorithm
General Realization Algorithm
We order a sequence S containing at least one stream tuple such that:
1
at the beginning all source tuples, say q many, build a decreasing
sequence with respect to their bi ,
2
at the end all sink tuples build an increasing sequence with respect
to their ai ,
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
13
Our Realization Algorithm
General Realization Algorithm
We order a sequence S containing at least one stream tuple such that:
1
at the beginning all source tuples, say q many, build a decreasing
sequence with respect to their bi ,
2
at the end all sink tuples build an increasing sequence with respect
to their ai ,
candidate set Vmin : all stream tuples which satisfy
1
ai ≤ q (indegree does not exceed # available sources) and
2
there does not exist a smaller stream tuple with respect to the opposed
relation <opp .
Theorem (FCT 2011)
S is a dag sequence if and only if Vmin 6= ∅ and there exists an element
ai
min
∈ Vmin such that S 0 :=
bi
min a
a
0
, . . . , ba 0 −1 , ba 0 +1 , . . . , b0q , baq+1
, . . . , bimin −1 , bi 0 , bimin +1 , . . . ,
b1 −1
q+1
imin
imin −1
imin
min
imin +1
an
bn
is a dag sequence.
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
13
Our Realization Algorithm
Example: Recursion Tree
S=
0 0 1 2 4 1 1 2 3
, 1 , 2 , 3 , 4 , 1 , 0 , 0 , 0
3
0
Vmin
={
1
2
S 00 =
2
3
S 000 = ×,
0
Vmin
={
={
0 0 0 4 0 1 2 3
, 1 , 3 , 4 , 1 , 0 , 0 , 0
1
4
4
S 0000 = ×, ×, ×,
1
1
,
2
3
}
0 0 0 2 4 0 1 2 3
, 1 , 2 , 3 , 4 , 1 , 0 , 0 , 0
1
0
Vmin
0
Vmin
={
4
4
2
3
S 000 =
2
3
,
}
2
3
S0 =
0
Vmin
={
0 0 0 0 4 0 1 2 3
, 1 , 1 , 2 , 4 , 1 , 0 , 0 , 0
1
S 0000 = ×, ×, ×,
0
Vmin
={
4
4
}
0 0 0 1 2 3
, 4 , 1 , 0 , 0 , 0
1
1
1
,
4
4
0 0 1 1 2 3
, 4 , 1 , 0 , 0 , 0
2
1
0
Vmin
={
1
S 0000 = ×, ×, ×,
0
2
}
1
1
×, ×, ×, ×, ×,
0
1
0
1
, ×,
MLU Halle-Wittenberg
1
0
, ×, ×,
realizable
={
,
}
1
2
1
1
}
1
1
0
, ×, 20 , 20 , 44 , 10 , 01 , 02 , 03
1
0
Vmin
={
0 0 0 1 2 3
, 3 , 1 , 0 , 0 , 0
2
, ×,
S 000 =
1
2
0
, ×, 02 , 02 , 44 , 11 , 10 , 20 , 30
2
0
Vmin
4
4
S 000 = ×, ×, ×,
not realizable
S 00 =
}
×, ×, ×,
c
2012
Berger and Müller-Hannemann
0
, ×, 12 , 03 , 44 , 11 , 10 , 20 , 30
2
0
Vmin
={
0 0 0 0 4 1 1 2 3
, 1 , 1 , 3 , 4 , 1 , 0 , 0 , 0
1
1
1
4
4
not realizable
2
3
S 00 =
}
}
0 0
, 4 , ×, 10 , 20 , 30
2
0 0 0 2 4 1 1 2 3
, 1 , 2 , 3 , 4 , 1 , 0 , 0 , 0
2
S0 =
1
1
1
2
S 0000 = ×, ×,
4
4
}
4
4
0 0 0
, 1 , 4 , ×, 10 , 20 , 30
1
not realizable
2
0
1
0
Dag Realization
14
Our Realization Algorithm
Lex Max Strategy
Observations:
1
bottleneck is the cardinality of Vmin
2
for opposed sequences we have a smallest tuple resulting in
|Vmin | = 1
“lex max strategy”:
choose always the lexicographical largest tuple in Vmin
Early conjecture:
Lex max strategy works
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
15
Our Realization Algorithm
Story of the Lex Max Strategy
And Why We Became Curious
Note: when we started our work, the complexity status of dag
realization was still open
Initial experiments:
1
we generated two million dag sequences randomly (for various
sequence sizes)
2
observed success in each case for the lex max strategy
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
16
Our Realization Algorithm
Story of the Lex Max Strategy
And Why We Became Curious
Note: when we started our work, the complexity status of dag
realization was still open
Initial experiments:
1
we generated two million dag sequences randomly (for various
sequence sizes)
2
observed success in each case for the lex max strategy
But: When we tried to prove “correctness” of the strategy, we
finally managed to construct counter-example(s)
Lesson:
randomly generated instances turn out to be easy instances
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
16
Experiments
Three Types of Test Instances
1
generation of “random sequences”
sample uniformly dags with n vertices and m arcs
take the corresponding dag sequence
Note: We sample uniformly dags, but not sequences.
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
17
Experiments
Three Types of Test Instances
1
generation of “random sequences”
sample uniformly dags with n vertices and m arcs
take the corresponding dag sequence
Note: We sample uniformly dags, but not sequences.
2
systematic generation of dag sequences
generate all non-isomorphic dag sequences with 7, 8, 9 tuples
Note: this is infeasible for n ≥ 10!
Ignore all “trivial sequences” (with ≤ 1 stream tuples)
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
17
Experiments
Three Types of Test Instances
1
generation of “random sequences”
sample uniformly dags with n vertices and m arcs
take the corresponding dag sequence
Note: We sample uniformly dags, but not sequences.
2
systematic generation of dag sequences
generate all non-isomorphic dag sequences with 7, 8, 9 tuples
Note: this is infeasible for n ≥ 10!
Ignore all “trivial sequences” (with ≤ 1 stream tuples)
3
degree sequences derived from real-world dags
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
17
Experiments
Experiments I
First questions:
1
How relevant are opposed sequences?
2
How large is the fraction of dag sequences which are realizable
by using the lex max strategy?
3
How difficult are degree sequences derived from real-world
dags?
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
18
Experiments
Acyclic Real World Networks
We considered:
1
OBDDs (ordered binary decision
diagrams)
2
public train transport schedule
(20000 tuples)
3
flight schedules (37800 tuples)
4
several food webs (40 to 150
tuples)
Our observations: All instances are realizable by the lex max
strategy.
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
19
Experiments
Opposed Sequences
Which fraction of sequences are opposed sequences?
Fraction of opposed sequences
n=9
Observations
2
sequences with a middle
density have the smallest
fraction of opposed
sequences
opposed sequences are a
relevant class of sequences
1
fraction of opposed sequences
1
1,2
0,8
0,6
0,4
0,2
0
0
5
10
15
20
25
30
35
40
number m of arcs
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
20
Experiments
Opposed Sequences
Which fraction of sequences are opposed sequences?
Fraction of opposed sequences
n=9
Observations
2
sequences with a middle
density have the smallest
fraction of opposed
sequences
opposed sequences are a
relevant class of sequences
1
fraction of opposed sequences
1
1,2
0,8
0,6
0,4
0,2
0
0
5
10
15
20
25
30
35
40
number m of arcs
Note: OBDDs (ordered binary decision diagrams) are dags with
opposed dag sequences.
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
20
Experiments
Lex Max Strategy
How often does the lex max strategy fail?
Observation
2
lex max strategy leads to a
dag realization for at least
97% of all dag sequences
with 9 tuples
a strong connection between
the density of a sequence
and the realizability
c
2012
Berger and Müller-Hannemann
Percentage p(m) of failure sequences
1
Percentage of failure sequences n=9
Lexmax Strategy
3,5
3
2,5
2
1,5
1
0,5
MLU Halle-Wittenberg
0
0
5
10
15
20
25
30
35
40
number m of arcs
Dag Realization
21
Experiments
Lex Max Strategy
How often does the lex max strategy fail?
Observation
2
lex max strategy leads to a
dag realization for at least
97% of all dag sequences
with 9 tuples
a strong connection between
the density of a sequence
and the realizability
Percentage p(m) of failure sequences
1
Percentage of failure sequences n=9
Lexmax Strategy
3,5
3
2,5
2
1,5
1
0,5
0
0
5
10
15
20
25
30
35
40
number m of arcs
But: This result does not explain our observation at the beginning
– “success for 2 million randomly chosen dag sequences” with
≥ 20 tuples.
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
21
Experiments
Distance to Opposed
opposed sequences are efficiently solvable
would like to have a measure:
how similar is a sequence to being an opposed sequence?
distance to opposed = # pairwise incomparable stream tuples
with respect to some specific order
(
d(S) := !!
!
ai
aj
|
,
bj
bi
c
2012
Berger and Müller-Hannemann
!
!
)
ai
aj
incomparable stream tuples
,
.
w.r.t. ≤opp and i < j
bi
bj
MLU Halle-Wittenberg
Dag Realization
22
Experiments
Distance to Opposed
90
80
70
60
50
40
30
20
10
0
0
2 4 6
8 10 12 14 16
difference d to opposed
ber
num
of a
rcs
rom
mf
9
5
to 3
percentage of randomly generated sequences
percentage of systematically generated sequences
Question: Do randomly generated sequences possess a
preference to a “small” distance to opposed in comparison
with systematically generated sequences?
100
90
80
70
60
50
40
30
20
10
0
0
2
4
6
8
10 12
difference d to opposed
num
14
ber
f ar
mo
rom
cs f
9 to
35
Systematic vs. randomized generation of sequences
YES, there is a clear bias towards smaller distance to opposed for
random instances.
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
23
Experiments
Distance to Opposed
fraction of non−lexmax sequences
Question: Do non-lexmax sequences possess a preference for
large opposed distances?
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
sity
den
m
m9
fro
to 3
5
difference d to opposed
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
24
Experiments
Back to Theory
Observation: very sparse instances (m < n) “forest dags” are
always solvable by lex max strategy
Is there a theoretical explanation?
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
25
Experiments
Back to Theory
Observation: very sparse instances (m < n) “forest dags” are
always solvable by lex max strategy
Is there a theoretical explanation?
Yes, and even more: every choice of a tuple in Vmin provably works!
Theorem (Realization of forest dags in linear time)
P
Let S := ba11 , . . . , bann with ni=1 ai ≤ n − 1 be a canonically sorted sequence
containing k > 0 source tuples. Furthermore, we assume that
S is not a
source-sink-sequence. Consider an arbitrary stream tuple baii with ai ≤ k.
S is a dag sequence if and only if
0
S :=
0
b1 − 1
,...,
0
an
0
0
ai−1
0
ai+1
,...,
,
,...,
,...,
,
,
bi+1
bn
bai +1
bk
bi−1
bi
bai − 1
is a dag sequence.
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
25
Randomized Strategies
Randomized Strategy I (Rand I)
Rand I:
1
choose a random permutation of the (stream) tuples
2
apply the linear-time realization algorithm
for prescribed topological orders
Note:
considers all permutations of stream tuples
has a high probability to fail
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
26
Randomized Strategies
Rand II: Exploit Necessary Conditions
Let S be a dag sequence with n tuples.
q — number of source tuples in S
s — number of sink tuples in S
Lemma (necessary criterion for the realizability of dag sequences)
If a stream tuple ba occurs at position i in a topological order of a
dag realization, then it follows that
a ≤ min{n − s, i − 1}
and
b ≤ min{n − q, n − i}.
Our task: Find a topological order which fulfills these conditions
for all stream tuples simultaneously.
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
27
Randomized Strategies
Rand II: Exploit Necessary Conditions
Reformulation as a perfect matching problem in a bipartite
graph (the so-called bounding graph)
Example: sequence S := 03 , 01 , 12 , 23 , 44 , 11 , 10 , 20 , 30
VS
WS
2
6
1
2
3
5
2
3
4
4
4
4
5
3
1
1
bounds for positions 3 to 6
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
stream
of S
tuples
Dag Realization
28
Randomized Strategies
Randomized Strategy II (Rand II)
Rand II:
1
choose a random perfect matching in the bounding graph
2
let P be the corresponding permutation of tuples
3
apply a linear-time realization algorithm
(subject to the fixed permutation P)
Note: a random perfect matching can be determined in
polynomial time, O(n8 (n log n + log 1ε ) log 1ε ), ε denotes deviation
from uniform distribution
(Jerrum, Sinclair and Vigoda, 2004)
in our experiments:
we compute the average running time over all perfect matchings
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
29
Randomized Strategies
Randomized Strategies III and IV
Rand III:
recall our recursive approach:
if the sequence is realizable, then the set Vmin contains at
least one element by which we can reduce the sequence
our general realization algorithm branches over all elements of
Vmin
instead of branching, we sample the next stream tuple
uniformly at random from the set Vmin
Rand IV:
combine Rand III with reduction rules
for details see full paper
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
30
Randomized Strategies
Success Probability of the
Randomized Strategies
All non-trivial sequences on 9 tuples:
1
success probability p(m)
0.9
0.8
0.7
Rand I
Rand II
Rand III
Rand IV
fraction of lexmax
sequences
0.6
0.5
0.4
0.3
0.2
0.1
0
5
10
c
2012
Berger and Müller-Hannemann
15
20
25
30
number of arcs m
MLU Halle-Wittenberg
35
40
Dag Realization
31
Randomized Strategies
Success Probability of the
Randomized Strategies
0.6
0.6
0.5
0.5
0.4
0.4
0.3
0.3
0.2
0.2
0.1
0.1
0
5
0
10 15 20 25 30 35 40
number of arcs m
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
percentage non-reducable non-lexmax seq.
success probability p(m) for one trial
Restriction to non-reducible, non-lexmax sequences of 9 tuples:
Rand I
Rand II
Rand III
Rand IV
% non-reducible
non-lexmax
sequences
Dag Realization
32
Summary
Summary: Our Contribution
deterministic
polynomially solvable
special classes:
general realization
algorithm
opposed sequences
recursive approach,
exponential time
(a feasible top. order
can be determined
efficiently)
randomized
four different approaches
topological order
is chosen randomly
special strategy:
lex−max strategy
(linear−time heuristic)
lex max strategy and RAND IV are remarkably successful
all real-world instances solved easily in linear time
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
33
Summary
Future Work
To do:
characterize the class of instances for which the lex max
strategy works provably correct
identify other classes of instances which allow polynomial-time
algorithms
provide a theoretical analysis of the randomized approaches
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
34
c
2012
Berger and Müller-Hannemann
MLU Halle-Wittenberg
Dag Realization
35
© Copyright 2026 Paperzz