<<

arXiv:1509.05637v3 [cs.CC] 15 Jul 2016 deifrainfunction information edge NTNE ie egtd ietd cci graph acyclic directed, weighted, a Given INSTANCE: follows. as formalized is onesaepstv integers. positive are pointers rbe ob eldfie,i srqie htegswith edges that required is it well-defined, be to problem w ar h aeifrainadaesmlri htrsetif respect that in similar are and information same the carry a o ntneb one otesbtutr represente substructure the to pointer a be instance for may hspolmb soitn nomto ihteegsi th in edges the with information by represented associating are by children problem several this where compressed a eea uhegsocro ah h oto h substructu the of from cost the such shortest path, a a find on to want occur edges such several scutdol ne hr a aiyb uhapt fls co less of path a such be easily may There in path once. only counted is de ersn oepsil usrcue n ahfrom path a and substructures possible some represent Edges h de ftept.Nw ieetegsin edges different Now, path. the co of least of edges superstructure the sho the ordinary of An representation weig tree-like consumption). Edge memory superstructure. (e.g., desired a substructures form to together put are h deIfrainRueSots ahProblem Path Shortest graph acyclic Reuse directed, weighted, Information A Edge The 1 ( e ecl hspolmthe problem this call We = ) h hretPt rbe ihEg nomto es is Reuse Information Edge with Problem Path Shortest The ihteegs(.. one) uhthat such pointer), a (e.g., edges the with s opee e egtd ietd cci graph acyclic directed, weighted, a Let complete. aeifrain o uhegsi srqie that required is it edges such for information; same nyoc.Tepolmi odtrieasots such shortest a determine to is problem The once. only deifrainruesots ahproblem path shortest reuse information edge path and w G eso httefloigvraino h igesuc hretp shortest single-source the of variation following the that show We ( nta ae oecs-ffiin ersnaino h des the of representation cost-efficient more a case, that In . e U ′ t atraiey h dewt h mletwih ol be could weight smallest the with edge the (alternatively, ) stesmo h egt fteegson edges the of weights the of sum the is egvn e nadto mapping a addition in Let given. be aut fIfrais nttt fIfrainSystems Information of Institute Informatics, of Faculty a oiesrse1/8-,14 ina Austria Vienna, 1040 16/184-5, Favoritenstrasse f integer , eerhGopPrle Computing Parallel Group Research deifrainruesots ahproblem path shortest reuse information edge email: 5921,Rvsd6.6.2016 Revised 15.9.2015, G eprLrsnTr¨aff Larsson Jesper K [email protected] NP-Complete ( = s ≥ to ,E w E, V, .Telength The 0. UWien TU Abstract t f hr h egto de ihsmlrinformation similar with edges of weight the where ( e ti Pcmlt yrdcinfo 3SAT. from reduction by NP-complete is It . 1 = ) f ihsuc n ikvertices sink and source with ) G on G U a ersn iia usrcue,adif and substructures, similar represent may f ( ( = u de with edges but w E e ′ ( en htedges that means ) e egvnta soitsinformation associates that given be ,E w E, V, t igero ihcide ie by given children with root single a st: r = ) G ( st U f ( = t eettecs fteassociated the of cost the reflect hts w s fanodrd path ordered) a(n of ) yteeg.Toedges Two edge. the by d ah ecl hspolmthe problem this call We path. f ( h aesbtutr.W model We substructure. same the ts ahdtrie nordered, an determines path rtest omo function a of form e ( to e ( ihsuc n ikvertices sink and source with ) e = ) e ′ ene epi nyoc.We once. only paid be need re ,E w E, V, .Telnt fasimple a of length The ). = ) t eemnshwsubstructures how determines tta nodnr shortest ordinary an than st f f f ( ( e ( e = ) e rdsprtutr sby is superstructure ired ,tovertices two ), ′ aetesm weight same the have ) ′ t rbe sNP- is problem ath .Frteoptimization the For ). one) egt and Weights counted). e h eiinversion decision The . f and ( e ′ r counted are ) e ,t s, ′ ar the carry ∈ f U V on ihedge with ,t s, ,e e, sgiven. is st E ′ ∈ that ∈ V E , information reuse is defined as

