1 Introduction

In practice, when the sensors have omnidirectional antennas with the same transmission range, the topology of the three-dimensional wireless sensor network can be modeled as a unit ball graph. An undirected graph G is called a unit ball graph if its vertices can be represented as points in three-dimensional space so that the Euclidean distance between two points corresponding to an edge in G is not greater than one. In this paper, we consider the minimum weighted connected vertex cover \(P_{3}\) problem in unit ball graph which plays an important role in three-dimensional wireless sensor networks. We use Bondy and Murty (2008), Du et al. (2012) and Garey and Johnson (1979), for standard graph theory, approximation algorithms and computational complexity terminology and notations.

Given an undirected and simple graph \(G=(V,E)\), a vertex cover (VC) of G is a subset of vertices \(C\subseteq V\) which covers all edges, i.e., \(\forall e=(u,v)\in E\), either \(u\in C\) or \(v\in C\). Let \(w: V\rightarrow {\mathbb {R}}^{+}\) be a vertex weight function. The minimum weighted vertex cover (MWVC) problem consists of finding a vertex cover of minimum total weight. Many problems have been shown to be NP-complete by a transformation from VC, including well-known problems as the Hamilton cycle problem and the clique problem. Vertex covers are fundamental within graph theory, one reason being that vertex covers can be considered as the duals of matchings. The VC problem also represents a large class of related vertex deletion problems, in which one is interested in finding a minimum subset \(C\subseteq V\) whose deletion gives the graph induced by \(V-C\) satisfying a desired property, e.g., such that the graph \(G[V-C]\) is edgeless (C is a vertex cover) or \(G[V-C]\) has no cycle (C is a feedback vertex set). There are many other examples, including weighted variants (in which one is interested in a set C with a small total weight) and variants in which one imposes structural conditions on C (like being connected).

Here we study a variation of the vertex cover problem in which the set \(C\subseteq V\) should intersect every path of length two in G with the graph induced by C in G being connected, and be of minimum total weight subject to these conditions. So the degree of each vertex in the graph induced by \(V-C\) in G is at most one. For describing more background and related recent results on this topic, we first define the more general problem.

The concept of vertex cover \(P_{k}\) problem is a generalization of the vertex cover problem. Given a graph \(G=(V,E)\) with vertex weight function \(w: V\rightarrow {\mathbb {R}}^{+}\), the minimum weight vertex cover \(P_{k}\) problem is the problem of finding a minimum weight vertex cover set \(C \subseteq V\) such that the graph \(G[V-C]\) has no \(P_{k}\) as a subgraph, where \(P_{k}\) is the path on k vertices. Or, equivalently, the problem is to find a minimum weight vertex cover set \(C \subseteq V\) such that for any \(P_{k}\) in G, \(V(P_{k})\cap C\ne \emptyset \). Here, the weight of a vertex set \(C\subseteq V\) is \(w(C)=\sum _{v\in C}w(v)\).

If furthermore, the subgraph G[C] induced by a vertex cover \(P_{k}\) set C is required to be connected, then we call C a connected vertex cover \(P_{k}\) set. In this paper, we restrict our attention to the case of \(k=3\). The Minimum Weight Connected Vertex Cover \(P_{3}\) problem (MWCVCP3 for short) is the optimisation problem of finding such a set with minimum total weight.

Connectivity constraints come in naturally, e.g., in many applications concerning wireless sensor networks, in which it is usually important to ensure connectivity if the sensor devices have limited capabilities of computation, energy and communication. Moreover, they are often deployed in accessible areas, where they can be rather easily captured by attackers. Therefore, the design of security protocols has become a challenge. One such protocols, known as the Canvas protocol, was designed in Menezes et al. (1996), Novotny (2010) to provide data integrity or data origin authentication (Menezes et al. 1996) in sensor networks. The k-generalised Canvas scheme (Novotny 2010) guarantees data integrity if at least one vertex is not captured on each path of length \(k-1\) in the communication graph. Thus, during the deployment and initialisation of a sensor network, it should be ensured that at least one protected vertex exists on each path of length \(k-1\) in the communication graph, and the problem of minimising the cost of the network by minimising the number of protected vertices arises naturally in Novotny (2010).

In the field of wireless sensor networks, unit ball graphs are widely used. A wireless sensor network is an ad hoc wireless network which consists of a huge amount of static or mobile sensors. The sensors collaborate to sense, collect, and process the raw information of the phenomenon in the sensing area and transmit the processed information to the observers. Suppose the sensors of the network have omnidirectional antennas with the same transmission range, two sensors can communicate if and only if they fall into the transmission ranges of each other, in other words, if and only if the Euclidean distance between them is at most one. There are cases in which three-dimensional models are needed, such as under-water sensor systems, outer-space sensor systems, notebooks in a multi-layered buildings, etc. For example, in a mountain area or underwater (Akyildiz et al. 2005), environment is often not flat. In such kind of underwater networks, in order to observe a given phenomenon, sensor nodes float at different depths. Then deployed sensors would form a three-dimensional wireless sensor network, which has a mathematical model, the unit ball graph. One can use under-water sensor systems to detect and observe phenomena that cannot be adequately observed by means of ocean bottom sensor nodes, i.e., to perform cooperative sampling of the 3D ocean environment.

