www.elsevier.com/locate/dam

## Path partition for graphs with special blocks

### 夡

### Jun-Jie Pan

a### , Gerard J. Chang

b*,c*

a* _{Department of Applied Mathematics, National Chiao Tung University, Hsinchu 30050, Taiwan}*
b

_{Department of Mathematics, National Taiwan University, Taipei 10617, Taiwan}c_{Mathematics Division, National Center for Theoretical Sciences at Taipei, Old Mathematics Building, National Taiwan University,}*Taipei 10617, Taiwan*

Received 8 January 2002; received in revised form 18 August 2003; accepted 18 March 2004 Available online 5 August 2004

**Abstract**

The path-partition problem is to ﬁnd a minimum number of vertex-disjoint paths that cover all vertices of a given graph. This paper studies the path-partition problem from an algorithmic point of view. As the Hamiltonian path problem is NP-complete for many classes of graphs, so is the path-partition problem. The main result of this paper is to present a linear-time algorithm for the path-partition problem in graphs whose blocks are complete graphs, cycles or complete bipartite graphs.

© 2004 Elsevier B.V. All rights reserved.

*Keywords: Path partition; Block; Complete graph; Cycle; Complete bipartite graph; Algorithm*

**1. Introduction**

*A path partition of a graph is a collection of vertex-disjoint paths that cover all vertices of the graph. The path-partition problem*
*is to ﬁnd the path-partition numberp(G) of a graph G, which is the minimum cardinality of a path partition of G. Notice that G*
has a Hamiltonian path if and only if*p(G)=1. Since the Hamiltonian path problem is NP-complete for planar graphs*[9], bipartite
graphs[10], chordal graphs[10], chordal bipartite graphs[14]and strongly chordal graphs[14], so is the path-partition problem.
On the other hand, the path-partition problem is polynomially solvable for trees[11,16], interval graphs[1,2,7], circular-arc
graphs[2,7], cographs[5,6,13], cocomparability graphs[8], block graphs[17–19]and bipartite distance-hereditary graphs[21].
For some references of related problems, see[3,4,12,15,20].

The purpose of this paper is to give a linear-time algorithm for the path-partition problem for graphs whose blocks are complete
graphs, cycles or complete bipartite graphs. For technical reasons, we consider the following generalized problem, which is a
*labeling approach for the problem.*

Suppose every vertex*v in the graph G is associated with an integer f (v) ∈ {0, 1, 2, 3}. An f-path partition is a collection P*
of vertex-disjoint paths such that the following conditions hold:

(P1) Any vertex*v with f (v) = 3 is in some path in P.*
(P2) If*f (v) = 0, then v itself is a path in P.*

(P3) If*f (v) = 1, then v is an end vertex of some path in P.*

*E-mail address:*gjchang@math.ntu.edu.tw(G.J. Chang).

夡_{Supported in part by the National Science Council under grant NSC90-2115-M002-024.}
0166-218X/$ - see front matter © 2004 Elsevier B.V. All rights reserved.

*The f-path-partition problem is to determine the f-path-partition numberp _{f}(G) which is the minimum cardinality of an f-path*

*partition of G. It is clear thatp(G) = p*

_{f}(G) when f (v) = 2 for all vertices v in G.*In the rest of this section, we review some terminology in graphs. A cut-vertex is a vertex whose removal results in a graph*
*having more components than the original graph. A block is a maximal connected subgraph without a cut-vertex. Notice that the*
intersection of two distinct blocks contains at most one vertex; and a vertex is a cut-vertex if and only if it is the intersection of
*two or more blocks. Consequently, a graph with one or more cut-vertices has at least two blocks. An end block is a block with*
exactly one cut-vertex.

**2. Path partition in graphs**

*The labeling approach used in this paper starts from the end blocks. Suppose B is an end block whose only cut-vertex is x.*
*Let A be the graphG − (V (B) − {x}). Notice that we can view G as the “composition” of A and B, i.e., G is the union of A and*

