Complexity of some Path Problems in DAGs and Linear Orders

We investigate here the computational complexity of three natural problems in directed acyclic graphs. We prove their NP Completeness and consider their restrictions to linear orders.

Authors: Serge Burckel

Complexity of some Path Problems in DAGs and Linear Orders
S. Burc kel Complexit y of some Path Problem s in DA Gs and Linear Orders. Complexit y of some P ath Problems in D A Gs and Linear Orders. Abstract. W e in v estigate here the com putational compl exit y of three natural problems in directed ac yclic graphs. W e prov e their NP Completenes s and conside r their restrictions to li near orders. Mathematics Subje cts Classific ation : . 1. Introduc tion. In this pap er, w e precise and extend the r esults of [1] a bo ut the complexity of path pr oblems in directed g raphs. In pa rticular we fo cus ourselves on the case of D AG s and very particular ones : linear order s. 2. Problems. Problem 1 : Null W e igh ted P ath. input : a DA G G = ( V , E ) endow ed with a w eight function w : E 7→ Z and tw o vertices s, t . question : is there a directed path π from s to t such that X e ∈ π w ( e ) = 0 Prop ositio n (1.) The Null W eighted P ath Decision Pro blem is NP- Complete, even on linear orders. Pro of. Obviously , it is in NP . T o prov e that it is NP hard, we r educe the SUBSET SUM P roblem to it. Let A = { a 1 , . . . , a n } b e a subset of Z n . One can constr uc t in p olynomia l time a DA G G = ( V , E ), a weigh t function and t wo vertices s, t that admits a path from s to t of n ull weigh t if and only if there exists a non e mpt y set S ⊆ A such that X a ∈ S a = 0 The DA G G = ( V , E ) has n + 2 ordered vertices V = [ s = 0 , 1 , 2 , . . . , n, n + 1 = t ] and the arcs ar e all the pa irs e ij = ( i, j ) with i < j . Hence, G is a linear order. The weigh ts are : w ( e ij ) = ( a j for 0 ≤ i < j ≤ n 0 for 1 ≤ i ≤ n and j = t +1 for i = 0 and j = t 1 S. Burc kel Complexit y of some Path Problems in DA Gs and Linear Orders. The following example shows this construction for A = { 4 , 2 , − 5 } (arcs are oriented from left to right) : 0 0 0 t +1 s +4 +2 −5 +2 −5 −5 Assume ther e ex ists a non e mpt y subs et of A S = { a i 1 , . . . , a i k } suc h that a i 1 + . . . + a i k = 0. Then, one can a ssume that i 1 < i 2 < . . . < i k . Hence, π = [ s, a i 1 , . . . , a i k , t ] is a n ull weighted path from s to t . F or the conv erse, observe that every path fro m s to t (excepted the direct arc ( s, t ) of weight +1) co n tains at least one ar c with an ele men t of A . Hence, a nu ll w eight ed path from s to t des crib es a non empt y s ubset of A with null sum.  Now we consider a similar problem on D A Gs with po sitive weigh ts. Problem 2 : K W eigh ted P ath. input : a DA G G = ( V , E ) endow e d with a weigh t function w : E 7→ N , tw o vertices s, t and an integer K ≥ 0 question : is there a directed path π from s to t such that X e ∈ π w ( e ) = K Prop ositio n (2.) The K W eig hted Path Decisio n P roblem is NP-Co mplete, even on linear orders. Pro of. Obviously , it is in NP . T o prov e that it is NP hard, we reduce ag ain the SUBSET SUM Pro blem to it. Let A = { a 1 , . . . , a n } be a subset of Z n . One can constr uct in p o lynomial time a DA G G = ( V , E ), a weight function, 2 S. Burc kel Complexit y of some Path Problems in DA Gs and Linear Orders. an integer K and tw o vertices s, t that admits a pa th from s to t of weight K if and only if there ex ists a non e mpty set S ⊆ A such that X a ∈ S a = 0 Let P = − m in ( { 0 } ∪ A ) and fix K = ( n + 1) P . The constructio n is similar as pre v iously . How ev er, one trans lates the weigh t of e a ch arc ( i , j ) by ( j − i ) P . The DA G G = ( V , E ) has n + 2 o rdered vertices V = [ s = 0 , 1 , 2 , . . . , n, n + 1 = t ] and the arcs are all the pairs e ij = ( i, j ) with i < j . Hence G is a line a r order. The weigh ts are : w ( e ij ) =    ( j − i ) P + a j for 0 ≤ i < j ≤ n ( j − i ) P for 1 ≤ i ≤ n and j = t ( j − i ) P + 1 for i = 0 and j = t F or A = { 4 , 2 , − 5 } one obtains with P = − min ( { 0 , 4 , 2 , − 5 } ) = + 5 the follow- ing linear order DA G : P−5 P+2 3P 2P 4P+1 s t 2P−5 P+4 3P−5 2P+2 P Assume ther e ex ists a non e mpt y subs et of A S = { a i 1 , . . . , a i k } suc h that a i 1 + . . . + a i k = 0. Then, one can a ssume that i 1 < i 2 < . . . < i k . Hence, π = [ s, a i 1 , . . . , a i k , t ] is a path fro m s to t of weight K = ( n + 1) P . F or the conv erse, observe that every path fro m s to t (excepted the direct arc ( s, t ) of weigh t ( n + 1) P + 1) contains at least one arc that contributes to an element of A . Hence, a path of weigh t ( n + 1) P describ es a non empty subset of A with n ull s um.  Now, w e consider DA Gs without weights. W e just count the leng th of the paths, i.e, the n um ber of a rcs in them. 3 S. Burc kel Complexit y of some Path Problems in DA Gs and Linear Orders. Problem : P ath of Length K . input : a DA G G = ( V , E ), tw o vertices s, t and an integer K > 0. question : is there a directed path from s to t of le ngth K . This pro blem is solv able in determinis tic po lynomial time since one can as sume that K < | V | since G is a D AG . Hence, o ne can efficiently compute the matrix M K where M is the adjacency matrix of G . How ever, when one adds a supplementary condition, the problem beco mes NP- Complete. Problem 3 : Irreducible P ath of Length K . input : a DA G G = ( V , E ), tw o vertices s, t and an integer K > 0. question : is there an irre ducible directed path fro m s to t of length K . Here irr e ducible p ath means a se quence of vertices [ s = x 0 , x 1 , . . . , x K = t ] such that ( x i , x j ) ∈ E if and only if j = i + 1. Of course, in linear o rders, this problem is trivial since : for K ≥ 2 , the answer is necessarily NO (b y tr ansitivity). for K = 1 , that co rresp onds to s < t . F or mor e general DA Gs, this problem is no n trivial anymore. Prop ositio n (3.) The Irreducible Path of Length K Decision Problem is NP-Complete. Pro of. Obviously again, it is in NP . F or the NP Hardness, we reduce now the CNF SA T Problem to it. Let Φ b e a CNF fo r mula C 1 ∧ C 2 ∧ C 3 . . . ∧ C k where each clause C i is a disjunction of litterals on different v ariables. Assume that the total num ber of litterals in Φ is N . W e construct a DA G G = ( V , E ) with N + 2 vertices : one vertex per litteral in each c lause C i and tw o supplementary vertices s, t . The a rcs a re the pairs : ( s, x ) for x ∈ C 1 ( y , t ) for y ∈ C k ( x, y ) for x ∈ C i and y ∈ C j with j = i + 1 a nd x 6 = y ( x, y ) for x ∈ C i and y ∈ C j with j > i + 1 a nd x = y F or Φ = ( a ∨ b ∨ c ) ∧ ( d ∨ a ) ∧ ( a ∨ d ∨ c ), one obtains the following DA G : 4 S. Burc kel Complexit y of some Path Problems in DA Gs and Linear Orders. 2 1 C 3 C C t a s b c a d a d c The question is to find an irre ducible pa th of length K = ( k + 1). This is equiv alent to the satisfiability of Φ : one has to find at least one littera l assig ne d to ”true” in each cla use (hence a path of length k + 1 from s to t ) and with no contradictory assignments like x = tr ue and x = tr ue . F or co nsecutive clauses, such an arc ( x, x ) do es no t exist. Otherwise, this arc ( x, x ) would make the path not irreducible.  [1] S. Basagni,D. B r uschi, F. Ra v asio , On the difficult y of finding walks of le ng th k , Theoretical Informatics and Applications 31 (5) (1997) 429– 435. Serge Burck el. INRIA-LORIA, Campus Scien tifique BP 239 54506 V ando euvr e-l` es-Nancy Cedex sergeburckel@orange.fr This w ork has been partially supp or ted by the CNRS-ANR pro ject ”graphs decomp ositions and algorithms” . 5

Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment