In this section, we present the proofs of correctness of the Procedure SHIFT (Lemma 1) and Algorithm CPP (Theorem 4).
Lemma 1
LetPθbe a smallest power of a path that containsGl−1=G[v1,…,vl−1] as an induced subgraph, with respect to the orderingv1<⋯<vl−1. Letv
l
∈V(G) be the next vertex inserted inPθand\(v_{l-t-1}v_{l} \not\in E(G), \ v_{l-t}v_{l} \in E(G)\)and\(d_{P_{n_{\theta}}}(v_{l-t}, v_{l})= \theta+1\). Then, the output of the Procedure SHIFT, the power of a pathPθ+1, is a smallest power of a path that containsG
l
=G[v1,…,vl−1,v
l
] as an induced subgraph, with respect to the orderingv1<⋯<vl−1<v
l
.
Proof
Since \(v_{l-t-1}v_{l} \not\in E(G)\), vl−tv
l
∈E(G) and \(\theta+1=\allowbreak d_{P_{n_{\theta}}}(v_{l-t}, v_{l})\), the Procedure SHIFT must increase the power θ by one unit (Step 1). But the increase of θ to θ+1 creates several adjacencies in Pθ between pairs of vertices of the set {v1,…,v
l
} that are non-adjacent in G. In order to preserve the adjacencies and non-adjacencies between vertices of G in Pθ, Procedure SHIFT is forced to insert one vertex between the vertex that received vl−t−1 in Pθ and its consecutive vertex in Pθ. Again, counting in descending order from vertex vl−t−1, the adjacencies were violated in each “block” of θ vertices in Pθ. So, the procedure must insert one vertex to each θ+1 vertices in descending order, from vertex vl−t−1 in Pθ. We observe that the set formed by the initial vertices of V(Pθ) has cardinality less than or equal to θ+1, because dividing \(\mathrm {order}_{P^{\theta}}(v_{l-t-1}) \ \) by θ+1 the remainder is greater than or equal to 1 and less than or equal to θ+1.
In each step, the procedure inserts the smallest number of vertices necessary to guarantee that the power of a path Pθ+1, created by Procedure SHIFT, contains G
l
[v1,…,v
l
] as an induced subgraph. So, the power θ+1 and the number of inserted vertices are minimum and, consequently, Pθ+1 is a smallest power of a path that contains G
l
[v1,…,v
l
] as an induced subgraph. □
First, we prove that Algorithm CPP correctly returns a smallest power of a path according to the ordering given by Algorithm Recognize [3].
Lemma 2
LetGbe a connected unit interval graph. Algorithm CPP generates the smallest power of a path\(P_{n_{\theta}}^{\theta}\), with respect toθandn
θ
, that containsGas an induced subgraph according to the orderingv1<⋯<v
n
given by the input of CPP.
Proof
Algorithm CPP constructs a sequence of powers of paths \(P^{\theta_{0}} \subseteq P^{\theta_{1}} \subseteq \cdots \subseteq P^{\theta}\), where θ
i
=θi−1+1. This is done by successively adding, in each \(P^{\theta_{i}}\), vertices of G following the input ordering, preserving the adjacencies and non-adjacencies between vertices of G and minimizing θ and n
θ
. Initially, the power of a path \(P^{\theta_{0}}\) receives the maximal clique containing v1, i.e., \(V(P^{\theta_{0}}) =\{u_{1}, \ldots, u_{\xi_{P^{\theta_{0}}}(v_{1})}\}\) and θ0=ξ
G
(v1)−1. This is the smallest power of a path that contains \(G[v_{1}, \ldots, v_{\xi_{G}(v_{1})}]\) as an induced subgraph.
Suppose that the l−1 first vertices, i.e., {v1,…,vl−1}, were already been inserted by Algorithm CPP in the power of a path Pθ, i.e., Pθ is the smallest power of a path, with respect to θ and n
θ
that contains G[v1,…,vl−1] as an induced subgraph. Let v
l
∈V(G) the next vertex to be inserted by Algorithm CPP in Pθ. Suppose that v
l
is adjacent, in Pθ, to {vl−t,…,vl−1}. Vertex v
l
must be inserted in Pθ between positions \(\xi_{P^{\theta}}(v_{l-t-1})+1\) and \(\xi_{P^{\theta}}(v_{l-t})\) so that G[v1,…,v
l
] be an induced subgraph of Pθ. Then, \(d_{P_{n_{\theta}}}(v_{l-t-1}, v_{l}) \geq \theta+1\) and \(d_{P_{n_{\theta}}}(v_{l-t}, v_{l}) \leq \theta\). We consider two cases with respect to the adjacencies of v
l
in G. From now on, we refer to Fig. 2, and Fig. 3 and Fig. 4, where dashed lines represent adjacencies.
Case 1: If t=θ, then after insertion of v
l
, \(\theta + 1 \leq d_{P_{n_{\theta}}}(v_{l-t-1},v_{l})\), because the set {vl−t,…,vl−1} has t=θ elements (see Fig. 2). In order to minimize θ and n
θ
, Algorithm CPP must insert v
l
in the consecutive vertex to vl−1 in the power of a path Pθ, and as a consequence \(d_{P_{n_{\theta}}}(v_{l-t}, v_{l}) \leq \theta + 1\). In effect, since vl−1 is adjacent to vl−t in Pθ, by hypothesis, vl−1 was inserted in Pθ such that \(d_{P_{n_{\theta}}}(v_{l-t}, v_{l-1}) \leq \theta\) and v
l
was inserted in the consecutive vertex to vl−1 in Pθ, then the claim is true. If \(d_{P_{n_{\theta}}}(v_{l-t}, v_{l}) \leq \theta\), Algorithm CPP inserted v
l
without changing θ, the number of vertices of Pθ became n
θ
+1, and so this insertion was minimum. If \(d_{P_{n_{\theta}}}(v_{l-t},v_{l}) = \theta+1\), Algorithm CPP called the Procedure SHIFT and, by Lemma 1, we conclude the proof.
Case 2: If 1<t<θ, Algorithm CPP must insert v
l
in Pθ such that \(d_{P_{n_{\theta}}}(v_{l-t-1}, v_{l}) \geq \theta + 1\) so that vl−t−1 and v
l
are not adjacent. We observe the position of vl−1 in Pθ. If vl−1 is not adjacent to vl−t−1 in Pθ (see Fig. 3), in order to minimize the number of vertices of Pθ, Algorithm CPP inserts v
l
in the consecutive vertex to vl−1. By hypothesis, vertex vl−1 was inserted in Pθ so that \(d_{P_{n_{\theta}}}(v_{l-t}, v_{l-1})\leq \theta\). Then, if \(d_{P_{n_{\theta}}}(v_{l-t}, v_{l-1}) < \theta\), we have \(d_{P_{n_{\theta}}}(v_{l-t}, v_{l}) \leq \theta\). Thus v
l
was inserted in Pθ without changing θ, the number of vertices of Pθ became n
θ
+1, and so this insertion was minimum. If \(d_{P_{n_{\theta}}}(v_{l-t}, v_{l-1}) = \theta\), we have \(d_{P_{n_{\theta}}}(v_{l-t},v_{l}) = \theta + 1\), Procedure SHIFT was called and, by Lemma 1, we conclude the proof.
If vl−1 is adjacent to vl−t−1 in Pθ (see Fig. 4), the position of vl−t−1 in Pθ is between l−t+1 and \(\xi_{P^{\theta}}(v_{l-t-1})\), including them. Again, in order to minimize the number of vertices of Pθ, vertex v
l
is inserted \((\xi_{P^{\theta}}(v_{l-t-1}) - \mathrm {order}_{P^{\theta}}(v_{l-1}))\) vertices after vertex vl−1 in Pθ. Thus,
Since \(d_{P_{n_{\theta}}}(v_{l-t}, v_{l}) < d_{P_{n_{\theta}}}(v_{l-t-1}, v_{l}) = \theta +1\), we have \(d_{P_{n_{\theta}}}(v_{l-t}, v_{l}) \leq \theta\). So, v
l
was inserted in Pθ without changing θ, and the number of vertices of Pθ became \(n_{\theta}+(\xi_{P^{\theta}}(v_{l-t-1}) - \mathrm {order}_{P^{\theta}}(v_{l-1}))+1\). This insertion was minimum, because \(d_{P_{n_{\theta}}}(v_{l-t-1}, v_{l}) = \theta +1\).
This concludes the proof of the Lemma 2. □
In order to show that the Algorithm CPP returns the smallest power of a path containing G as an induced subgraph, we present two results with a given power of a path Pσ containing G as an induced subgraph. First, we shall give some notation from [3]. Given an unit interval graph G and an unit interval model associated to its vertices I={v1,v2,…,v
n
}, we recall that the interval associated to vertex v is (a
v
,b
v
). We say that v1,v2,…,v
n
is a natural labeling for the vertices of G, if \(a_{v_{i}} \leq a_{v_{i+1}}\), for each 1≤i≤n−1. The ordering v1<v2<…<v
n
is a natural ordering, if v1,v2,…,v
n
is a natural labeling for V(G). A vertex is a left anchor if it can receive the label v1 in some natural labeling for V(G). Consider the model I′ obtained by mirroring an unit interval model I (that is, replacing each interval (a,b) by (−b,−a)). Model I′ is also a valid unit interval model for G, so the rightmost interval in I is also a left anchor.
In the next results, we show properties of the ordering of V(G) induced by a natural ordering that is generated by the subscripts of a natural labeling of a power of a path.
Lemma 3
Let\(P_{n_{\sigma}}^{\sigma}\)be a power of a path that containsGas an induced subgraph. The ordering of the vertices ofV(G) induced by a natural ordering of the vertices ofV(Pσ) satisfies Property 2.
Proof
Suppose that this ordering of V(G) does not satisfy Property 2. Then, there exist three vertices v
r
,v
s
,v
t
∈V(G) such that v
r
<v
s
<v
t
with \(v_{r}v_{s}\not\in E(G)\) and v
r
v
t
∈E(G). It follows that v
r
v
t
∈E(G)⊂E(Pσ). Therefore, \(1\leq |\mathrm {order}_{P^{\sigma}}(v_{r}) - \mathrm {order}_{P^{\sigma}}(v_{t})|\leq \sigma\). Since v
r
<v
s
<v
t
in V(Pσ), we have \(|\mathrm {order}_{P^{\sigma}}(v_{r}) - \mathrm {order}_{P^{\sigma}}(v_{s})|\leq |\mathrm {order}_{P}(v_{r}) - \mathrm {order}_{P}(v_{t})|\), and then \(1\leq |\mathrm {order}_{P^{\sigma}}(v_{r}) - \mathrm {order}_{P^{\sigma}}(v_{s})|\leq \sigma\). Consequently, v
r
v
s
∈E(Pσ) and \(v_{r}v_{s} \not\in E(G)\), i.e., \(P_{n_{\sigma}}^{\sigma}\) does not contain G as an induced subgraph. □
Vertices \(v, \overline{v} \in V(G)\) are indistinguishable vertices (twin vertices) if \(N_{G}[v] = N_{G}[\overline{v}]\). The next result states that it is possible to change the position, between indistinguishable vertices of V(G) in a natural ordering of V(Pσ).
Lemma 4
Letv, \(\overline{v} \in V(G)\)such that\(N_{G}[v] = N_{G}[\overline{v}]\)withv=u
i
and\(\overline{v} = u_{j}\)inV(Pσ). If we change the positions of verticesvand\(\overline{v}\)inPσ, i.e., v=u
j
and\(\overline{v} = u_{i}\), graphGwill still be an induced subgraph ofPσ.
Proof
Without loss of generality, suppose i<j. By Lemma 3, the ordering of V(G) induced by a natural ordering of V(Pσ) satisfies Property 2. So, \(N_{G}[v]=\{v_{\eta_{G}(v)},\ldots, v_{\xi_{G}(v)}\}\) and \(N_{G}[\overline{v}]=\{v_{\eta_{G}(\overline{v})}, \ldots,v_{\xi_{G}(\overline{v})}\}\). Since \(N[v] = N[\overline{v}]\), we have \(\xi_{G}(\overline{v}) =\xi_{G}(v)\) and \(\eta_{G}(\overline{v}) = \eta_{G}(v)\). Then, \(v_{\xi_{G}(v)} =v_{\xi_{G}(\overline{v})}\), \(v_{\eta_{G}(v)} = v_{\eta_{G}(\overline{v})}\), \(v_{\xi_{G}(v)+1}=v_{\xi_{G}(\overline{v})+1}\) and \(v_{\eta_{G}(v)-1} = v_{\eta_{G}(\overline{v})-1}\). Thus, by changing the positions of vertices v and \(\overline{v}\) in Pσ, we have \(\mathrm {order}_{P^{\sigma}}(\overline{v}) - \mathrm {order}_{P^{\sigma}}(v_{\eta_{G}(\overline{v})-1}) \geq \sigma +1\); then edge \(\overline{v}v_{\eta_{G}(\overline{v})-1} \not\in E(P^{\sigma})\). Also, for any v′∈V(G) with \(\mathrm {order}_{G}(v') < \mathrm {order}_{G}(v_{\eta_{G}(\overline{v})-1})\), edge \(\overline{v}v' \not\in E(P^{\sigma})\). Similarly, \(\mathrm {order}_{P^{\sigma}}(v_{\xi_{G}(v)+1}) - \mathrm {order}_{P^{\sigma}}(v)\geq \sigma + 1\), i.e., edge \(vv_{\xi_{G}(v)+1} \not\in E(P^{\sigma})\) and also, for any v′∈V(G) with \(\mathrm {order}_{G}(v_{\xi_{G}(v)+1}) < \mathrm {order}_{G}(v')\), edge \(vv' \not\in E(P^{\sigma})\).
Analogously, \(\sigma \geq \mathrm {order}_{P^{\sigma}}(\overline{v})- \mathrm {order}_{P^{\sigma}}(v_{\eta_{G}(v)})\), i.e., edge \(\overline{v}v_{\eta_{G}(\overline{v})} \in E(P^{\sigma})\) and, for any v′∈V(G) with \(\mathrm {order}_{G}(v_{\eta_{G}(\overline{v})}) < \mathrm {order}_{G}(v') < \mathrm {order}_{G}(\overline{v})\), edge \(\overline{v}v' \in E(P^{\sigma})\). Similarly \(\sigma \geq \mathrm {order}_{P^{\sigma}}(v_{\xi_{G}(\overline{v})}) - \mathrm {order}_{P^{\sigma}}(v)\), i.e., edge \(vv_{\xi_{G}(v)} \in E(P^{\sigma})\) and, for any v′∈V(G) with \(\mathrm {order}_{G}(v) < \mathrm {order}_{G}(v') <\mathrm {order}_{G}(v_{\xi_{G}(v)})\), edge vv′∈E(Pσ). □
In what follows, we denote by v
i
<
B
v
j
if order
G
(v
i
)<order
G
(v
j
) considering the ordering of V(G) given by Algorithm Recognize [3]. First, Theorem 4, we need two results.
Theorem 3
(Theorem 2.2 [3])
LetIbe an unit interval model of an unit interval graphGwith natural labelingv1,…,v
n
. Then, for all vertices\(\bar{v},\ v \in V(G)\), if\(a_{\bar{v}} < a_{v}\)but\(v <_{B} \bar{v}\), we have\(N_{G}[v]=N_{G}[\bar{v}]\).
As consequence of Theorem 2.3 of [3], we have the following result.
Lemma 5
([3])
Let\(v'_{1} <_{B} v'_{2} <_{B} \cdots <_{B} v'_{n}\)be an ordering ofV(G) given by Algorithm Recognize [3] of an unit interval graphG. Given a natural labelingv1,…,v
n
then\(N_{G}[v'_{1}]=N_{G}[v_{1}]\)or\(N_{G}[v'_{1}]=N_{G}[v_{n}]\).
Finally, the correctness of Algorithm CPP is given by theorem below.
Theorem 4
LetGbe an unit interval graph. Algorithm CPP returns the smallest power of a path\(P^{\theta}_{n_{\theta}}\)with respect toθandn
θ
, that containsGas an induced subgraph.
Proof
Let \(P^{\sigma}_{n_{\sigma}}\) be the smallest power of a path that contains G as an induced subgraph. Let \(\overline{u}_{1} < \cdots < \overline{u}_{n_{\sigma}}\) be a natural ordering of V(Pσ) and let \(\overline{v}_{1} < \cdots < \overline{v}_{n}\) be the ordering of V(G) induced by the natural ordering of V(Pσ). Clearly, \(\overline{v}_{1}, \ldots, \overline{v}_{n}\) is a natural labeling of V(G). Let I be a family of intervals for this labeling of V(G), such that each v∈V(G) is associated to (a
v
,b
v
)∈I.
If we prove \(\overline{v}_{1} < \overline{v}_{2} < \cdots < \overline{v}_{n}\) is equal to \(v'_{1} <_{B}v'_{2} <_{B} \cdots <_{B} v'_{n}\) up to indistinguishable vertices, we have θ=σ and n
θ
=n
σ
. In fact, since Pσ is the smallest power of a path that contains G as an induced subgraph, then σ≤θ and n
σ
≤n
θ
. On the order hand, by Lemma 2, the power of a path Pθ returned by Algorithm CPP is the smallest power of a path that contains G as an induced subgraph with respect to the ordering, \(v'_{1}<_{B} v'_{2} <_{B} \cdots <_{B} v'_{n}\). So, if this ordering is equal to \(\overline{v}_{1} < \overline{v}_{2} < \cdots < \overline{v}_{n}\), up to indistinguishable vertices, by Lemma 4, Pσ contains G as an induced subgraph with respect to the ordering \(v'_{1} <_{B} v'_{2} <_{B}\cdots <_{B} v'_{n}\). Then, by minimality of θ and n
θ
with respect to \(v'_{1} <_{B} v'_{2} <_{B}\cdots <_{B} v'_{n}\), we have σ≥θ and n
σ
≥n
θ
.
First, suppose that the left anchor \(\overline{v}_{1}\) is equal to \(v'_{1}\). Suppose, by absurd, that there exist \(v, \ \tilde{v} \in V(G)\), such that \(v < \tilde{v}\), \(\tilde{v} <_{B} v\) and \(N_{G}[v] \neq N_{G}[\tilde{v}]\). Since \(v < \tilde{v}\) then \(a_{v} \leq a_{\tilde{v}}\). If \(a_{v} = a_{\tilde{v}}\), since all intervals of I have the same length, we have \(b_{v} = b_{\tilde{v}}\) and hence \(N_{G}[v] =N_{G}[\tilde{v}]\) a contradiction to the hypothesis. If \(a_{v} < a_{\tilde{v}}\), since \(\tilde{v} <_{B} v\) then, by Theorem 3, \(N_{G}[v] = N_{G}[\tilde{v}]\), a contradiction to the hypothesis. Thus, for all pair of vertices \(v, \tilde{v} \in V(G)\) such that \(v < \tilde{v}\) and \(\tilde{v} <_{B} v\), then \(N_{G}[v] = N_{G}[\tilde{v}]\). Consequently, we have σ=θ and n
σ
=n
θ
.
Now, suppose that the left anchor \(\overline{v}_{1}\) is different from \(v'_{1}\). By Lemma 5, either \(N_{G}[\overline{v}_{1}] = N_{G}[v'_{1}]\) or \(N_{G}[\overline{v}_{n}] =N_{G}[v'_{1}]\). If \(N_{G}[\overline{v}_{1}] = N_{G}[v'_{1}]\), by Lemma 4, we can change the positions of these vertices in V(Pσ), i.e., \(\overline{u}_{\mathrm {order}_{P^{\sigma}}(v'_{1})}=\overline{v}_{1}\) and \(\overline{u}_{\mathrm {order}_{P^{\sigma}}(\overline{v}_{1})} = v'_{1}\) and G will still be an induced subgraph of Pσ. After this change \(v'_{1} < \overline{v}_{2} < \cdots <\overline{v}_{1} < \cdots < \overline{v}_{n}\) is the new ordering of V(G) induced by the ordering of V(Pσ). We repeat the same argument used in the previous case, where \(\overline{v}_{1}\) is equal to \(v'_{1}\) and we conclude the proof. If \(N_{G}[\overline{v}_{n}] = N_{G}[v'_{1}]\), since \(\overline{v}_{n}\) is the left anchor of the natural labeling \(\overline{v}_{n} < \overline{v}_{n-1} <\cdots < \overline{v}_{1}\) of V(G) induced by the natural ordering \(\overline{u}_{n_{\sigma}} < \cdots < \overline{u}_{1}\) of V(Pσ) then, we can repeat the previous argument for the natural labeling \(\overline{v}_{n} < \overline{v}_{n-1} < \cdots < \overline{v}_{1}\) and so we conclude the proof. □
The Algorithm CPP analyzes each vertex of G in the ordering returned by Algorithm Recognize [3] a single time. In the worst case, the Algorithm CPP calls Procedure SHIFT for each vertex v
l
∈V(G) only once. Since for each vertex v
l
the Procedure SHIFT analyzes the set of vertices of G
l
at most once, the complexity of the Algorithm CPP is \(\mathcal{O}(n^{2})\).