*B which meet at a common vertex x. The idea is to get the path-partition number of G from those of A and B.*

*In the lemmas and theorems of this paper, we use the following notation. Suppose x is a speciﬁed vertex of a graph H in which*

*f is a vertex labeling. Fori = 0, 1, 2, 3, we deﬁne the function f _{i}*

*: V (H) → {0, 1, 2, 3} by f*

_{i}(y) = f (y) for all vertices y except*fi(x) = i.*

**Lemma 1. Suppose x is a speciﬁed vertex in a graph H. Then the following statements hold.**

(1) *p _{f}*

_{3}

*(H)p*

_{f}_{2}

*(H)p*

_{f}_{1}

*(H)p*

_{f}_{0}

*(H).*(2)

*p*

_{f}_{1}

*(H)p*

_{f}_{0}

*(H)p*

_{f}_{1}

*(H) + 1.*(3)

*p*

_{f}_{2}

*(H)p*

_{f}_{1}

*(H)p*

_{f}_{2}

*(H) + 1.*

(4) *p _{f}*

_{3}

*(H) = min{p*

_{f}_{2}

*(H), p*

_{f}(H − x)}p_{f}(H − x) = p_{f}_{0}

*(H ) − 1.*(5)

*p*

_{f}(H)p_{f}_{1}

*(H) − 1.*

**Proof. (1) The inequalities follow from that an***f _{i}*-path partition is an

*f*-path partition whenever

_{j}*i < j.*

*(2) The second inequality follows from that replacing the path Px in anf*1*-path partition by two paths P and x results an*
*f*0*-path partition of H.*

*(3) The second inequality follows from that replacing the path PxQ in anf*2*-path partition by two paths Px and Q results an*
*f*1*-path partition of H.*

(4) The ﬁrst equality follows from that one is an*f*3*-path partition of H if and only if it is either anf*2*-path partition of H or*
*an f-path partition ofH − x. The second equality follows from that P is an f*0*-path partition of H if and only if it is the union*
of*{x} and an f-path partition of H − x.*

(5) According to (1), (3) and (4), we have

*pf(H)pf*3*(H ) = min{pf*2*(H), pf(H − x)} min{pf*1*(H) − 1, pf*0*(H) − 1} = pf*1*(H ) − 1.*
**Lemma 2. (1)***p _{f}(G) min{p_{f}(A) + p_{f}*

_{0}

*(B) − 1, p*

_{f}_{0}

*(A) + p*

_{f}(B) − 1}.(2)*p _{f}*

_{2}

*(G)p*

_{f}_{1}

*(A) + p*

_{f}_{1}

*(B) − 1.*

**Proof. (1) Suppose***P is an optimal f-path partition of A, and Q an f*0*-path partition of B. Thenx ∈ Q and so (P ∪ Q) − {x} is*
*an f-path partition of G. This givesp _{f}(G)p_{f}(A) + p_{f}*

_{0}

*(B) − 1. Similarly, p*

_{f}(G)p_{f}_{0}

*(A) + p*

_{f}(B) − 1.(2) The inequality follows from that if*P (respectively, Q) is an optimal f*1*-path partition of A (respectively, B) in which*
*P x ∈ P (respectively, xQ ∈ Q) contains x, then (P ∪ Q ∪ {P xQ}) − {P x, xQ} is an f*2*-path partition of G.*

We now have the following theorem which is key for the inductive step of our algorithm.

**Theorem 3. Suppose**=p_{f}_{0}*(B)−p _{f}*

_{1}

*(B) and =p*

_{f}_{1}

*(B)−p*

_{f}_{2}

*(B). (Notice that , ∈ {0, 1}.) Then the following statements*

*hold:*

*(1) Iff (x) = 0, then p _{f}(G) = p_{f}(A) + p_{f}(B) − 1.*