r(U) = X w(e) e∈U\{e∈U|∃e′

2 Reduction from 3SAT

Originally, a reduction from PARTITION was given, which turned out to be incorrect and fundamentally flawed (see Appendix). Instead, we use the same reduction from 3SAT [2, LO2] as in the paper by Broersma et al. [1].

Proposition 1 The edge information reuse shortest path problem is NP-complete.

Proof: It is clear that the problem is in NP. Let U be a path from s to t. We can check whether the path taking edge information reuse into account has length at most some K by two traversals of U. We use f(e) as a pointer to mark for information reuse. In the first traversal, all f(e) for e ∈ U are marked as unused. In the second traversal the weights of unused f(e)’s are summed and f(e) marked as used. The 3SAT problem is, given a collection of m three-literals clauses Cj, 0 ≤ j

2 The graph thus constructed has O(n + m) vertices and edges, and can clearly be computed in a polynomial number of steps, including the function f assigning (shared) information with the edges. Now, the claim is that the given 3SAT instance is satisfiable, if an only if the shortest st path with edge information reuse has length exactly n. Any path from s to t must have length at least n, since it has to pass through all vertices ui, 1 ≤ i

The graph constructed in the reduction is acyclic, which shows that the shortest st path problem with edge information reuse on acyclic graphs is NP-complete.

3 Remark

Alex Khodaverdian (personal communication, 24.5.2016) pointed out some problems with the original reduction from PARTITION (still retained in the appendix), which eventually showed this reduction to be fundamentally flawed. Fortunately, the 3SAT reduction from [1] shows the problem NP-complete, so that the original claim still holds. It might still be enlightening to find a different reduction. For the first version of this note, Gerhard Woeginger (personal communication, 15.9.2015) pointed out that NP-completeness follows straightforwardly from the NP-completeness of the problem of finding a simple st path with the smallest number of colors in a graph with colored edges, and supplied the reference [1]. Simply let the function f denote the edge colors and take all edge weights to be 1. A shortest st path with edge information reuse corresponds to a simple st path with the smallest number of colors.

References

[1] Hajo Broersma, Xueliang Li, Gerhard Woeginger, and Shengui Zhang. Paths and cycles in colored graphs. Australasian Journal on Combinatorics, 31:299–311, 2005.

[2] M. R. Garey and D. S. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. Freeman, 1979. With an addendum, 1991.

A The flawed reduction from PARTITION

We tried to show the edge information reuse shortest path problem NP-complete by a reduction from the NP-complete PARTITION problem [2, SP12].

Proposition 2 The edge information reuse shortest path problem is NP-complete.

3 v1 vn−1

0 0 0 0

w w wn w w wn w w wn 0 1 . . . −1 ′ 0 ′ 1 ′ . . . ′ −1 ′ ′′ 0 ′′ 1 ′′ . . . ′′ −1 ′′ s = u0 u1 u2 un−1 un = u0 u1 u2 un−1 un = u0 u1 u2 un−1 un = t

⌊B/2⌋ ⌊B/2⌋

Figure 1: The weighted, directed, acyclic graph constructed from the given PARTITION in- stance. The shortest path taking edge information reuse into account should have length B if and only if the PARTITION instance is feasible.

It is clear that the problem is in NP. Let U be a path from s to t. We can check whether the path taking edge information reuse into account has length at most some K by two traversals of U. We use f(e) as a pointer to mark for information reuse. In the first traversal, all f(e) for e ∈ U are marked as unused. In the second traversal the weights of unused f(e)’s are summed and f(e) marked as used. Now, let the item set A = {x0,...xn−1} with integer item weights w(xi) be an instance of PARTITION, and let B = Px∈A w(x). We construct a weighted, directed, acyclic graph G such that there is a shortest path with edge information reuse of length B if and only if the answer to PARTITION is “yes”, that is, if there is a subset P of A such that Px∈P w(x)= Px∈A−P w(x). The graph G consists if three parts, the first with vertices u0, u1, . . . , un and v1, . . . vn−1, ′ ′ ′ ′′ ′′ ′′ the second with vertices u0, u1, . . . , un, and the third part with vertices u0, u1, . . . , un, where ′ ′ ′′ ′′ un = u0 and un = u0. The source is s = u0 and the sink t = un. For each i = 0,n − 1 there ′ ′ ′′ ′′ are edges (ui, ui+1), (ui, ui+1), and (ui , ui+1) each with weight w(xi), and these three edges ′ ′ ′′ ′′ carry the same item information, that is f((ui, ui+1)) = f((ui, ui+1)) = f((ui , ui+1)). Different edges (ui, ui+1) and (uj, uj+1) carry different item information. The information associated ′ ′ with these edges designate the items of A. There are edges (u0, un) and (u0, un) both of weight ⌊B/2⌋ (which share no information). In the first part of G there is for each i = 1,...,n − 1 two edges (ui, vi) and (vi, ui+1) of weight 0. The construction is illustrated in Figure 1. It can clearly be carried out in O(n) operations. There is clearly a path from s to t in G. The purpose of first part of the graph is to select items for the set P . For any path through this part the information associated with non-zero weight edges designate items chosen for P . Each subset P is chosen by a unique path. Assume that a shortest st path with information reuse is longer than B. The path either passes through the vertices u1, u2, . . . , un−1, and possibly some of the vi vertices as well, or takes the shortcut edge (u0, un). In the first case, the length of the path to vertex un is at most ⌊B/2⌋, and there is no possibility for information reuse since all edge information occurs for the first time in this part of G. Let W be the sum of the weights of the (ui, ui+1) edges on the path. These weights ′ ′ ′′ ′′ will not be counted again since they share information with the edges (ui, ui+1) and (ui , ui+1). ′ ′ If W < ⌊B/2⌋ the shortest path must take the shortcut edge (u0, un) of weight ⌊B/2⌋ since ′′ B − W > ⌊B/2⌋. The path through the final part of G from u0 to t will have weight W − B for a total of B + ⌊B/2⌋. If the shortest path instead takes the shortcut edge (u0, un) of weight ⌊B/2⌋ (which means that there is no item xi ∈ A with w(xi) ≤ ⌊B/2⌋), then the path must also take the shortcut ′ ′ ′ edge (u0, un) since there is no edge information to reuse and the non-shortcut path from u0 ′ ′′ to un has length B. The part of the path from u0 to t in this case has cost B since no edge information can be reused, for a total of 2⌊B/2⌋ + B.

4 Thus, the length of a shortest path with information reuse is B if and only it is possible to find a path from u0 to un of length exactly ⌊B/2⌋ (that does not use the shortcut edge), and if the weight of the edges whose information has not been used in this part is likewise exactly ′′ ⌊B/2⌋. In this case, all edge information has been used, and the part of the path from u0 to t contributes weight 0. The solution P to the PARTITION is the information f(e) on the non-zero edges on the part of the path from s to un. The flaw in this argument is simply that subpaths of a shortest st-path do not have to be shortest paths themselves. Therefore, with information reuse, there is always a shortest path of length exactly B, and the shortcut edges of weight ⌊B/2⌋ do not have to be taken.

5