Deleting Vertices To Bound Path Length
Doowon Paik+ Sudhakar Reddy++
University of Florida University of Iowa
Sartaj Sahni+
University of Florida
Abstract
We examine the vertex deletion problem for weighted directed acyclic graphs (wdags). The
objective is to delete the fewest number of vertices so that the resulting wdag has no path of
length > 6. Several simplified versions of this problem are shown to be NP-hard. However, the
problem is solved in linear time when the wdag is a rooted tree and in quadratic time when the
wdag is a series-parallel graph.
Keywords And Phrases
Vertex deletion, directed acyclic graphs, rooted trees, series-parallel graphs, NP-hard
+ Research supported, in part, by the National Science Foundation under grants DCR-84-20935 and MIPS-86-17374.
++ Research supported, in part, by SDIO/IST Contract No. N00014-90-J-1793 managed by US Office of Naval Research.
1 Introduction
A variety of vertex deletion problems formulated on graphs and digraphs are known to be NP-
hard [KRIS79]. In this paper, we propose a new formulation of the vertex deletion problem that
is applicable to edge weighted directed acyclic graphs (wdag). In this formulation, we are
interested in deleting the smallest number of vertices from the wdag such that the resulting wdag
has no path of length > 6 where 6 is an input to the problem.
This problem is a natural variant of the vertex splitting problem for weighted wdags that we
studied in [PAIK90]. In the vertex splitting problem, we are split the fewest number of vertices
so that the resulting wdag has no path of length >6. When a vertex is split, two vertices are
created. The incoming edges of the original vertex are attached to one of these and the outgoing
edges to the other. The vertex splitting problem can be used to model several VLSI design prob-
lems such as the selection of flip-flops for scan paths in partial scan designs and the placement of
signal boosters in lossy circuits.
The vertex deletion problem described above can be used to model certain VLSI design and
communication problems. For example, suppose we have a collection of interconnected modules
with the property that the flow of signals can be modeled by a wdag. The edge weights give the
signal level loss incurred as the signal travels on each edge. Let 6 denote the maximum permissi-
ble signal loss. Assume that it is possible to upgrade the modules and their connections so that
there is effectively no signal loss on the upgraded connections (these may for e.g. be gold) and
the upgraded module restores the signal level to its maximum value. To minimize the cost of the
resulting circuit, it is desired to upgrade the minimum number of modules such that in the result-
ing circuit no signal suffers a loss > 6 before being restored to its maximum level. This is
equivalent to deleting the fewest number of vertices so that the resulting wdag has no path of
length > 6.
The terminology we shall use in this paper is developed in the next section. In this section,
we also obtain some relationships between the size of an optimal solution to the vertex deletion
problem and that of an optimal solution to the vertex splitting problem on the same wdag. Our
NP-hard results are presented in Section 3. In Section 4, we develop a linear time algorithm for
wdags that rooted trees and in Section 5, a quadratic algorithm is developed for wdags that are
series-parallel graphs. We note that this quadratic algorithm is easily adapted to the vertex split-
ting problem on series-parallel graphs. This adaptation does not affect its complexity. Likewise,
the backtracking algorithm and heuristics proposed in [PAIK90] for the vertex splitting problem
may be easily adapted to the vertex deletion problem of this paper.
2 Terminology
Let G = (VE,w) be a weighted directed acyclic graph with vertex set V, edge set E, and edge
weighting function w. w (i,j) is the weight of the edge < i,j> E. w (i,j) is a positive integer for
< i,j > E and w (i,j) is undefined if < i,j > E. A source vetex is a vertex with zero in-degree
while a sink vetex is a vertex with zero out-degree. The delay, d(P), of the path P is the sum of
the weights of the edges on that path. The delay, d(G), of the graph G is the maximum path delay
in the graph, i.e.,
d(G) = max { d(P)}
Pn G
Let G-X be the wdag obtained when the vertices in X are deleted from the wdag G. This
vertex set deletion is also accompanied by the deletion of all edges in G that are incident to a
deleted vertex. Figure l(a) shows an example wdag G and Figure l(b) shows the wdag G-{v5}.
Note that the source and sink vertex sets of G and G-X may be different. The dag vertex dele-
tion problem (DVDP) is to find a least cardinality vertex set X such that d(G-X) < 8 where 6 is
a prespecified graph delay. For the wdag of Figure l(a), the set X= {vs} is a solution to the
DVDP problem when 6 = 3.
V3 V6
11
(a)
2 1V
(b)
Figure 1: DVDP example.
Let G/Xbe the wdag that results when each vertex v inXis split into two vertices v' and vo
such that all edges < v,j> E are replaced by edges of the form < v,j> and all edges
< i,v> eE are replaced by edges of the form < i,v' >. I.e., outbound edges of v now leave vertex
v while the inbound edges of v now enter vertex v'. Figure 2 shows the result, G/{v5 of split-
ting the vertex V5 of the wdag of Figure l(a). The dag vertex splitting problem (DVSP) is to find
a least cardinality vertex set X such that d(G/X) < 8 where 6 is a prespecified delay. For the
wdag of Figure l(a) and 6 = 3, X= {v4, v 5 is a solution to the DVSP problem.
2
Figure 2: DVSP example.
Lemma 1: Let G = (VE,w) be a weighted wdag and let 6 be a prespecified delay value. Let
MaxEdgeDelay = max {w (i,j) }.
<,j >EE
(a) The DVDP has a solution iff6 2 0.
(b) The DVSP has a solution iff6 2 MaxEdgeDelay.
(c) For every 8 2 MaxEdgeDelay, the size of the DVDP solution is less than or equal to that of
the DVSP solution.
Proof:
(a) Since d(G-V) = 0, there must be a least cardinality set Xsuch that d(G-X) < 8.
(b) Vertex splitting does not eliminate any edges. So, there is no X such that d(G/X) < Max-
EdgeDelay. Further, d(G/V) = MaxEdgeDelay. So, for every 8 2 MaxEdgeDelay, there is
a least cardinality set X such that d(G/X) < 8.
(c) LetXbe a solution to the DVSP. Since d(G/X) < 6, d(G-X) < 8. Hence the cardinality of
the DVDP solution is < IXI. o
Let I DVSP I (I DVDP I) be the size of solution to the DVSP (DVDP).
Lemma 2: For every 8, 8 > 0, there is a wdag G = (VE,w) with MaxEdgeDelay < 6 such that
IDVSP I / IDVDP I = number of nodes that are neither source nor sink.
Proof: Consider the wdag of Figure 3. d(G {v}) = 8. However, since every edge has weight 6,
it is necessary to split every vertex that is not a source or sink to get the delay down to 6. O
Figure 3: Construction for Lemma 2.
Corollary 1: For every 8 2 MaxEdgeDelay and every wdag G such that d(G) > 8, 1 < IDVSP I /
IDVDP I < number of nodes that are neither source nor sink.
Proof: The lower bound follows from Lemma 1 part (c) and the upper bound follows from the
observation that IDVSP I number of nodes that are neither source nor sink and IDVDP I 2 1.
Note that the source and sink vertices of a wdag never need to be split. O
3 Complexity Results
If w (i,j) = 1 for every edge in the wdag, then the edge weighting function w is said to be a unit
I ,gl ,i1 g function and we say that G has unit weights. In this section we show that the following
problems are NP-hard.
1. DVDP for unit weight graphs with 6 2 0.
2. DVDP for unit weight multistage graphs with 6 2 2 (in a multistage graph the vertices are
divided into an ordered set of stages and each edge goes from a vertex in one stage to one
in the next stage).
Since unit weight wdags are just a special case of general wdags, the results obtained imply
the NP-hardness of the corresponding problems with the unit weight constraint removed.
3.1 Unit Weight DVDP
First, we shall show that unit weight DVDP is NP-hard when 6 = 0. This is done by show-
ing that the vertex cover problem (i.e., given an undirected graph G does it contain a set, S, of at
most k vertices such that each edge of G is incident to at least one vertex in S?) which is known
to be NP-complete can be solved in polynomial time if there is a polynomial time algorithm for
unit weight DVDP with 6 = 0. Next, we use this result to show that unit weight DVDP is NP-
hard for every 6 2 1.
Theorem 1: Unit weight DVDP is NP-hard for 6 = 0.
Proof: Let G be an instance of unit weight DVDP and let X be such that d(G -X) = 0. So, X
must contain at least one of the two end-points of each edge of G. Hence, X is a vertex cover of
the undirected graph obtained from G by removing directions from the edges. Actually, every
vertex cover problem can be transformed into an equivalent DVDP with 6 = 0. Let Ube an arbi-
trary undirected graph. Replace each undirected edge (u,v) of U by the directed edge <
min{u,v},max{u,v}> to get the directed graph V Vis a wdag as one cannot form a cycle solely
from edges of the form < i,j> where i < j. Furthermore the DVDP instance V with 8 = 0 has a
solution of size < k iff the corresponding vertex cover instance U does. Hence, unit wieght
DVDP with 6 = 0 is NP-hard. O
The proof for the case 6 2 1 is obtained by showing that a polynomial time algorithm for
unit weight DVDP for any fixed 6 would result in a polynomial time algorithm for the case 6 = 0.
Theorem 2: Unit weight DVDP is NP-hard for 6 > 1.
Proof: Let G be an instance of unit weight DVDP with 8 = 0. >From G construct an instance G'
of unit weight DVDP for the specified value, q, of 8 by attaching to each vertex of G a chain Hq
of q vertices (see Figures 4 and 5). LetXbe a solution to the DVDP problem on G with 8 0 and
let X' be a solution to the DVDP problem on G' with 8 = q. We shall show that IXl = IX' I.
Since d(G-X) = 0, d(G'-X) < q. Hence, IX' I < IXi. IfX' contains a vertex w that is not in G
then let v be the vertex of G to which the Hq that contains w was attached in the construction of
G'. LetX" =X' {w} + {v}. It is easy to see that d(G'-X") < q and |X" *
*
since X' is a minimal set such that d(G'-X') < q, \X" I = IX' I. In this way we can transform X'
to X* such that d(G'-X*) < q, IX' = IX* I, and X* consists solely of vertices of G. So,
d(G-X*) = 0. Hence, IX' I = X* 2 Xi. Consequently, IX' = |Xi. >From this, the observa-
tion that G' can be constructed from G in polynomial time, and the fact that unit weight DVDP
with 8 = 0 is NP-hard, it follows that the unit weight DVDP with 8 = q for any q 2 1 is NP-hard.
O
(a) Chain with 6 vertices
Figure 4: Variable subassembly for DVDP.
(a) A node in a graph
(b) After attaching H6
Figure 5: Attaching Hg to a node.
3.2 DVSP For Unit Weight Multistage Graphs
A Imilti.ta"ge graph is a wdag in which the vertices are partitioned into stages and each
edge connects two vertices in adjacent stages. An example is given in Figure 6.
(b) Schematic
Figure 6: Example multistage graph.
To show that DVDP for multistage graphs is NP-hard, we use the NP-hardness of the prob-
lem 2-3SAT [PAIK90] defined as:
Input: A boolean function F =C1 C2 '. Cn in n variables x1, x2 ..., xn. Each clause C,
is the disjunction of either two or three literals. If I C, = 2, then both literals in C, are
either negated or unnegated. If I C, I =3, then at least one literal of C, is unnegated
and at least one is negated.
Output: "Yes" iff there is a truth assignment for the n variables such that F = 1. "No" other-
wise.
For each instance F of 2-3 SAT, we construct an instance GF of the unit weight DVDP such
that from the size of the solution to GF we can determine, in polynomial time, the answer to the
2-3SAT problem for F. This construction employs two types of unit weight wdag subassemblies:
variable and clause.
Variable Subassembly
The variable subassembly, VS(i), for variable x, is given in Figure 7(a). This is obtained by
combining together three copies of the chain H_-1 with another dag that has four vertices. Thus,
the total number of vertices in the variable subassembly VS(i) is 36 + 1. Note that d(VS(i)) = 8
+ 1. Also, note that if d(VS(i) -X) 86, then IXI 2 1. The only X for which IXI = 1 and
d(VS(i) -X) < 8 are X= { x, } andX= { x }. Figure 7(b) shows the schematic for VS(i).
Clause Subassemblies
We will use two different clause subassemblies depending on the size of clause Cj in the
2-3SAT instance F. In case I C, = 3, the clause subassembly CS3(j) as in Figure 7(c) is used.
The schematic for CS3(j) is given in Figure 7(d). The number of vertices in CS3(j) is 66 + 1 and
d(CS3(j)) = 26. One may easily verify that if IXI = 1, then d(CS3(')-X) > 6 So, if
d(CS3(j) -X) 86 ,then IXI > 1. Since 6 2 2, the onlyXwith IXI = 2 for which d(CS(j) -X) <
6 are such that Xc {1j, l, 3}. Furthermore, every Xc {lji, l, 3} with IXI = 2 results in
d(CS3(j) -X) 6. If I C, = 2, the clause subassembly CS2(j) as in Figure 7(e) is used. The
schematic for CS3(j) is given in Figure 7(f). The number of vertices in CS2(j) is 26 + 3 and
d(CS2(j)) = 6 + 1. One may easily verify that if IXI = 1 and d(CS2(j) -X) 6 ,then X c
{j 1 j 1 2}
To construct GF from F, we use n VS(i)'s, one for each variable x, in F and q CS2(j)'s, one
for each clause C, in F with I C I = 2 and m-q CS3(j)'s, one for each clause Cj in F with I Cj I =
3, where q is the number of the clauses of size 2. In case I C, I = 2, a modified CS2(j), subassem-
bly as in Figure 8(a) is used. Connections from varible subassemblies will be made to the ver-
tices labeled u, 1 and uJ 2. If C = 3, then a modified CS3(j) is used. This modification is now
described. Suppose the literals in Cj are ordered so that the unnegated ones come first. If CJ has
two unnegated literals, use the clause subassembly of Figure 8(b). Otherwise, use that of Figure
8(c). There is a directed edge from vertex x, (xE) of VS(i) to vertex ujk of CS2(j) and CS3(j) iff
x, (x,) is the k'th literal of C, (we assume the three literals in Cj are ordered). Then the resulting
graph is a multistage graph. Figure 9 gives the GF obtained for the case F = (x1+x2 +4)
(X2 +X3 X4) (1 +X3) (X2+X3).
Figure9: GFforF= (X1+x2+x4) (X2 +X3+X) (X 3) (X 2 3).
The construction of GF can be done in polynomial time for any fixed 6.
Theorem 3: Let F be an instance of 2-3SAT and let GF be the instance of unit weight DVDP
obtained using the above construction. For 6 > 2, F is satisfiable iffthere is a vertex set X such
that d(GF -X) < 6 and IXI = n + 2m q, where m is the number of clauses in F and q is the
number of two literal clauses in F.
(b) Schematic
1
1j3
H6-2
H8_a) VS(i)1
H6-2
H-2c) CS3(j) for CI= 3
H6-2
O c1
O
^0
(e) CS2(j) for I C = 2
(d) Schematic
2
0(f) Schematic
2 0_ CS2cm )
(f) Schematic
Figure 7: Subassemblies for DVDP multistage graph.
Proof: IfF is satisfiable then there is a binary assignment to the x,'s such that F has value 1. Let
b 1,b 2, ... b, be this assignment. Construct a vertex set Xin the following way:
II 1
uj 30
0-0- CS3(j)
0-0-
(b) Two unnegated literals
1
7 1
Uz2 3
UJ30_ CS30()
0-0-
(c) One unnegated literal
Figure 8: Modified clause subassemblies.
1. x, is inXifb, = 1. If b, = 0, then x, is inX.
2. >From each CS3(j) add exactly two of the vertices lj1, l 2, j 3 to X and from each
CS2(j) add exactly one of the vertices 1j 1, l 2 to X. These are chosen such that the
literal corresponding to the vertex not chosen has value 1. Each clause has at least
one literal with value 1.
We readily see that IX = n + 2m q and that d(GF -X) < 6.
Next, suppose that there is an X such that IXI = n + 2m q = n + 2(m-q) + q and
d(GF -X) < 6. >From the construction of the variable and clause assemblies and from the fact
that IXI = n + 2m q, it follows that Xmust contain exactly one vertex from each of the sets {x,,
x}, 1 i < n, exactly 2 from the sets {1, j2, 1,3} of each of the m-q CS3(j)'s and exactly 1
from the sets {l 1, j2} of each of the q CS2(j)'s. Hence there is no i such that both x, E Xand x,
E X, there is no j for which l, 1 E Xand 1, 2 E Xand 1, 3 E Xif I Cj I = 3 and there is no j for which
1,1 E Xand 2 e Xif I Cj I = 2. Consider the Boolean assignment b, = 1 iffx, e X. Suppose that
u, 1 =1
0-
Uj 2 11
0-0-
o-
(a) |C, =2
Ijk V Xand ljk = x, (x5). Since d(GF -X) < 6, vertex x, (xE) must be removed as otherwise there
is a source to sink path with delay greater than 6. So, x, (xE) E Xand b, = 1 (0). As a result, the
k'th literal of clause Cj is true. Hence, b ... b, results in each clause having at least one true
literal and F has value 1. O
4 Tree DVDP
In this section we develop a linear time algorithm for the DVDP when the wdag G is a rooted
tree. The algorithm is a simple postorder [HORO90] traversal of the tree. During this traversal
we compute, for each node x, the maximum delay, D (x), from x to any other node in its subtree.
IfD (x) exceeds 6, the node x is deleted from G.
a a a
b d d d
Z4 g 4 4
3/ \1 3/ \1
2 2
(a) (b) (c)
Figure 10: An example tree.
Consider the example tree of Figure 10(a) and assume 6 = 3. The delay, D (x), for x a leaf
node is 0. So, D (x) = 0 for x e { e f, c j i }. In postorder, a node is visited after its children
have been. When a node x is visited, its delay may be computed as:
D(x)= max { D(y) +w(x,y)}
y is a child ofx
So, D(b) = 4 and D(h) = 2. Since D(b) > 8=3, we delete node b to get the tree of Figure 10(b).
Next, D (g) = 5 is computed and node G is deleted resulting in the tree of Figure 10(c). D (d) = 0
and D(a) = 3. No more nodes are deleted. The formal algorithm is given in Figure 11. The
algorithm assumes thatXhas been initialized to 0.
Theorem 4: Procedure DVDPtree finds a minimum cardinality X such that d(T-X) < 6.
Proof: The proof is by induction on the number, n, of nodes in the tree T. Ifn = 0, the theorem is
trivially valid. Assume this is so for n < m where m is an arbitrary natural number. Let T be a
tree with n + 1 nodes. Let X be the set of vertices deleted by DVDPtree and let W be a
minimum cardinality vertex set such that d(T-W) < 6. We need to show that XI = I W If lXI
= 0, this is trivially true. If lXi > 0, then let z be the first vertex added to Xby DVDPtree. Let
Tz be the subtree of T rooted at z. As z is added to X by DVDPtree, D (z) > 6. Hence, W must
contain at least one vertex u that is in Tz. If W contains more than one such u, then W cannot be
of minimum cardinality as Z = W- { all such u } + {z} is such that d(T-Z) 6. Hence, Wcon-
tains exactly one such u. Let W' = W {u}. Let T' = T T, be the tree that results from the
removal of T, from T. If there is a W* such that W* I < I W' and d(T'-W*) < 6, then since
d(T-W*- {z}) 6, Wis not a minimum cardinality deletion set for T. So, W' is a minimum car-
dinality vertex set such that d(T'-W') < 6. Also, X' = X {z} is such that d(T'-X') < 6 and
furthermore X' is the answer produced by DVDP-tree when started with T'. Since the number of
vertices in T' is less than m + 1, X'l = I W'l. Hence, |XI = IX'l + 1 = I W'l + 1 = I WI. O
procedure DVDPtree(T);
{Find minimum cardinality X such that d (T-X) < 8}
{Assume that Xis initialized to 0}
begin
if T< >nil
then begin
D (T)= 0;
for each child Yof T do
begin
DVDPtree(Y);
if Y X
then D(T):= max {D(T), D(Y)+w (T,Y)};
end;
if D (T) > 6 thenX:=Xu {T};
end;
end; {ofDVDP tree}
Figure 11: DVDP algorithm for trees.
The complexity of procedure DVDP tree is easily seen to be O (n) where n is the number
of vertices in T.
5 Series-Parallel DVDP
5.1 Definitions
A series-parallel digraph, SPDAG, may be defined recursively as:
1. A directed chain is an SPDAG.
2. Let s and t1, respectively, be the source and sink vertices of one SPDAG G1 and let 2
and t2 be these vertices for the SPDAG G2. The parallel combination of G1 and G2,
G1/G2, is obtained by identifying vertex s with 2 and vertex t1, with t2 (Figure 12(c)).
G1/G2 is an SPDAG. We restrict G1 and G2 so that at most one of the edges < sl,tl>,
< s2,t2> is present. Otherwise, G//G2 contains two copies of the same edge.
3. The series combination of G1 and G2, G1G2, is obtained by identifying vertex tl with S2
(Figure 12(d)). G1G2 is an SPDAG.
For any SPDAG G and delay values 6, 1 6 and r < 8, let S(l,r,G) be a minimum cardi-
nality vertex set such that:
(C1) The length of every path in G-S(l,r,G) that begins at the source of G is I
(C2) The length of every path in G-S(l,r,G) that ends at the sink of G is r
(C3) The length of every path in G-S(l,r,G) is 6
IfS(l,r,G) contains the source (sink) of G, then, by convention, 1 (r) has value 1. Figure
13(a) gives an example. Here, l = 2, r = 1, and 6= 4. For these values of of 1, r, and 6, S = {v 1,
v2, V3} and G-S(l,r,G) is as in Figure 13(b). One may verify that there is no smaller size vertex
set that satisfies the requirements on S.
SI tl S2 t s G t
G >G2
(a)G1 (b) G2 (c)G 1G2
sl G1 G2 t2
(d) G1G2
Figure 12: Series-parallel digraph.
Let f(G) = { (l,r, IS(l,r,G)I ) -1< 1,r <6 }. Let (1 ,rl ,kl) and (2 ,r2,k2) be two
different triples inf(G). (11 ,r ,k1) dominates (12 ,r2 ,k2) iffll/12, rlr2, and k1k2. We shall
develop an algorithm to compute the set, F(G) of nondominated triples off(G). Let (l,r,z) be
the triple in F(G) with least third coordinate z. It is easy to see that the DVDP for G has a solution
of size z. This solution may be found by modifying our algorithm so that each triple includes not
just IS(l,r,G) but also S(l,r,G).
Our algorithm to compute F(G) is specified recursively and is based on the recursive
definition of SPDAGs.
(a) Series-parallel graph G
10
0<2
O0
4
0 O1
0)-
(b) G-S (, r,G)
Figure 13: An example
5.2 G is of the form G1G2
When G is the series combination of G1 and G2, F(G1G2) can be obtained from F(G1)
and F(G2) by using the following lemma.
Lemma 3: If (l,r,k) e F(G1G2), then there is an (11,r ,k1) e F(G1) and an (2 ,r2 ,k2) E
F(G2) such that S(l1 ,rl ,G1) = S(l,r,G1G2) n V(G1), S(12 ,r2 ,G2) = S(l,r,G1G2) n V(G2),
S(l,r,G1G2) =S(l, ,r, ,G,) u S(12 ,r2 ,G2),k1 = IS(l ,r, ,G)I, k2 = IS(12 ,r2 ,G2)I, and k
= IS(l,r,G1G2)I
Proof: Let A = S(l,r,G1G2) r V(G1) and B = S(l,r,G1G2) r V(G2). Clearly, S(l,r,G1G2) =
A uB. Let 11 and r be the least values such that:
a) The length of every path in G 1-A that begins at the source of G1 is < 11 (in case the source
of G1 is in A, let 11 = 1 ).
b) The length of every path in G1-A that ends at the sink of G1 is < r (in case the sink of G1
is in A, let rl = 1).
Note that no path in G1-A has length > 6,11 1i 6, and r1 < 8. So, if (i ,r ,kl=IA ) a
F(G1), then F(G1) must contain a triple that dominates (11 ,r1 ,k1). Let (l',r',k') be such a tri-
ple. If ri = 1, r' = rl sink(G1) = source(G2) e A, and sink(G1) E C = S(l',r',G1). So,
CuBI = k' + B 1 and A uB = JA + B 1. Ifrl 1, sink(G1) v A and
source(G2) B. So, ICuBI =k'+ B I and IA uBI = IA I + IB Furthermore, letl* and r*
be the least values that satisfy a) and b) above with G1 replaced by G1G2 1i by 1*, r1 by r*,
and A by Cu B. It is easy to see that no path in G1G2 -C uBhas length > 8, l* l/, r* < r and
IC uB I < A uB So, (l*,r*, ICuB I ) dominates (l,r,k) and so (l,r,k) V F(G1G2). A con-
tradiction. Hence, (11 ,rl ,kl) F(G1). We can show (12 ,r2 ,k2 IB I) e F(G2) similarly. O
Lemma 3 suggests the following approach to obtain F(G1G2) from F(G1) and F(G2):
Step 1: Construct a set Z of triples such that F(G1G2) c Z. This is obtained by considering
every pair (I1 ,r ,k1) and (12 ,r2 ,k2) of triples such that:
1) (/ ,r1 ,k ) F(Gi) and (12 ,2 ,k2) F(G2)
2) S(l,r,G1G2) = S(11 ,r ,G1) u S(12 ,r2 ,G2) satisfies C1, C2 and C3 and I and
r are as small as possible. The triple (l,r, I S(l,r,G 1 G2) i) is added to Z
Step2: Triples in Zthat are dominated by other triples in Z are deleted.
To implement step, we need to consider several cases for (11 ,rl ,kl) and (12 ,r2 ,k2).
These are considered below. To determine which case applies, the case conditions are tested
sequentially in the order listed and the first one satisfied is the one that applies.
LetA =S(11 ,rl ,G1),B=S(12 ,r2 ,G2) and C=A uB.
Case :12 r 1 -1
Now, (11 ,r2 ,I C |) satisfies conditions C1 C3. Since A B = sink(G1) = source (G2), I C =
kl + k2- 1. Hence, (1 ,r2 ,kl + k2- 1) is a candidate forF(G1G2).
Case 2: kl = k2 = 0
When k = k2 0,A =B =C = 0. Since G1 and G2 are connected graphs, we have l = r1 and
12 r2 and d(G1G2) 1= 1 2. So, if l + 12 > 6, C does not satisfy conditions C1, C2, and C3.
On the other hand, if1 + 12 < 6, C satisfies these conditions and ( 1 + 12 + 12 ,0) is a candi-
date for F(G1G2).
Case3: k = 0,k2 0
If/2 =- 1, then since A = 0 source (G2) = sink(G1) v A and A uB is not a valid vertex dele-
tion set for G1 G2 So, assume 12 1. Now, in G1 G2 C the longest path from the source has
length rl + 12 = l + 2. So, if1 I + 2 > 6, condition C1 is not satisfied. Hence, we require
ll + 12 8 In this case (11 + 12 ,r2 ,k2) is a candidate forF(G1G2).
Case4: kl 0,k2 =0
This is similar to Case 3. For C to be a valid deletion set, we require rl 1 1 and r + r2 .
When this is the case (11 ,rl + r2 ,k1) is a candidate for F(G1G2).
Case 5 : everything else
Now, kl 0 and k2 # 0 Ifrl r 1, then I1l 1 as otherwise we are in Case 1. However, rl
- 1 implies sink(G1) E A and 12 # 1 implies source(G2) < B Since sink(G1) =
source (G2), C = A u B is not a valid deletion set for G 1G2. So, if r = 1 we must have 12 -
1 and be in Case 1. For Case 5, therefore, we may assume r1 # 1 and 12 # 1. Now, the long-
est path in G1G2 C from the source vertex has length 11 and the longest path to the sink has
length r2. If/2 + rl < 6, C satisfies C1-C3 and (/1 ,r2 ,kl + k2) is a candidate for F(G1G2).
The above discussion results in the algorithm of Figure 14. The notation F(G1G2) @
(l,r,k) means the set that results from adding (l,r,k) to F(G1G2) and deleting all dominated tri-
ples.
5.3 G is of the form G1 G2
Lemma 4: If(l,r,k) e F(G1 G2), then there is an (11 ,rl ,kl) e F(G1) and an (12 ,r2 ,k2)
F(G2) such that S(1 ,rl ,G1) = S(l,r,G1 G2) n V(G1), S(2 ,r2 ,G2) = S(l,r,G1iG2) n
V(G2), S(l,r,G1iG2) = S(ll,rl,G1) u S(12,r2,G2), k1 = IS(l ,r ,G1)|, k2
IS(12 ,r2 ,G2),andk = IS(l,r,G G2)I.
Proof: Similar to that of Lemma 3. O
For every pair (11 ,ri ,k1) e F(G1) and (12 ,r2 ,k2) e F(G2), we need to consider the fol-
lowing cases. A, B and C are defined as in the discussion for F(G1G2).
Case l:I 12 -1 ,rl1 r2 -1
Since A rB = { source (G) sink(G1) } = { source (G2) sink(G2) }, ICI = k + k2-2 and
(- 1 ,- 1 ,kl + k2- 2) is a candidate forF(G1 G2).
Case 2 : 11 2 1
Now, I CI =k + k2- 1. Ifr 1 orr2 = 1, then the resulting triple is (- 1,- 1,kl k2- 1)
which is dominated by a triple from Case 1. So, we need only consider the case r 2 0 and
r2 0. In this case the candidate triple forF(G1 G2) is (-1 max {rl ,r2} ,k + k2- 1).
Case 3: r1 r2 1
This is similar to Case 2 and we require 11 2 0 and 12 2 0. The candidate triple for F(G1 G2) is
F(G1G2)=
for every (11 ,r1 ,k ) e F(G1) do
for every (12 ,r2 ,k2) e F(G2) do
case
:12 -rl -1:
F(G1G2) =F(G1G2) 0 (/ ,r2 ,kl + k2- 1)
:kl k2 = 0and 1 + 12 :
F(G1G2) =F(G1G2) (11 +2 11 + 2 ,0)
: k = andk2 O and 2 -1 andl + 12 6 :
F(G1G2) =F(G1G2) 0D /1 + /2 ,2 ,k2)
:kl 40 andk2 = and r -1 andrl +r2 :
F(G1G2) =F(G1G2) 0 (/i ,1r + 72 ,kl)
:kl 40 andk2 0 and r1 -l and12 -l and r1 +/12 :
F(G1G2) =F(G1G2) (1i ,r2 ,kl + k2)
endcase
Figure 14: Algorithm forF(G1G2).
(max{/ ,12} ,-1 ,kl + k2- ).
Case 4 : everything else
We need only consider the case when 11- 1, 12 1, r1 1 and r2 4- 1. Now,
(max{ll ,12} max{r1 ,r2} ,kl + k2). is a candidate for F(G1 IG2). The resulting algorithm is
given in Figure 15.
F(G1 /G2)=0
for every (11 ,r1 ,k1) e F(G1) do
for every (12 ,r2 ,k2) e F(G2) do
case
1: = 12 -1 and r r2 -1
F(G1//G2) =F(G1//G2) e (-1,-1 ,kl + k2-2)
1: = 12 = -1 and rl #-1 and r2 #-1:
F(G1//G2) =F(G1//G2) (-1 max {r1 ,r2 } ,k + k2- 1)
: rl r2 -1 and / -1 -and/2 -1:
F(G1//G2) =F(Gi//G2) ( (max { ,12 } ,-1 ,kl + k2- 1)
: 11 -1 and 2 -1 andrl -l1 andr2 #-1:
F(G1//G2) =F(G1//G2) @ (max {1 ,12 }, max {r ,r2 } ,kl + k2)
endcase
Figure 15: Algorithm for F(G1//G2).
5.4 G is a chain
If G has only two vertices u and v, then F(G) is : {(- 1,- 1,2), (- 1,0,1), (0,- 11)} when
w (u,v) > 6 and {(- 1,- 1,2), (- 1,0, 1), (0,- 1,1), (w (u,v),w (u,v),0)} when w (u,v) < 6.
If G has more than two vertices, then G is of the form G1G2 and F(G) may be obtained
using the algorithm forF(G1G2) (Figure 14).
A simpler algorithm for F(G) results by considering procedure Greedy (Figure 16). This
procedure considers a chain C = i, i +1 - ,j and determines a minimum cardinality vertex
set X such that C-Xhas no path of length > 6. The algorithm for F(G) when G is the chain 1,2,
...,n is given in Figure 17. This algorithm tries all candidates for the leftmost vertex in S(l,r,G).
Once a candidate is selected, the remaining vertices in S(l,r,G) may be obtained using pro-
cedure Greedy.
5.5 Analysis
The correctness of the algorithms for F(G1G2), F(G //G2), and F(chain) follows from the
discussions in Sections 5.2, 5.3, and 5.4. For the complexity analysis, we need the following
lemmas.
Lemma 5: Let G be an arbitrary SPDAG. G is formed by performing some number of parallel
and series combinations on directed chains. Let p be the number of parallel combinations per-
formed. Let (l,r,k) e F(G) and n = V(G) The number of different values for I is at most
n+p+1.
Proof: Let L be the set of different values for I. We shall show that I L {0, 1} n + p 1.
The proof is by induction on n. When n = 2, p = 0 and I L {0, 1} I| 1. Assume that
procedure Greedy (i, j, 1, r, X);
{ Find least cardinality X such that no path in the graph C-Xhas
length > 6. C is the chain i, i +1, - ,j, I is the length of the
leftmost component of C-X and r that of the rightmost component }
begin
X= 0; Agl/ := 0; /:=- 1; r:=- 1;
for a= i + 1 toj do
if ,Agl + w (a-l,a) > 6
then begin
X:=XU {a};
if I:= -thenl:=! L ~g i,
if a < j then ,l := -w(a,a 1);
end;
else !,A gtl = !, igsrl + w (a-l,a);
r:= iL glb,
if X= 0 then 1:= r;
end;
Figure 16: Algorithm for least X.
SL- {0, 1} I n + p 1 for all SPDAG's with n < m vertices. We need to show that
I L {0, 1} I ) m +p for all SPDAG's with m + 1 vertices. Let G be one such SPDAG. If G
procedure Chain(n);
{ Obtain F(G) for G an n vertex chain 1,2,... n }
begin
{ special cases }
Greedy (2, n-1, 1, r,X)
F(G):= (- 1, IXI + 2);
Greedy (1, n-1, 1, r,X)
F(G):= F(G) (1, 1, IXI + 1);
Greedy (2, n, 1, r, X)
F(G):= F(G) @ (- 1, r, IXI + 1);
{ remaining cases }
:= 0; a:=2;
while I < 6 and a < n do
{a is leftmost vertex in S(l,r,G)}
begin
Greedy (a+1, n, b, r,X);
F(G):= F(G) @ (1, r, IX + 1);
1:= l+w(a-l,a);
a:= a +1
end;
if a = n and l+w (a-l,a) < 6
then
F(G):= F(G) @ (l+ w (a-l,a), I+ w (a-l,a), 0);
end;
Figure 17: Algorithm for F(G) wnen G is a chain.
is a chain, then L {0, 1} I m andp = 0. If G = G1G2, then let n and n2, respectively, be
the number of vertices in G1 and G2 and letp 1 and p 2 be the number of parallel combinations
in G1 and G2. Clearly, p =p +p 2,n = n + n2 1, n 1 < m, and n 2 m. >From the induction
hypothesis it follows that:
L- {0,-1} | 1 |IL-{0,-} | + IL2-{0,-1}
(L 1 and L2 are, respectively, the number of different 1
values in F(G ) and F(G2))
n1 +pl-l+ n2+ 2-
(n 1 +n2-1) +(P 1 +2)-
=n+p-1.
IfG= G1/G2,thenp=p 1 +P 2+ 1 andn =n +n2 -2. If n > 2 andn2 > 2, then n
n'2 m and the induction hypothesis yields:
IL-{0,-1} I| ILi-{0,-l} + |L2-{0,-1} |
nf1 +pl-l+2+ 2-1
(n1 +n2-2 +2) +(p 1 +P2 + 1-1)-2
=n+2+p-1-2
=n+p-1.
If n = 2, then n2 = n = m + 1 and the induction hypothesis cannot be used on G2. If G2
G3G4, then the above proof for a series combination implies that I L2 {0,- 1} | <
n2 + 2 1. If G2 = G3//G4, then from the definition of an SPDAG and the fact that n 1 = 2, it
follows that n3 > 2 and n4 > 2. Hence, the preceding proof for this case implies that I L {0, -
1} I n2 +P 2 1 So, regardless of whether G2 = G3G4 or G3//G4, I L2 {0, 1} |
n2 +P 2 1. Hence, I L {0, 1} I n1 +p 1 -1 +n2 +P2-1 n +p 1. The prooffor
the case n 2 = 2 is similar. O
Corollary 2: The number of different values for I is at most 2n.
Proof: Follows from Lemma 5 and the fact that p < n 1. O
Lemma 6: Let (1 ,rl ,kl) and (1 ,r2 ,k2) be two different triples in F(G). The following are
true:
(a) Ikl-k21 =
(b) r, =-lorr2 =-
(c) Ifr1 =-1, thenr2 0andkl =k2 +
(d) Ifr2 =-1, thenr1 0andk2=kl + 1
Proof: If k = k2 then one of the triples dominates the other and so one should not be in F(G).
Assume that kl > k2 Since neither triple dominates the other, it must be that r1 < r2 and r2 >
0. Hence, sink(G) v S(l, r2 ,G). By adding sink(G) to S(l, r2 ,G) we get a triple (1, -1, k2+1)
which dominates (1 ,r ,k1) unless rl = 1 and kl = k2 + 1 A similar reasoning for the case k
Lemma 7: | F(G) I < 2n + 2 where n = V(G) |.
Proof: F(G) contains one triple of each of the types : (-1, 1, k1) ; (- 1,r, k2), r > 0 ; and
(1, 1, k3), 1 0. Note that k2 = k3 = kl 1 and that these are the only triples in F(G) that have
a first or second coordinate value of 1. >From Corollary 2, there are at most 2n distinct first
coordinate values in F(G) and at most 2n 1 of these are 2 0. >From Lemma 6, corresponding
to each of these at most 2n 1 values there is only one second coordinate value that is 2 0.
Hence, there are at most 2n 1 triples in F(G) for which neither the first nor the second coordi-
nate is 1. So, the total number of triples in F(G) is at most 2n + 2. O
Lemma 8: Let (1i ,r,k1) and (12 ,r,k2) be two different triples in F(G). The following are true:
(a) Ikl-k21 =
(b) 11 =-lor2 =-1
(c) If/ =-1, then 12 0 and k =k2 + 1
(d) If2 =-1, then 2O andk2 =kl 1
Proof: Similar to that of Lemma 6. O
Lemma 9: Let (11 ,r ,k1) and (12 ,r2 ,k2) be two triples in F(G). Then, Ik1-k2 1 2.
Proof: F(G) contains a triple (- 1, 1, k). If k1 < k 2, then S(11 ,rl ,G) u { source (G) ,
sink(G) } results in a triple (- 1, 1, k1 +2) which dominates (- 1, 1, k). So, k k -2. Simi-
larly, k2 k k-2. Also, k1I k and k2 k. Hence, Iki-k21 2. O
Lemma 10: Let (11 ,r ,k1) and (12 ,r2 ,k2) be two triples in F(G) such that 11 rl 12 r2 -
1. Ifk < k2, then /l > 12 and r > r2 .
Proof: Assume that kl < k2 and 11 / 12 If(l1 ,-1 ,kl+l) e F(G), then (11 ,-1 ,k+l) dom-
inates (12 ,r2 ,k2) and so (12 ,r2 ,k2) a F(G). A contradiction. If(11 ,-1 ,kl+l) V F(G), then
(11 ,-1 ,kl+1) is dominated by some triple in F(G) and this triple dominates (12 ,r2 ,k2). So,
(12 ,r2 ,k2) v F(G). A contradiction. Hence, if k < k2 then 11 > 12 Similarly, if k < k2 ,
then rI > r2 O
Lemma 10 suggests organizing F(G) into three lists F(G)-A, F(G)-B, and F(G)-C. F(G)-A
contains the triples with first or second coordinate equal to 1. IF(G).A | < 3. Let (- 1, 1, k)
be a triple in F(G). Then F(G)-B contains all triples with third coordinate k 1 and F(G)-C con-
tains those with third coordinate k 2. The lists B and C are kept in increasing order of their first
coordinate. This simultaneously results in the lists being in decreasing order of their second
coordinate.
(10, 4) i j 4 (10, 5)
(8, 5) (9, 6)
(6, 6) (7, 7)
(3,8) (4,8)
(2,9) (3,9)
(1,10) (2,10)
F(G1)-B
F(G2).B
k=5
(6, 8)
(3, 10)
G1G2
Figure 18: Example F(G1).B and F(G2).B
To compute F(G1G2) we consider triple pairs tl t2 such that tl E F(G1)X and t2 E
F(G2)Y where X, Ye { A, B, C }. This can be done in the orderXY= AA, AB, AC, BA, BB, BC,
CA, CB, CC. Suppose we are considering the case XY= BB and kl 1 0 and k2 # 0. Example
F(G1)-B and F(G2)B are given in Figure 18. This figure only shows the I and r values of each
triple as the k values are the same for all triples in F(G1)B and also for all in F(G2)B. Assume
that 6 = 10. Combining tl e F(G1).B and t2 e F(G2)B is feasible only if ri + 12 < 6. The
resulting triple is (11 ,r2 k+k2 =5). Start two pointers i and j at 1. Pointer i moves through
F(G1)-B and pointer j moves through F(G2)B. Since the triples i and point to have rl + 12 = 4
+10 = 14 > 6, this is an infeasible pair. Also, since r values increase as you go down F(G1)B,
none of the remaining triples of F(G 1)B can combine with the j'th triple of F(G2)B. So, we
advance j to the next triple of F(G2)B. Again, r1 + 12 > 6 and j is advanced further. When j =
4, rl + 12 = 8 and we get the first feasible pair t1 t2 which results in (10, 8, 5). Since rl + 12 <
6, t2 may combine with other triples ofF(G1)-B. i is advanced and we get r1 + 12 = 5 + 4 = 9 <
6. The new triple is (8, 8, 5), which dominates the previous triple (10, 8, 5). i is advanced again
and we get rl + 12 = 6 + 4 = 10. This results in the triple (6, 8, 5) which dominates (8, 8, 5). If
is advanced to 4, the t t2 combination is infeasible and so (8, 8, 5) cannot be dominated by any
other combination from F(G1)-B and F(G2)B. (6, 8, 5) is entered into an output table. Now, i =
4 and = 4 and tl t2 is infeasible. j is advanced to 5 and then to 6. At this point, rl + 12 = 8 + 2
= 10. If i is advanced to 5, tl t2 is infeasible. So, (3, 10, 5) is not dominated by other triples and
added to the output. Now i = 5 and j = 6. j cannot be advanced further and we are done combin-
ing F(G1)-B and F(G2)-B. The time required is O( IF(Gi)-BI + IF(G2).B ) as the i and j
pointers advance in one direction only and following each computation of ri + 12 either i or j
advances.
All other pairs XY can similarly be handled in time O( IF(G1).X + IF(G2)YI ). The
outputs from each XY pair can finally be merged to get F(G 1G2) A, F(G 1G2)B, and F(G 1G2)C
in linear time. >From Lemma 7, IF(G1G2)I < 2n + 2, IF(G1)I 2n 1 + 2, IF(G2) < 2n2 + 2
where nl = V(G1)l, n2 = IV(G2)I, and n = nl + n2 1 = V(G1G2)I. Hence, the time to
compute F(G1G2) given F(G1) and F(G2) is O(n).
Suppose we are computing F(G1//G2). Consider combining pairs tl t2 such that XY = BB
and F(G1)B and F(G2)B are as in Figure 18. For each tl e F(G1)-B we find a triple t2 E
F(G2)-B such that max { 1, 12 = 1 and max { r r2 } is as small as possible. For this, we use
pointers i and as in the computation ofF(G 1G2). Initially, i =j = 1. Now, tl = (10, 4, 2) and t2
= (10, 5, 3). Since 12 l11, t t2 results in the triple (10, 5, 5). max { rl, r2 } cannot be made any
smaller by changing t2 as the remaining r values in F(G2)B are larger than 5. Next consider i =
2. Now, t1 = (8, 5, 5) and t2 = (10, 5, 5). Since 12 > 11, we advance j to the first triple of
F(G2)-B for which 12 11. This results in = 3 and t2 = (7, 7, 5). The created triple is (8, 7, 5).
Again, r cannot be reduced by considering another t2 in F(G2)B. Next, we consider i = 3, tl =
(6, 6, 2). 12 > 11 and j is advanced to 4. This gives the triple (6, 8, 5). When i = 4, is advanced
to 5 to get the triple (3, 9, 5). Next, i = 5 and is advanced to 5 to get (2, 10, 5). When i = 6, no
triple is created. The triples created, in order, are (10, 5, 5), (8, 7, 5), (6, 8, 5), (3, 9, 5), and (2, 10,
5).
Next, for each t2 e F(G2)-B we find a triple tl e F(G1)B such that max { 11, 12 = 2 and
max { r r2 } is as small as possible. This results in the triples (10, 5, 5), (9, 6, 5), (7, 7, 5), (4, 8,
5), (3, 9, 5), (2, 10, 5). Finally, the two sets of triples are merged. During the merge, dominated
triples are eliminated. We get (10, 5, 5), (9, 6, 5), (7, 7, 5), (4, 8, 5), (3, 9, 5), and (2, 10, 5).
The time required is O( IF(G1)-BI + IF(G2)-B ). As in the case of F(G1G2), the
remaining cases can also be handled in linear time and the total time to compute F(G1//G2) from
F(G1) and F(G2) is (n). For a chain, F(G) is easily computed in (n) time. Since an n vertex
SPDAG involves fewer than n series and parallel subgraph combinations, F(G) can be computed
in O(n2) time using the method described above for F(G1//G2) and F(G1G2).
6 Conclusions
We have shown that the unit weight DVDP problem is NP-hard for every 6 ,6 2 0. Furthermore
the problem remains NP-hard for 6 2 2 when the wdags are restricted to be unit weight multistage
graphs. For trees we have developed a linear time DVDP algorithm and for series-parallel graphs
with n vertices we have developed an O(n2) time algorithm. Our algorithm for series-parallel
graphs is easily adapted to solve the wdag vertex splitting problem [PAIK90] for series-parallel
graphs in O(n2) time. For general graphs, the heuristics proposed in [PAIK90] for the vertex
splitting problem may be adapted to the DVDP problem.
7 References
[GARE79] M. R. Garey, and D. S. Johnson, "Computers and Intractability", W. H. Freeman
and Company, San Francisco, 1979.
[HOR078] E. Horowitz, and S. Sahni, "Fundamentals of Computer Algorithms", Computer
Science Press, Maryland, 1978.
[HORO90] E. Horowitz, and S. Sahni, "Fundamentals of Data Structures in Pascal", Computer
Science Press, Maryland, 1990.
[KRIS79] M. Krishnamoorthy and N. Deo, "Node deletion NP-complete problems", SIAM Jr
on Computing, Vol 8, No 4, 1979, pp 619-625.
[PAIK90] D. Paik, S. Reddy, and S. Sahni, "Vertex Splitting In Dags And Applications To
Partial Scan Designs And Lossy Circuits", University of Florida, Technical
Report, 1990.
*
* |