*(2) Iff (x) = 1, then p*

_{f}(G) = p_{f}_{1}

_{−}(A) + p_{f}_{}(B) − 1.*(3) Iff (x)2 and = = 0, then p _{f}(G) = p_{f}(A) + p_{f}*

_{0}

*(B) − 1.*

*(4) Iff (x)2 and = 0 and = 1, then p*

_{f}(G) = p_{f}_{3}

*(A) + p*

_{f}(B).*(5) Iff (x)2 and = 1, then p*

_{f}(G) = p_{f}_{1}

_{−}(A) + p_{f}_{1}

_{+}(B) − 1.**Proof. Suppose***P is an optimal f-path partition of G. Let P*∗be the path in*P that contains x. (It is possible that there is no such*
path when*f (x) = 3.) There are three possibilities for P*∗: (a)*P*∗does not exist or*P*∗*⊆ A; (b) P*∗ *⊆ B; (c) x is an internal*
vertex of*P*∗, say*P*∗*= P*
*xP*
, with*P*
*x ⊆ A and xP*
*⊆ B. (The latter is possible only when f (x)2.)*

For the case when (a) holds,*{P ∈ P : P ⊆ A} is an f-path partition of A and {P ∈ P : P ⊆ B} ∪ {x} is an f*0-path partition
*of B. We then have the inequality in(a*
*). Similarly, we have (b*
*) and (c*
*) corresponding to (b) and (c).*

(a
) *p _{f}(G)p_{f}(A) + p_{f}*

_{0}

*(B) − 1.*

(b
) *p _{f}(G)p_{f}*

_{0}

*(A) + p*

_{f}(B) − 1. (We may replace p_{f}(B) by p_{f}_{2}

*(B) when f (x)2.)*(c )

*p*

_{f}(G)p_{f}_{1}

*(A) + p*

_{f}_{1}

*(B) − 1. (This is possible only when f (x)2.)*

We are now ready to prove the theorem.

(1) Since*f (x) = 0, we have f = f*0. According to Lemma 2(1),*pf(G)pf(A) + pf(B) − 1. On the other hand, (a*
) and
(b
) give*p _{f}(G)p_{f}(A) + p_{f}(B) − 1.*

(2) Since*f (x) = 1, we have f = f*1. Lemma 2(1), together with (a
) and (b
), gives*pf(G) = min{pf*1*(A) + pf*0*(B) −*

1*, p _{f}*

_{0}

*(A) + p*

_{f}_{1}

*(B) − 1}. If = 0, then*

*p _{f}*0

*(A) + pf*1

*(B) − 1pf*1

*(A) + (pf*0

*(B) − ) − 1 = pf*1

*(A) + pf*0

*(B) − 1;*

and if* = 1, then*

*p _{f}*1

*(A) + pf*0

*(B) − 1(pf*0

*(A) − 1) + (pf*1

*(B) + ) − 1 = pf*0

*(A) + pf*1

*(B) − 1.*

Hence*p _{f}(G) = p_{f}*

_{1}

_{−}(A) + p_{f}_{}(B) − 1.(3) According to Lemma 2(1),*p _{f}(G)p_{f}(A)+p_{f}*

_{0}

*(B)−1. On the other hand, as p*

_{f}_{0}

*(A)p*

_{f}_{1}

*(A)p*

_{f}(A) and p_{f}_{0}

*(B)=*

*p*1

_{f}*(B) = pf*2

*(B), (a*)–(c ) give

*pf(G)pf(A) + pf*0

*(B) − 1.*

(4) According to Lemma 1(4) and* = 0 and = 1, we have*
*pf(B − x) = pf*0*(B) − 1 = pf*1*(B) − 1 = pf*2*(B).*

This, together with Lemma 1(4), gives that the above value is also equal to*p _{f}*

_{3}

*(B) and so p*3-path partition

_{f}(B). Then, an optimal f*P of A, together with an optimal p*-path partition of