Given a graph without its geometric representation, it is NP-hard to determine whether it can be represented as a unit ball graph (Breu and Kirkpatrickz 1998). Thus, in our paper we assume the geometric representation of the unit ball graph is given. This is usually the case in applications.

In practice, it is natural to assume that the vertices of the graph have some positive weights. In the context of wireless ad-hoc networks, these weights usually reflect residual energy, power capabilities, and information loads of a node for a specific task. The assumption of the smoothness of the weights (Wang et al. 2005) is reasonable in many applications such as homogeneous wireless sensor or ad hoc networks, where the weights of neighboring nodes do not vary significantly.

1.1 Related work

The case \(k=2\) of the minimum weight vertex cover \(P_{k}\) problem without the condition of connectivity is the well-studied minimum weight vertex cover problem. Boštjan (Brešar et al. 2011) proved that minimum vertex cover \(P_{k}\) problem is NP-complete for any fixed integer \(k\ge 2\), Tu and Zhou (2011) gave a 2-approximation minimum weight vertex cover \(P_{3}\) set by using the primal–dual method or the technique of layering. With the condition of connectivity, Liu et al. (2013) present a PTAS for the minimum k-path connected vertex cover problem in unit disk graphs. Notice that their work only studied the problem without weight.

Wang et al. (2015) have proved that the minimum weighted connected vertex cover \(P_3\) problem remains NP-hard when restricted to unit disk graphs, or even to the more specific subclass of grid graphs. Since the unit disk graphs can be viewed as a subclass of the unit ball graphs, we can draw the conclusion that the MWCVCP3 problem is NP-hard on unit ball graphs.

A polynomial-time approximation scheme (PTAS) is a family of approximation algorithms with performance ratio \(1+\varepsilon \) (for any positive real number \(\varepsilon \)) that can be executed in polynomial time (depending on the size of the input and \(\varepsilon \)).

Wang and Jiang (1996) first introduced the concept of c-local and gave a PTAS for the Steiner tree problems in the plane with Euclidean and rectilinear metrics under the assumption of c-local. They call a Steiner tree problem c-local (for some positive constant c) if in a minimum spanning tree for the terminals, the length of a longest edge is at most c times the length of a shortest edge. Fan et al. (2011) presented a PTAS for the minimum weight connected vertex cover problem in unit disk graphs, provided the problem satisfies a c-local condition where in the solution \(C_0\) obtained by some constant-approximation algorithm, the maximum weight of the vertices in \(C_0\) is at most c, (assume, without loss of generality, that every vertex has weight at least one). It should be noted that maybe some vertices in G which will never be selected into the approximation solution, might have very large weights, since they do not play any important role in connection. So the assumption of c-local is different from the requirement that the maximum weight of the vertices of G is at most c. Inspired by these works, Wang et al. (2015) define a similar concept of c-local for MWCVCP3 and obtained a PTAS for MWCVCP3 problem on unit disk graphs under c-local assumption, when the unit disk graphs have minimum degree at least two.

1.2 Our contribution

In this paper, we study the problem of constructing \(MWCVCP_3\) in unit ball graphs. The contributions of this paper can be summarized as follows:

1. In this paper we introduce a new concept of weak c-local which is weaker than the original concept of c-local as in Wang et al. (2015). We define an instance of MWCVCP3 to be weak c-local (for some positive constant c) if in a solution \(C_0\) obtained by some approximation algorithm, the maximum weight of the vertices in \(F \subseteq C_0\) which is a vertex cover \(P_3\) set, is at most c, assuming without loss of generality that every vertex has weight at least one. Note that F may not be connected. Hence, if an instance I of MWCVCP3 is c-local, it must be weak c-local as \(F \subseteq C_0\). However, an instance I of MWCVCP3 of weak c-local is not necessary to be c-local.

2. In this paper, we present a PTAS for MWCVCP3 problem with smooth weights in unit ball graphs under the condition of weak c-local. It should be noticed that our result is not a direct generalization of Wang et al. (2015) to higher dimensional space. The technique used in Wang et al. (2015) is only valued when the minimum degree \(\delta (G)\ge 2\), and it assumes a stronger condition of c-local. To obtain the results in this paper, new ideas of utilizing and combining the primal-dual approximation algorithm (Tu and Zhou 2011) and the techniques in high dimensional spaces (Zhang and Wu 2013) have to be explored.

1.3 Organisation of the paper

In Sect. 2, we introduce some preliminaries which will be needed later. In Sect. 3, we present our PTAS for MWCVCP3 problem on unit ball graphs. The approximation solution, the proof of the correctness of our algorithm, analysis of the time complexity and the performance ratio are given in Sect. 4. Finally, the concluding remarks and future research are drawn in Sect. 5. In the appendix we show that the minimum weighted connected vertex cover \(P_{k} (k\ge 4)\) problem is NP-complete for grid graphs.

2 Preliminaries

