How to Attack the NP-Complete Dag Realization Problem in Practice

نویسندگان

  • Annabell Berger
  • Matthias Müller-Hannemann
چکیده

We study the following fundamental realization problem of directed acyclic graphs (dags). Given a sequence S := ( a1 b1 ) , . . . , ( an bn ) with ai, bi ∈ Z+0 , does there exist a dag (no parallel arcs allowed) with labeled vertex set V := {v1, . . . , vn} such that for all vi ∈ V indegree and outdegree of vi match exactly the given numbers ai and bi, respectively? Recently this decision problem has been shown to be NP-complete by Nichterlein [Nic11]. However, we can show that several important classes of sequences are efficiently solvable. In previous work [BM11], we have proved that yes-instances always have a special kind of topological order which allows us to reduce the number of possible topological orderings in most cases drastically. This leads to an exact exponential-time algorithm which significantly improves upon a straightforward approach. Moreover, a combination of this exponential-time algorithm with a special strategy gives a linear-time algorithm. Interestingly, in systematic experiments we observed that we could solve a huge majority of all instances by the linear-time heuristic. This motivates us to develop characteristics like dag density and “distance to provably easy sequences” which can give us an indicator how easy or difficult a given sequence can be realized. Furthermore, we propose a randomized algorithm which exploits our structural insight on topological sortings and uses a number of reduction rules. We compare this algorithm with other straightforward randomized algorithms in extensive experiments. We observe that it clearly outperforms all other variants and behaves surprisingly well for almost all instances. Another striking observation is that our simple linear-time algorithm solves a set of real-world instances from different domains, namely ordered binary decision diagrams (OBDDs), train and flight schedules, as well as instances derived from foodweb networks without any exception. 1 The Dag Realization Problem Dag realization problem: Given is a finite sequence S := ( a1 b1 ) , . . . , ( an bn ) with ai, bi ∈ Z0 . Does there exist an 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 d+G(vi) = bi for all vi ∈ V ? If the answer is “yes”, we call sequence S dag sequence and the acyclic digraph G (a so-called “dag”) a dag realization. A relaxation of this problem – not demanding the acyclicity of digraph G – is called digraph realization problem. In this case, we call ? This work was supported by the DFG Focus Program Algorithm Engineering, grant MU 1482/4-2. Extended abstract is to appear in Proceedings of SEA 2012, LNCS, Springer. ar X iv :1 20 3. 36 36 v1 [ cs .D S] 1 6 M ar 2 01 2 2 A. Berger, M. Müller-Hannemann G digraph realization and S digraph sequence. The digraph realization problem can be solved in linear-time using an algorithm by Wang and Kleitman [KW73]. Unless explicitly stated, we assume that a sequence does not contain any zero tuples ( 0 0 ) . Moreover, we will tacitly assume that ∑n i=1 ai = ∑n i=1 bi, as this is obviously a necessary condition for any realization to exist, since the number of ingoing arcs must equal the number of outgoing arcs. Furthermore, we denote tuples ( ai bi ) with ai > 0 and bi = 0 as sink tuples, those with ai = 0 and bi > 0 as source tuples, and the remaining ones with ai > 0 and bi > 0 as stream tuples. We call a sequence only consisting of source and sink tuples, source-sink-sequence. A sequence S = ( a1 b1 ) , . . . , ( an bn ) with q source tuples and s sink tuples is denoted as canonically sorted, if and only if the first q tuples in this labeling are decreasingly sorted source tuples (with respect to the bi) and the last s tuples are increasingly sorted sink tuples (with respect to the ai). Hardness and efficiently solvable special cases. Nichterlein very recently showed that the dag realization problem is NP-complete [Nic11]. On the other hand, there are several classes of sequences for which the problem is not hard. One of these sequences are source-sink-sequences, for which one only has to find a digraph realization. The latter is already a dag realization, since no vertex has incoming as well as outgoing arcs. Furthermore, sparse sequences with ∑n i=1 ai ≤ n − 1 are polynomial-time solvable as we will show below. We denote such sequences by forest sequences. The main difficulty for the dag realization problem is to find out a “topological ordering of the sequence”. In the case where we have one, our problem is nothing else but a directed f -factor problem on a complete dag. The labeled vertices of this complete dag are ordered in the given topological order. This problem can be reduced to a bipartite undirected f -factor problem which can be solved in polynomial time via a further famous reduction by Tutte [Tut52] to a bipartite perfect matching problem. In a previous paper [BM11], we proved that a certain ordering of a special class of sequences –opposed sequences– always leads to a topological ordering of the tuples for at least one dag realization of a given dag sequence. On the other hand, it is not necessary to apply the reduction via Tutte if we possess one possible topological ordering of a dag sequence. The solution is much easier. Next, we describe our approach. Realization with a prescribed topological order. We denote a dag sequence S := ( a1 b1 ) , . . . , ( an bn ) which possesses a dag realization with a topological numbering corresponding to the increasing numbering of its tuples by dag sequence for a given topological order and analogously the digraphG = (V,A) by dag realization for a given topological order. Without loss of generality, we may assume that the source tuples come first in the prescribed numbering and are ordered decreasingly with respect to their bi values. A realization algorithm works as follows. Consider the first tuple ( aq+1 bq+1 ) from the prescribed topological order which is not a source tuple. Then there must exist aq+1 source tuples with a smaller number in the given dag sequence. Reduce the aq+1 first (i.e. with largest bi) source tuples by one and set the indegree of tuple ( aq+1 bq+1 ) to 0. That means, we reduce sequence S := ( a1 b1 ) , . . . , ( aq+1 bq+1 ) , . . . , ( an bn ) to sequence S′ := ( a1 b1−1 ) , . . . , ( aaq+1 baq+1−1 ) , . . . , ( aq bq ) , ( 0 bq+1 ) , . . . , ( an bn ) . If we get zero tuples in S′, then we delete them and denote the new sequence for simplicity also by S′. Furthermore, we label this sequence with a new numbering starting from one to its length and consider this sorting as the given topological ordering for S′. We repeat this process until we get an empty sequence (corresponding to the realizability of How to Attack the Dag Realization Problem 3 S) or get stuck (corresponding to the non-realizability of S). The correctness of our algorithm is proven in Lemma 1. Lemma 1. S is a dag sequence for a given topological order ⇔ S′ is a dag sequence for its corresponding topological order. Discussion of our main theorem and its corresponding algorithm. We do not know how to determine a feasible topological ordering (i.e., one corresponding to a realization) for an arbitrary dag sequence. However, we are able to restrict the types of possible permutations of the tuples. For that, we need the following order relation ≤opp⊂ Z × Z, introduced in [BM11]. Definition 1 (opposed relation). Given are c1 := ( a1 b1 ) ∈ Z and c2 := ( a2 b2 ) ∈ Z. We define: c1 ≤opp c2 ⇔ (a1 ≤ a2 ∧ b1 ≥ b2). Note, that a pair c1 equals c2 with respect to the opposed relation if and only if a1 = a2 and b1 = b2. The opposed relation is reflexive, transitive and antisymmetric and therefore a partial, but not a total order. Our following theorem leads to a recursive algorithm with exponential running time and results in Corollary 1 which proves the existence of a special type of possible topological sortings provided that sequence S is a dag sequence. Theorem 1 (main theorem [BM11]). Let S be a canonically sorted sequence containing k > 0 source tuples. Furthermore, we assume that S is not a source-sinksequence. We define the set Vmin := {( ai bi ) | ( ai bi ) is stream tuple, ai ≤ k, and there is no stream tuple ( aj bj )

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

On the computational complexity of finding a minimal basis for the guess and determine attack

Guess-and-determine attack is one of the general attacks on stream ciphers. It is a common cryptanalysis tool for evaluating security of stream ciphers. The effectiveness of this attack is based on the number of unknown bits which will be guessed by the attacker to break the cryptosystem. In this work, we present a relation between the minimum numbers of the guessed bits and uniquely restricted...

متن کامل

Logical s-t Min-Cut Problem: An Extension to the Classic s-t Min-Cut Problem

Let $G$ be a weighted digraph, $s$ and $t$ be two vertices of $G$, and $t$ is reachable from $s$. The logical $s$-$t$ min-cut (LSTMC) problem states how $t$ can be made unreachable from $s$ by removal of some edges of $G$ where (a) the sum of weights of the removed edges is minimum and (b) all outgoing edges of any vertex of $G$ cannot be removed together. If we ignore the second constraint, ca...

متن کامل

Degree-constrained editing of small-degree graphs

This thesis deals with degree-constrained graph modification problems. In particular, we investigate the computational complexity of DAG Realization and Degree Anonymity. The DAG Realization problem is, given a multiset of positive integer pairs, to decide whether there is a realizing directed acyclic graph (DAG), that is, pairs are one-to-one assigned to vertices such that the indegree and the...

متن کامل

NP-Hardness and Fixed-Parameter Tractability of Realizing Degree Sequences with Directed Acyclic Graphs

In graph realization problems one is given a degree sequence and the task is to decide whether there is a graph whose vertex degrees match the given sequence. This realization problem is known to be polynomial-time solvable when the graph is directed or undirected. In contrast, we show NP-completeness for the problem of realizing a given sequence of pairs of nonnegative integers (representing i...

متن کامل

Deciding Morality of Graphs is NP-complete

In order to find a causal explanation for data presented in the form of covariance and con­ centration matrices it is necessary to decide if the graph formed by such associations is a projection of a directed acyclic graph ( dag). We show that the general problem of deciding whether such a dag exists is NP-complete.

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2012