_{f}*B − x (respectively, B) when x is (respectively, is not) in a path*of

*P, forms an f*2

*-path partition of G. Thus,pf(G)pf*2

*(G)pf*3

*(A) + pf(B).*

On the other hand, since*p _{f}*

_{1}

*(A)p*

_{f}(A)p_{f}_{3}

*(A) and p*

_{f}_{0}

*(B)−1=p*

_{f}_{1}

*(B)−1=p*) or (c ) implies

_{f}(B), (a*p*

_{f}(G)p_{f}_{3}

*(A)+*

*p*0

_{f}(B). Also, as p_{f}*(A) − 1pf*3

*(A) by Lemma 1(4), (b*) implies

*pf(G)pf*3

*(A) + pf(B).*

(5) According to Lemma 1(1) and Lemma 2, we have

*pf(G)pf*2*(G) min{pf*0*(A) + pf*2*(B) − 1, pf*1*(A) + pf*1*(B) − 1}.*

On the other hand, if (a
) holds, then by Lemma 1(5) and that*p _{f}*

_{0}

*(B) = p*

_{f}_{1}

*(B) + 1,*

*pf(G)pf(A) + pf*0*(B) − 1(pf*1*(A) − 1) + (pf*1*(B) + 1) − 1 = pf*1*(A) + pf*1*(B) − 1.*

This, together with (b ) and (c ), gives

*pf(G) = min{pf*0*(A) + pf*2*(B) − 1, pf*1*(A) + pf*1*(B) − 1}.*

If* = 0, then*

*pf*0*(A) + pf*2*(B) − 1pf*1*(A) + (pf*1*(B) − ) − 1 = pf*1*(A) + pf*1*(B) − 1;*

and if* = 1, then*

*pf*1*(A) + pf*1*(B) − 1(pf*0*(A) − 1) + (pf*2*(B) + ) − 1 = pf*0*(A) + pf*2*(B) − 1.*

**3. Special blocks**

Notice that the inductive theorem (Theorem 3) can be applied to solve the path-partition problem on graphs for which the problem can be solved on its blocks. In this paper, we mainly consider the case when the blocks are complete graphs, cycles or complete bipartite graphs.

*Now, we assume that B is a graph in which each vertexv has a label f (v) ∈ {0, 1, 2, 3}. Recall that f*−1*(i) is the set of*

*preimages of i, i.e.*

*f*−1*(i) = {v ∈ V (B) : f (v) = i}.*

According to Lemma 1(4), we have*p _{f}(B) = p_{f}(B − f*−1

*(0)) + |f*−1

*(0)|. Therefore, we may assume without loss of*

*generality thatf*−1*(0) = ∅ throughout this section.*

*We ﬁrst consider the case when B is a complete graph. The proof of the following lemma is straightforward and hence omitted.*

* Lemma 4. Suppose B is a complete graph. Iff*−1

*(1) = ∅ or f*−1

*(2) = ∅, then p*−1

_{f}(B) = |f*(1)|/2 else p*

_{f}(B) = 1.*Next, consider the case when B is a path. This is useful as a subroutine for handling cycles. The proof of the following lemma*
is also omitted.

**Lemma 5. Suppose B is a path.**

*(1) If x is an end vertex of B withf (x) = 3, then p _{f}(B) = p_{f}(B − x).*

*(2) If x is an end vertex of B withf (x) = 2, then p*

_{f}(B) = p_{f}_{1}

*(B).*

*(3) If B has an end vertex x and another vertex y withf (x) = f (y) = 1 such that no vertex between x and y has a label 1, then*
*p _{f}(B) = p_{f}(B*

*) + 1 where B*

*is the path obtained from B by deletingx, y and all vertices between them.*

*We then consider the case when B is a cycle. The proof of the following lemma is also omitted.*

**Lemma 6. Suppose B is a cycle.**

*(1) Iff*−1*(2) = ∅, then p _{f}(B) = |f*−1

*(1)|/2.*

*(2) If P is a path from x to y in B such thatf*−1*(1) ∩ P = {x, y} and f*−1*(2) ∩ P = ∅, then p _{f}(B) = p_{f}(B − P ) + 1.*

*Finally, we consider the case when B is a complete bipartite graph withC∪D as a bipartition of the vertex set. For i ∈ {0, 1, 2, 3},*let

*C _{i}= {u ∈ C : f (u) = i} with c_{i}= |C_{i}*|;

*Di= {v ∈ D : f (v) = i} with di= |Di|.*We have the following lemmas.

* Lemma 7. Ifc*1

*= d*1

*= 0 and c*2

*d*2

*andx ∈ C*2

*, thenpf(B) = p*

_{f}*(B) where f*

*is the same as f exceptf*

*(x) = 1.*

**Proof.** *p _{f}(B)p_{f}*

*(B) follows from the fact that any f*

*-path partition of B is an f-partition.*

Suppose*P is an optimal f-path partition of B. We may assume that P is chosen so that the paths in P cover as few vertices*
as possible. For the case when*P has a path Py with y ∈ C, we may interchange y and x to assume that P x ∈ P. In this case,*
*P is an f*
*-path partition of B and sop _{f}*

*(B)p*end vertices are all in

_{f}(B). So, now assume that all end vertices of paths in P are in D. Then, these*D*2for otherwise we may delete those end vertices in

*D*3to get a newP which covers fewer vertices. We may further assume that paths in

*P cover no vertices in D*3, for otherwise we may interchange such a vertex with an end vertex of a path in

*P and then delete it from the path. Thus each path of P uses vertices in C*2

*∪ C*3

*∪ D*2, and has end vertices in

*D*2. These imply that

*d*2

*> c*2, contradicting that

*c*2

*d*2.

* Lemma 8. Supposex ∈ C*1

*. Also, eitherd*2

*1 with y ∈ D*2

*, or elsec*1

*> d*1

*andd*2

*= 0 < d*3

*withy ∈ D*3

*. Thenpf(B) =*

*p*

_{f}*(B − x), where f*

*is the same as f exceptf*

*(y) = 1.*

* Proof. Suppose Py is in an optimalf*
-path partition

*P of B − x. Then (P − {Py}) ∪ {Pyx} is an f-path partition of B and so*

*p*

_{f}(B)p_{f}*(B − x).*

*On the other hand, suppose Px is in an optimal f-path partitionP of B. For the case when y is not covered by any path in P,*
we have*y ∈ D*3and so*c*1*> d*1and*d*2*= 0. Consequently, there is some Qz ∈ P with z ∈ C*2*∪ C*3or*z ∈ D*3. For the former
*case, we replace Qz by Qzy inP; for the later, we replace Qz by Qy. So, in any case we may assume that y is covered by some*
*path RyS inP. If RyS = P x, then again we may interchange y with the last vertex of P to assume that RyS = T yx in P for*
*some T. IfRyS = P x, then we may replace the two paths RyS and Px by Ryx and PS. So, in any case, we may assume that P*
*has a path Uyx. Then,(P − {Uyx}) ∪ {Uy} is an f*
-path partition of*B − x. Thus p _{f}*

*(B − x)p*

_{f}(B).By symmetry, we may prove a similar theorem for the case when*x ∈ D*1; and either*c*2*1 with y ∈ C*2, or else*d*1*> c*1and
*c*2*= 0 < c*3with*y ∈ C*3.

**4. Algorithm**

We are ready to give a linear-time algorithm for the path-partition problem in graphs whose blocks are complete graphs,
cycles or complete bipartite graphs. Notice that we may consider only connected graphs. We present ﬁve procedures. The ﬁrst
*four are subroutines which calculate f-path-partition numbers of complete graphs, paths, cycles and complete bipartite graphs,*
respectively, by using Lemmas 4–8. The last one is the main routine for the problem.

First, Lemmas 1(4) and 4 lead to the following subroutine for complete graphs.

**Algorithm PCG. Find the f-path partition number**p_{f}(B) of a complete graph B.**Input. A complete graph B and a vertex labeling f.**

**Output.***p _{f}(B).*

**Method.**

**if (**

*f*−1

*(1) = ∅ or f*−1

*(2) = ∅)*

**then**

*p*−1

_{f}(B) = |f*(0)| + |f*−1

*(1)|/2;*

**else**

*p*−1

_{f}(B) = |f*(0)| + 1;*

**return**

*p*

_{f}(B).Lemma 5 leads to the following subroutine for paths, which is useful for the cycle subroutine.

**Algorithm PP. Find the f-path partition number**p_{f}(B) of the path B.* Input. A path B and a vertex labeling f withf*−1

*(0) = ∅.*

**Output.***p _{f}(B).*

**Method.**

*p _{f}(B) ← 0;*

*B*

*← B;*

**while (***B*
**= ∅) do**

*choose an end vertex x ofB*
;

**if (****f (x) = 3) then B***← B*
**− x else**

*choose a vertex y nearest to x withf (y) = 1*

*(let y be the other end vertex if there is no such vertex);*
*p _{f}(B) ← p_{f}(B) + 1;*

*B*
*← B*
*− all vertices between (and including) x and y;*

**end else;**
**end while;**
**return***p _{f}(B).*

**Algorithm PC. Find the f-path partition number**p_{f}(B) of a cycle B.**Input. A cycle B and a vertex labeling f.**

**Output.***p _{f}(B).*

**Method.**

**if (***f*−1* (0) = ∅ and f*−1

*(2) = ∅)*

**then**

*p*−1

_{f}(B) ← f*(1)/2;*

**else if (***f*−1*(0) = ∅ and f*−1*(2) = ∅ and |f*−1**(1)|1) then**

*p _{f}(B) ← 1;*

**else if (***f*−1*(0) = ∅ and f*−1*(2) = ∅ and |f*−1**(1)|2) then**

*choose a path P from x to y such that*

*f*−1*(1) ∩ P = {x, y} and f*−1*(2) ∩ P = ∅;*
*pf(B) ← pf (B − P ) + 1 by calling PP(B − P );*

**else***// now f*−1*(0) = ∅ //*

let*B − f*−1*(0) be the disjoint union of paths P*1*, P*2*, . . . , Pk*;
*pf(B) ← |f*−1*(0)|;*

**for*** i = 1 to k do p_{f}(B) ← p_{f}(B) + p_{f}(P_{i}) by calling PP(P_{i}*);

**end else;**
**return***p _{f}(B).*

Lemmas 1(4), 7 and 8 lead to the following subroutine for complete bipartite graphs. In the subroutine, we inductively
reduce the size of*C ∪ D. Besides the reduction of C*0and *D*0in the second line, we consider 9 cases. The ﬁrst case is
for *C = ∅ or D = ∅. The next 5 cases are for c*1*1 or d*1*1. In particular, the case of c*11 is covered by cases 2
and 3, except when*d*2*= 0 and (c*1*d*1or *d*3*= 0). The case of d*1*1 is covered by cases 4 and 5, except when c*2=
0 and (*d*1*c*1 or *c*3 = 0). The exceptions are then covered by case 6. Finally, the last 3 cases are
for*c*1*= d*1= 0.

**Algorithm PCB. Find the f-path partition number**p_{f}(B) of a complete bipartite graph B.**Input: A complete bipartite graph B with a bipartition**C ∪ D of vertices and a vertex labeling f.**Output:***p _{f}(B).*

**Method.**

*c _{i}← |f*−1

*(i) ∩ C| and d*

_{i}*← |f*−1

*(i) ∩ D| for 0i 3;*

*pf(B) ← c*0

*+ d*0;

**while (true) do**

**if (***c*1*= c*2*= c*3*= 0 or d*1*= d*2*= d*3**= 0) then**

*p _{f}(B) ← p_{f}(B) + c*1

*+ c*2

*+ d*1

*+ d*2

**; return**

*pf(B);*

**else if (***c*1*1 and d*2**1) then // use Lemma 8 //***c*1*← c*1*− 1; d*2*← d*2*− 1; d*1*← d*1+ 1;

**else if (***c*1*1 and c*1*> d*1and*d*2*= 0 < d*3**) then***// use Lemma 8 //*
*c*1*← c*1*− 1; d*3*← d*3*− 1; d*1*← d*1+ 1;

**else if (***d*1*1 and c*2**1) then // use the remark after Lemma 8 //***d*1*← d*1*− 1; c*2*← c*2*− 1; c*1*← c*1+ 1;

**else if (***d*1*1 and d*1*> c*1and*c*2*= 0 < c*3**) then***// use the remark after Lemma 8 //*
*d*1*← d*1*− 1; c*3*← c*3*− 1; c*1*← c*1+ 1;

**else if (***c*2*= d*2*= 0 and (c*1*= d*1*1 or c*1*> d*1*1 with d*3*= 0 or d*1*> c*1*1 with c*3**= 0)) then**
*pf(B) ← pf(B) + max{c*1*, d*1**}; return p**f(B);

**else***// by now c*1*= d*1* = 0 // if (c*2

*= d*2

**= 0) then**

**return***p _{f}(B);*

**else if (***c*2*d*2**) then***// use Lemma 7 //*
*c*1*← 1; c*2*← c*2− 1;

**else if (***c*2*< d*2**) then***// use the remark after Lemma 7 //*
*d*1*← 1; d*2*← d*2− 1;

**end while.**

**Algorithm PG. Find the path-partition number***p _{f}(G) of the connected graph G whose blocks are cycles, complete graphs or*

complete bipartite graphs.

**Input: A graph G and a vertex labeling f.****Output:***p _{f}(G).*

**Method.**

*p _{f}(G) ← 0;*

*G*

*← G;*

**while (***G*
**= ∅) do**

*choose a block B ofG*
*with only one cut-vertex x or with no cut-vertex;*

**if (B is a complete graph) then**

ﬁnd*p _{f}_{i}(B) by calling PCG(B, f_{i}) for 0i 3;*

**if (B is a cycle) then**

ﬁnd*p _{f}_{i}(B) by calling PC(B, f_{i}) for 0i 3;*

**if (B is a complete bipartite graph) then**

ﬁnd*p _{f}_{i}(B) by calling PCB(B, f_{i}) for 0i 3;*

*: =pf*0

*(B) − pf*1

*(B);*

*: =p*1

_{f}*(B) − pf*2