In this section, we introduce some useful definitions and denotations that will be used in the partition and shifting strategy.

Given a geometric representation of a connected unit ball graph \(G=(V,E)\) with \(|V| = n\), we initially find a minimal three-dimensional cube Q to contain all the unit balls in G. Without loss of generality, assume \(Q=\{(x, y, z)|0\le x\le q, 0\le y\le q, 0\le z\le q\}\), where q is related to n. Let m be a large integer that will be determined later. Set \(p=\lfloor \frac{q}{m}\rfloor \ +1\), and \(\widetilde{Q}=\{(x,y,z)|-m\le x\le pm, -m\le y\le pm, -m\le z\le pm\}\). Using partition strategy, we divide \(\widetilde{Q}\) into \((p+1)\times (p+1)\times (p+1)\) smaller cubes (called cells) such that each cell is an \(m\times m\times m\) cube (each cube is half closed and half open, including the back, left, and bottom sides, excluding the front, right, and top sides). Define this partition as P(0). For \(d=0, 1,..., m-1\), let P(d) be the partition obtained from P(0) by shifting the left-bottom-hind corner of P(0) from \((-m,-m,-m)\) to \((-m+d,-m+d,-m+d)\). It should be noted that the enlargement of Q guarantees that after shifting, all the unit balls to be covered are still enclosed by every partition P(d).

For each cell e, we define the boundary region \(B_{e}\) and inner region \(I_{e}\) as follows. The boundary region \(B_{e}\) of e is the region contained in e such that each point in this region is at most distance 3 from the boundary of e. The inner region \(I_{e}\) of e is the region of e such that each point at least distance 1 away from the boundary of e. Note that \(I_{e}\) and \(B_{e}\) have an overlap of width 2 (see Fig. 1). This ensures the output of our algorithm is a vertex cover \(P_{3}\) set. If we add some additional vertices in the algorithm, the connection of the output computed by our algorithm can be ensured.

Fig. 1
figure 1

Shaded area marked by solid lines indicates the boundary region and shaded area marked by dotted lines indicates the inner region. Inner region and boundary region have an overlap of width 2

Next, we give a useful definition of smoothness (Wang et al. 2005; Zhu et al. 2010) which will be used to devise polynomial algorithms that solve \(MWCVCP_3\) problem.

Definition 1

Given an undirected and weighted graph \(G=(V, E)\) with each vertex v assigned with a nonnegative weight w(v), the weight function \(w: V\rightarrow R^{+}\) is called smooth if there exists a constant \(\beta \ge 1\) such that \(max_{(uv)\in E}\frac{w(u)}{w(v)}\le \beta \).

3 The algorithm for the PTAS

We describe the algorithm in this section. We denote the boundary region of a partition P(d) as \(B(P(d))=\bigcup _{e\in P(d)}B_{e}\). The algorithm is executed in three phases.

Phase 1 Given the geometric representation of the unit ball graph G, adopt the primal-dual approximation algorithm of Tu and Zhou (2011), we can obtain a vertex cover \(P_{3}\) set F of G with \(w(F)\le 2w(F^{*})\), where \(F^{*}\) is an optimum vertex cover \(P_{3}\) set of G.

If the induced subgraph G[F] is connected, we can obtain a connected vertex cover \(P_{3}\) set \(S_{0}=F\); If G[F] is not connected, for two closest components \(R_{1}\) and \(R_{2}\) of G[F], we can make \(R_{1}\) and \(R_{2}\) connect by finding a path T with the minimum total weight. Continue this procedure until G[F] is connected. Then we can obtain a connected vertex cover \(P_{3}\) set \(S_{0}=F\).

Denote by \(S_{0}(d)=S_{0}\cap B(P(d))\) the set of vertices of \(S_0\) lying in the boundary region of partition P(d). Using the shifting strategy to select a partition \(P(d^{*})\) such that \(w(S_{0}(d^{*}))=\min \{w(S_{0}(d))\mid 0\le d\le m-1\}\).

Phase 2 For every small cube \(e\in P(d^{*})\), denote by \(G_{e}\) the subgraph of G induced by the vertices in \(I_{e}\), and \(Comp(G_{e})\) the set of connected components in \(G_{e}\). For each small cube e and each component \(H\in Comp(G_{e})\), use exhaust search to find a minimum weighted connected vertex cover \(P_{3}\) set \(S_{H}\) of H. Set \(S_{e}=\bigcup _{H\in Comp(G_{e})}S_{H}\).

Phase 3 If there exists a connected component \(H\in Comp(G_{e})\) such that \(S_{H}\cap S_{0}=\emptyset \) and there is no vertex of \(S_{H}\) adjacent with other vertex in \(S_{0}(d^{*})\), we can make \(S_{H}\) and \(S_{0}(d^{*})\) connect by finding a path \(P_{H}\) with the minimum total weight (Here, we enumerate all the paths which connect \(S_H\) and \(S_{0}(d^{*})\), and then choose a path \(P_H\) with minimum total weight which can be executed in polynomial time). Set \(S[e]=\bigcup _{H\in Comp(G_{e})}P_{H}\), else, Set \(S[e]=\emptyset \) (in this case, \(S_{H}\cap S_{0}=\emptyset \), and there is a vertex of \(S_{H}\) adjacent with other vertex in \(S_{0}(d^{*})\)).