*(B);*

**if (**

**f (x) = 0) then***p*

_{f}(G) ← p_{f}(G) + p_{f}(B) − 1;**else if (**

**f (x) = 1) then***p*

_{f}(G) ← p_{f}(G) + p_{f}_{}(B) − 1; f (x) ← 1 − ;**else**

*// by now f (x) = 2 or 3 //*

**case 1:**

*= = 0*

*p*

_{f}(G) ← p_{f}(G) + p_{f}_{0}

*(B) − 1;*

**case 2:**

*= 0 and = 1*

*p*

_{f}(G) ← p_{f}(G) + p_{f}(B); f (x) ← 3;**case 3:**

*= 1*

*p*

_{f}(G) ← p_{f}(G) + p_{f}_{1}

_{+}(B) − 1; f (x) ← 1 − ;*G*

_{: =G}

_{− (B − {x});}**end while;**

**output**

*p*

_{f}(G).**Theorem 9. Algorithm PG computes the f-path partition number of a connected graph whose blocks are cycles, complete graphs**

*or complete bipartite graphs in linear time.*

**Proof. The correctness of the algorithm follows from Lemma 1(4) and Lemmas 4 to 8. The algorithm takes only linear time**

since depth-ﬁrst search can be used to ﬁnd end blocks and each subroutine requires only*O(|B|) operations. *

**Acknowledgements**

The authors thank the referees for many constructive suggestions.

**References**

[1]S.R. Arikati, C. Pandu Rangan, Linear algorithm for optimal path cover problem on interval graphs, Inform. Process. Lett. 35 (1990) 149– 153.

[2]H.J. Bonuccelli, D.P. Bovet, Minimum node disjoint path covering for circular-arc graphs, Inform. P rocess. Lett. 8 (1979) 159–161.
[3]G.J. Chang, Algorithmic aspects of linear*k-arboricity, Taiwanese J. Math. 3 (1999) 73–81.*

[4]G.J. Chang, Corrigendum for ‘The path-partition problem in block graphs’, Inform. Process. Lett. 83 (2002) 293.
[5]G.J. Chang, D. Kuo, The*L(2, 1)-labeling problem on graphs, SIAM J. Discrete Math. 9 (1996) 309–316.*
[6]D.G. Corneil, H. Lerchs, L. Stewarts, Complement reducible graphs, Discrete Appl. Math. 3 (1981) 163–174.
[7]P. Damaschke, P aths in interval graphs and circular arc graphs, Discrete Math. 112 (1993) 49–64.

[8]P. Damaschke, J.S. Deogun, D. Kratsch, G. Steiner, Finding Hamiltonian paths in cocomparability graphs using the bump number algorithm, Order 8 (1992) 383–391.