Final result Output \(S=S_{0}(d^{*})\cup \left( \bigcup _{e\in P(d^{*})}S_{e}\right) \cup \left( \bigcup _{e\in P(d^{*})}S[e]\right) \).

4 Analysis of the algorithm

In this section, we first show that we can obtain a constant approximation solution. Secondly, we prove the correctness of the algorithm. Furthermore, we analyze the time complexity, and show that the algorithm can be executed in polynomial time. Finally, we prove the main conclusions that the performance ratio of the algorithm is \((1+\varepsilon )\) for any arbitrarily small positive constant \(\varepsilon \).

4.1 Approximation solution

In this section, with the help of the primal-dual approximation algorithm of Tu and Zhou (2011), we can obtain a constant ratio approximation solution of the \(MWCVCP_3\) problem in the following.

Lemma 1

There exists a \(\rho \)-approximation algorithm (with \(\rho =2(1+\beta c+\beta ^{2}c)\)) to obtain a minimum weight connected vertex cover \(P_{3}\) set in a smooth weighted unit ball graph G, if we assume that the problem is weak c-local.

Proof

Let \(S^{*}\) be an optimal solution for \(MWCVCP_3\) of a weighted unit ball graph G. By using the primal-dual approximation algorithm of Tu and Zhou (2011) in Phase 1, we can obtain a vertex cover \(P_{3}\) set F of G such that

$$\begin{aligned} w(F)\le 2w(F^{*})\le 2w(S^{*}) \end{aligned}$$
(*)

where \(F^{*}\) is an optimum vertex cover \(P_{3}\) set of G. If we assume that J is the maximum weight of the vertices in F, we can obtain a constant ratio approximation solution of the \(MWCVCP_3\) problem as following.

We assert that if the induced subgraph G[F] is not connected, we can reduce the number of connected components of G[F] by one through adding at most 2 vertices into F. Since the given unit ball graph is connected, we assume \(R_{1}\) and \(R_{2}\) are two closest components of G[F], and denote by \(T=(v_{1},v_{2},\ldots ,v_{t})\) the shortest path between \(R_{1}\) and \(R_{2}\), where \(v_{1}\in V(R_{1}), v_{t}\in V(R_{2})\). Firstly, \(v_{2}\notin F\), otherwise this path can be reduced to \((v_{2},\ldots ,v_{t})\). If \(v_{3}\in F\), we can get \(t=3\), since \(R_{1}\) and \(R_{2}\) are two closest components. Then adding \(v_{2}\) to F, we can connect \(R_{1}\) and \(R_{2}\). If \(v_{3}\notin F\), then \(v_{4}\) must be in F, otherwise there must exist a path \(P_{3}\) in \(G[V-F]\). Hence, \(t=4\). We add \(v_{2},v_{3}\) to F so that we can make \(R_{1}\) and \(R_{2}\) connect. Therefore, our assertion is correct.

So if the induced subgraph G[F] is not connected, we need to add at most \(2(a-1)\) vertices into F to get a connected vertex cover \(P_{3}\) set \(S_{0}\) of G, where \(a (a\le |F|)\) is the number of connected components of G[F] in graph G. Since the weights is smooth, and by the assumption that J is the maximum weight of the vertices in F, we can connect \(R_{1}\) and \(R_{2}\) by adding at most two vertices whose total weights are no more than \(\beta J+\beta ^{2}J\). Hence, we can get a connected vertex cover \(P_{3}\) set \(S_{0}\) of G such that

$$\begin{aligned} w(S_{0})&\le w(F)+(a-1)(\beta J+\beta ^{2}J)\\&\le w(F)+w(F)(\beta J+\beta ^{2}J)\\&\le 2(1+\beta J+\beta ^{2}J)w(S^{*})\\&\le 2(1+\beta c+\beta ^{2}c)w(S^{*}), \end{aligned}$$

where the second inequality follows that every vertex has weight at least one, the third inequality follows from \((*)\), and the last inequality follows the assumption of weak c-local. \(\square \)

4.2 Correctness

In this subsection, we prove that the output S of our algorithm is a connected vertex cover \(P_3\) set for the graph \(G=(V,E)\).

Theorem 1

The output S of our algorithm is a connected vertex cover \(P_{3}\) set for the graph G.

Proof

Firstly, we prove that the induced graph G[S] is connected. We prove this by three steps. In step 1, we show that distinct connected components in \(G[S_{0}(d^{*})]\) (if they exist) can be connected through vertices in \(\bigcup _{e\in P(d^{*})}S_{e}\). In step 2, we show that \(S_{H}\) is connected with \(S_{0}(d^{*})\) if there exists a connected component \(H\in Comp(G_{e})\) such that \(S_{H}\cap S_{0}\ne \emptyset \). In step 3, we can find a path \(P_{H}\) which connects \(S_{H}\) and \(S_{0}(d^{*})\) if there exists a connected component \(H\in Comp(G_{e})\) such that \(S_{H}\cap S_{0}=\emptyset \).

Step 1. Let \(H_{1}\) and \(H_{2}\) be the two distinct connected components in the induced subgraph \(G[S_{0}(d^{*})]\) which are ‘closest’ in \(G[S_{0}]\) with each other. Since the induced subgraph \(G[S_{0}]\) is connected, there exists a path \(P=(v_{1}, v_{2},\ldots ,v_{t-1}, v_{t})\) of \(G[S_{0}]\) connecting \(H_{1}\) and \(H_{2}\) through the inner region of one small cube e. Note that the inner region \(I_{e}\) and the boundary region \(B_{e}\) of each small cube have an overlap with width 2, without loss of generally, we may assume that \(\{v_{1}, v_{2}\}\subseteq V(H_{1})\), \(\{v_{t-1}, v_{t}\}\subseteq V(H_{2})\) and \(\{v_{3},\ldots ,v_{t-2}\}\subseteq I_{e}\setminus B_{e}\). Then we can observe that \(\{v_{1},v_{2},v_{t-1},v_{t}\}\subseteq B_{e}\cap I_{e}\), so the path \(P=(v_{1}, v_{2},\ldots , v_{t})\) is in a connected component H of \(G_{e}\). Based on Phase 2 of our algorithm, the path \((v_{1},\ldots ,v_{t})\) is covered by \(S_{H}\). It follows that at least one vertex of \(\{v_{1}, v_{2}, v_{3}\}\) belongs to \(S_{H}\), and at least one vertex of \(\{v_{t-2}, v_{t-1}, v_{t}\}\) belongs to \(S_{H}\). Since the induced subgraph \(G[S_{H}]\) is connected, we can observe that \(H_{1}\) and \(H_{2}\) are connected through \(G[S_{H}], S_{H}\in S_{e}\).

Step 2. For each small cube e of \(P(d^{*})\), if there exists a connected component \(H\in Comp(G_{e})\) such that \(S_{H}\cap S_{0}\ne \emptyset \), there must exist a vertex \(x\in S_{H}\cap S_{0}\). Since the induced subgraph \(G[S_{0}]\) is connected in G, there exists a path L in \(G[S_{0}]\) connecting x to another vertex \(y\in S_{0}(d^{*})\) which belongs to the other parts of G outside of e. We assume that the path \(L=(v_{0}, v_{1},\ldots ,v_{t})\), where \(v_{0}=x, v_{t}=y\) and \(\{v_{0},\ldots ,v_{t-1}\}\subseteq e\). Let i be the index such that \(v_{i}\) is the first vertex on L with \(v_{i}\in B_{e}\). Then we can see that \(v_{i-1}\in I_{e}\setminus B_{e}, v_{i}, v_{i+1}\in I_{e}\), so there must exist a vertex in \(\{v_{i-1}, v_{i}, v_{i+1}\}\) belongs to \(S_{H}\). Therefore, \(S_{H}\) is connected with \(S_{0}(d^{*})\).

Step 3. For each small cube e of \(P(d^{*})\), if there exists a connected component \(H\in Comp(G_{e})\) such that \(S_{H}\cap S_{0}=\emptyset \), we can make \(S_{H}\) and \(S_{0}(d^{*})\) connect by finding a path \(P_{H}\) with the minimum total weight by Phase 3 of our algorithm. Or there exists a vertex of \(S_{H}\) adjacent with other vertex in \(S_{0}(d^{*})\). So after adding the vertices of the path \(P_{H}\) to S, we can get \(S_{H}\) is connected with \(S_{0}(d^{*})\).

For each case, we can draw the conclusion that \(S_{H}\) is connected with \(S_{0}(d^{*})\). Therefore, we have proved that G[S] is connected.

Secondly, we prove that S is a vertex cover \(P_{3}\) set for \(G=(V, E)\). For any path (uvw) with length 2 in G, the Euclidean distance of the edge uv or vw is no more than one. Suppose (uvw) lies completely in a small cube e. Since the inner region \(I_{e}\) and the boundary region \(B_{e}\) have an overlap of width 2, there are two cases to be considered. The first case is that the path (uvw) belongs to the boundary region \(B_{e}\). According to Phase 1 of our algorithm, \(S_{0}\) is a connected vertex cover \(P_{3}\) set of the graph G, and \(S_{0}(d^{*})\) is the set of vertices of \(S_0\) lying in the boundary region of partition \(P(d^{*})\). So we can get \(\{u, v, w\}\cap S_{0}(d^{*})\ne \emptyset \). The second case is that the path (uvw) is in the inner region \(I_{e}\) of a small cube e, and thus the path (uvw) belong to a connected component H in \(G_{e}\). Based on Phase 2 of our algorithm, \(S_{H}\) is a connected vertex cover \(P_{3}\) set of H, hence the path \(\{u, v, w\}\cap S_{H}\ne \emptyset \). In any case, the path (uvw) is covered by \(S_{e}\cup S_{0}(d^{*})\subseteq S\). The case that (uvw) crosses two adjacent cubes can be considered similarly to the first case. Hence, we have proved that S is a vertex cover \(P_{3}\) set for \(G=(V, E)\).