[9]M.R. Garey, D.S. Johnson, R.E. Tarjan, The planar Hamiltonian circuit problem is NP-complete, SIAM J. Comput. 5 (1976) 704–714. [10]M.C. Golumbic, Algorithmic Graph Theory and Perfect Graphs, Academic Press, New York, 1980.

[11]H.A. Jung, On a class of posets and the corresponding comparability graphs, J. Combin. Theory Ser. B 35 (1978) 125–133.

[12]Y.D. Liang, G.K. Mancher, C. Rhee, T. Mankus, in: A linear algorithm for ﬁnding Hamiltonian circuits in circular-arc graphs, 32nd ACM Southeastern Conference,1994, pp. 101–118.

[13]R. Lin, S. Olariu, G. Pruesse, An optimal path cover algorithm for cographs, Comput. Math. Appl. 30 (1995) 75–83. [14]H. Müller, Hamiltonian circuits in chordal bipartite graphs, Discrete Math. 156 (1996) 291–298.

[15]J.-J. Pan, G.J. Chang, Isometric path numbers of block graphs, submitted.

[16]Z. Skupien, Path partitions of vertices and Hamiltonicity of graphs, in: Proceedings of the Second Ozechoslovakian Symposium on Graph Theory, Prague,1974.

[17]R. Strikant, Ravi Sundaram, Karan Sher Singh, C. Pandu Rangan, Optimal path cover problem on block graphs and bipartite permutation graphs, Theoret. Comput. Sci. 115 (1993) 351–357.

[18]P.-K. Wong, Optimal path cover problem on block graphs, Theoret. Comput. Sci. 225 (1999) 163–169. [19]J.-H. Yan, G.J. Chang, The path-partition problem in block graphs, Inform. Process. Lett. 52 (1994) 317–322.

[20]J.-H. Yan, G.J. Chang, S.M. Hedetniemi, S.T. Hedetniemi,*k-Path partitions in trees, Discrete Appl. Math. 78 (1997) 227–233.*
[21]H.-G. Yeh, G.J. Chang, The path-partition problem in bipartite distance-hereditary graphs, Taiwanese J. Math. 2 (1998) 353–360.