Based on the above analysis, we complete the proof of the theorem. \(\square \)

4.3 Time complexity

In this subsection, we show that our algorithm runs in polynomial time. Phase 1 of our algorithm can be executed in polynomial time to obtain a \(\rho \)-approximation solution. Phase 3 can also be executed in polynomial time to find a path which connects \(S_{H}\) and \(S_{0}(d^{*})\). However, Phase 2 uses exhaustive search to achieve the desired solution. This is the most time consuming part, so we need to prove that this phase can also be completed within polynomial time.

Theorem 2

The running time of our algorithm is no more than \(n^{O(1/{\varepsilon ^{3}})}\), where n is the number of vertices in the graph.

Proof

In the Phase 2 of our algorithm, for each small cube e of \(P(d^{*})\) and a connected component \(H\in Comp(G_{e})\), we can use the exhaust search to obtain a subset \(S_{H}\subseteq V(H)\) such that \(S_{H}\) is a minimum weight connected vertex cover \(P_{3}\) set of H, i.e., the induced graph \(G[V(H)-S_{H}]\) will consist of isolated vertices and isolated edges only. Let \(t_0\) and \(t_1\) denote the number of isolated vertices and isolated edges in \(G[V(H)-S_{H}]\) respectively. It is easily seen that \(t_0 + t_1\) is less than the maximum number of independent unit balls in the cube e.

For each small cube e, in order to make all the whole balls whose centers are in the \(m\times m\times m\) cube lie completely in a specific cube, we need to enlarge the side length m of a cube to \(m+1\). Since each unit ball occupies volume \(\pi /6\), we can get that the number of independent unit balls in an \(m\times m\times m\) cube e is at most \(\lceil \frac{6(m+1)^{3}}{\pi }\rceil \). So we have

$$\begin{aligned} |V(H)-S_{H}|=t_0 + 2t_1\le 2t_0 + 2t_1\le 2\left\lceil \frac{6(m+1)^{3}}{\pi }\right\rceil . \end{aligned}$$

Now, in the following we show how to compute \(S_{H}\). Firstly, we enumerate all the induced subgraphs of H with no more than \(2\lceil \frac{6(m+1)^{3}}{\pi }\rceil \) vertices. Then, we find all induced subgraphs whose components do not contain a \(P_3\). Finally, we take complements and find the one which is connected with minimum total weight.

The above exhaustive search for \(S_{H}\) takes time at most

$$\begin{aligned} \sum _{i=0}^{2\left\lceil \frac{6(m+1)^{3}}{\pi }\right\rceil }{n_{H}\atopwithdelims ()i}=n_{H}^{O(m^{3})}, \end{aligned}$$

where \(n_{H}\) is the number of vertices in H, and the total running time for Phase 2 is at most

$$\begin{aligned} \sum _{e,H}n_{H}^{O\left( m^{3}\right) }=\left( \sum _{e,H}n_{H}\right) ^{O\left( m^{3}\right) }=n^{O(m^{3})}=n^{O(1/{\varepsilon ^{3}})}. \end{aligned}$$

(As we will see at the end of the proof of Theorem 3, \(m=\lceil \frac{[12+144(2c\beta ^{3}+c\beta ^{4})]\rho }{\varepsilon }\rceil \) is a suitable choice for our purposes.) So we prove the conclusion. \(\square \)

4.4 Performance analysis

In this section, we prove that our algorithm has performance ratio \((1+\varepsilon )\). Firstly, we introduce a lemma that will be used in this section, then give the performance ratio.

The following property for unit ball graph plays an important role in the approximation analysis.

Lemma 2

For any vertex u in a unit ball graph G, the neighborhood \(N_{G}(u)\) contains at most 12 independent vertices.

The proof of the Lemma 2 has been given in Zhang et al. (2009). For convenience of the readers, we also present the proof in the appendix.

Based on Definition 1, Lemmas 1, 2 and Theorem 1, we then show that our algorithm is a PTAS as follows.

Theorem 3

Suppose \(S^{*}\) is an optimal solution to the minimum weight connected vertex cover \(P_{3}\) set in unit ball graph G, and S is the output of our algorithm. Then we have

$$\begin{aligned} w(S)\le (1+\varepsilon )w(S^{*}). \end{aligned}$$

Proof

We prove our conclusion in three steps.

Firstly, we prove that

$$\begin{aligned} w(S_{0}(d^{*}))\le \frac{12\rho }{m}w(S^{*}), \end{aligned}$$
(4.1)

where m only depends on \(\varepsilon \) and c.

When we adopt the shifting strategy, it can be easily observed that a vertex of \(S_{0}\) appears at most 12 times in the boundary area of B(P(d))s (see Fig. 2). Therefore, we have

$$\begin{aligned} w(S_{0}(0))+w(S_{0}(1))+\cdots +w(S_{0}(m-1))\le 12w(S_{0}). \end{aligned}$$

Combining this with \(w(S_{0})\le \rho w(S^{*})\), we have

$$\begin{aligned} w(S_{0}(d^{*}))\le \frac{12\rho }{m}w(S^{*}). \end{aligned}$$

Secondly, we are to add some vertices to \(S^{*}\) such that the resulting vertex set \(\widetilde{S}\) satisfies the following two requirements:

  1. (a)

    For each small cube e and each component \(H\in Comp(G_{e}), \widetilde{S}\cap V(H)\) is a connected vertex cover \(P_{3}\) set of H.

  2. (b)

    \(w(\widetilde{S}\cap I_{e})\le w(S^{*}\cap I_{e})+12(c\beta ^{3}+c\beta ^{4})|S_{0}(d^{*})\cap e|\).

Then, we show that the path \(P_H\) in Phase 3 of the algorithm satisfies \(|P_{H}|\le 1\), and

$$\begin{aligned} w(S[e])\le 12c\beta ^{3}|S_{0}(d^{*})\cap e| \end{aligned}$$
(4.2)

Before showing how to construct \(\widetilde{S}\), and proving \(|P_{H}|\le 1\), we first show the theorem can be proved as long as the above two requirements are satisfied. In fact, it is easy to observe that in Phase 2 of our algorithm, \(S_{e}\) is a minimum weight connected vertex cover \(P_{3}\) set satisfying requirement (a), so we have \(w(S_{e})\le w(\widetilde{S}\cap I_{e})\).

Combining this with inequalities (4.1), (4.2) and requirement (b), and the assumption that every vertex has weight at least one in the Introduction, we have

$$\begin{aligned} w(S)&\le w(S_{0}(d^{*}))+\sum _{e\in P(d^{*})}w(S_{e})+\sum _{e\in P(d^{*})}w(S[e])\\&\le w(S_{0}(d^{*}))+\sum _{e\in P(d^{*})}\left[ w(S^{*}\cap I_{e})+12\left( c\beta ^{3}+c\beta ^{4}\right) |S_{0}(d^{*})\cap e|\right] \\&\quad +12c\beta ^{3}|S_{0}(d^{*})|\\&\le w(S_{0}(d^{*}))+w(S^{*})+12\left( 2c\beta ^{3}+c\beta ^{4}\right) |S_{0}(d^{*})|\\&\le w(S_{0}(d^{*}))+w(S^{*})+12\left( 2c\beta ^{3}+c\beta ^{4}\right) w(S_{0}(d^{*}))\\&\le \left( 1+\frac{[12+144\left( 2c\beta ^{3}+c\beta ^{4}\right) ]\rho }{m}\right) w(S^{*}). \end{aligned}$$

If we let \(m=\lceil \frac{[12+144(2c\beta ^{3}+c\beta ^{4})]\rho }{\varepsilon }\rceil \) in our algorithm, \(w(S)\le (1+\varepsilon )w(S^{*})\). Then, the theorem is proved.

In the following we show how to construct \(\widetilde{S}\) satisfying the requirements (a) and (b), and then prove \(|P_{H}|\le 1\).

For convenience, let \(S_{e}^{*}=S^{*}\cap I_{e}\) for a small cube e. It is easy to see that for each component \(H\in Comp(G_{e})\), \(S_{e}^{*}\cap V(H)\) is a vertex cover \(P_{3}\) of H. Suppose there exists a component \(H\in Comp(G_{e})\) such that condition (a) is not satisfied. According to the proof of Lemma 1, there are two components \(R_{1}, R_{2}\) of \(G[S_{e}^{*}\cap V(H)]\) such that \(R_{1}\) and \(R_{2}\) can be connected through one vertex or two vertices in \(V(H)\backslash S_{e}^{*}\). Add this vertex or two vertices into \(S_{e}^{*}\) to merge \(R_{1}\) and \(R_{2}\). It is easy to see that the new additional vertices are at most distance 2 away from some vertex of \(S_{0}\). By using the assumption that the weight is smooth and the condition of weak c-local, we obtain \(S_{0}\) by adding some additional vertices to F, so we can get that any \(u\in S_{0}, w(u)\le c\beta ^{2}\), the total weight of the two additional vertices are at most \(c\beta ^{3}+c\beta ^{4}\). Continue this procedure until \(S_{e}^{*}\) satisfies requirement (a). Suppose this is done by k times, we get the new set \(\widetilde{S_{e}^{*}}\) satisfies (a), then

$$\begin{aligned} w(\widetilde{S_{e}^{*}})\le w(S_{e}^{*})+k\left( c\beta ^{3}+c\beta ^{4}\right) . \end{aligned}$$
(4.3)

On the other hand, we can prove that

$$\begin{aligned} |S_{0}(d^{*})\cap e|\ge \frac{k}{12} \end{aligned}$$
(4.4)

For this purpose, we assume that the components merged are in the order of \(R_{1}\) with \(R_{2}, R_{3}\) with \(R_{4},\ldots \), and \(R_{2k-1}\) with \(R_{2k}\).

We assume, without loss of generality, that these components are all different. For each \(i=1,2,\ldots ,k, R_{2i-1}\) and \(R_{2i}\) are not connected in \(I_{e}\). Since \(R_{2i-1}\) is connected to the outer parts of e through \(S^{*}\), there are two cases to be distinguished.

The first case is that there only exists one vertex \(u_{i}\) lying in \(V(R_{2i-1})\cap B_{e}\cap I_{e}\), such that \(u_{i}\) is adjacent to a vertex \(w_{i}\in B_{e}\backslash I_{e}\). Since \(R_{2i-1}\) belongs to H, and the inner region \(I_{e}\) and the boundary region \(B_{e}\) have an overlap of width 2, there exists a vertex \(v_{i}\in V(H)\) adjacent to \(u_{i}\), where \(v_{i}\in B_{e}\cap I_{e}\). Hence, there exists a \(P_{3}\) path \(w_{i}u_{i}v_{i}\), where \(w_{i},u_{i},v_{i}\in B_{e}\), and at least one of the vertices of the path belongs to \(S_{0}\), denoted by \(z_{i}\). Therefore, \(z_{i}\in S_{0}(d^{*})\cap e\).

The second case is that there exists two vertices \(u_{i}, v_{i}\) lying in \(V(R_{2i-1})\cap B_{e}\cap I_{e}\), where \(u_{i}v_{i}\) is an edge of G such that \(u_{i}\) is adjacent to a vertex \(w_{i}\in B_{e}\backslash I_{e}\). Since \(w_{i}u_{i}v_{i}\) is a \(P_{3}\) path, we have \(z_{i}\in S_{0}(d^{*})\cap e\) by the same argument as the first case. Note that a vertex may be used more than once as \(z_{i}\). For instance, there may be two independent vertices \(x_{i}, y_{i}\) covered by the same vertex of \(S_{0}\), as they belong to different components of \(G[S^{*}\cap I_{e}]\). Then it follows from Lemma 2 that the number of times is no more than 12 when such a vertex serves as \(z_{i}\). Hence inequality (4.4) holds.

According to inequalities (4.3) and (4.4), we have

$$\begin{aligned} w(\widetilde{S_{e}^{*}})\le w(S_{e}^{*})+12\left( c\beta ^{3}+c\beta ^{4}\right) |S_{0}(d^{*})\cap e|. \end{aligned}$$

Let \(\widetilde{S}\) be the union of the modified \(\widetilde{S_{e}^{*}}\)’s, we can get

$$\begin{aligned} w(\widetilde{S}\cap I_{e})\le w(S^{*}\cap I_{e})+12\left( c\beta ^{3}+c\beta ^{4}\right) |S_{0}(d^{*})\cap e|. \end{aligned}$$

Finally, we consider each path \(P_{H}\). From our algorithm we know that \(P_{H}\) connects \(S_{H}\) and \(S_{0}(d^{*})\) with minimum total weight. Since the inner region \(I_{e}\) and the boundary region \(B_{e}\) of each small cube have an overlap area with width 2. So there exists a path \(P=(v_{0},v_{1},\ldots ,v_{t})\) connecting \(S_{H}\) and \(B_{e}\setminus I_{e}\). Let \(v_{0}\in S_{H}\) and \(v_{t}\in B_{e}\setminus I_{e}\). Then there must exist a vertex \(x\in \{v_{0}, v_{1}, v_{2}\}\) belonging to \(S_{0}(d^{*})\). If \(v_{1}\in S_{0}(d^{*})\), then \(S_{H}\) is connected with \(S_{0}(d^{*})\). If \(v_{2}\in S_{0}(d^{*})\), then by the minimality of the path \(P_{H}\), we have \(|P_{H}|\le 1\).

A vertex may be used more than once as x. So, by using the similar argument as above, we have

$$\begin{aligned} w(S[e])\le 12c\beta ^{3}|S_{0}\cap B_{e}\cap I_{e}|\le 12c\beta ^{3}|S_{0}(d^{*})\cap e| \end{aligned}$$

Based on the above conclusions, we complete the proof. \(\square \)

Fig. 2
figure 2

The trace of a vertex has at most 12 points lying in the boundary area

5 Conclusion

We presented a polynomial time approximation scheme for this problem on unit ball graphs with a given geometric representation, under the conditions that the problem is weak c-local and the weights is smooth. This problem is an extension of the minimum weight connected vertex cover problem for which, as far as we know, there is no constant-factor approximation algorithm or PTAS known in unit disk graphs or unit ball graphs without any additional restriction. We strongly believe that a completely different new approach is needed in the case the assumption of the weak c-local and smooth are dropped.

And we can easily extend the complexity result in Wang et al. (2015) and show that the decision version of the minimum weighted connected vertex cover \(P_{k}\) problem \((k\ge 4)\) is NP-complete for grid graphs. This is done in the Appendix. However, to our best knowledge, the hardness results on the “unweighted” version of this problem remains to be discovered. Furthermore, it is interesting to design and analyze approximation algorithms for the minimum weight connect vertex cover \(P_{3}\) problem in grid graphs. It is still open whether our results can be generalized to the minimum weight connect vertex cover \(P_{k}\) problem under the same assumption. These are problems of our future interest.