On graphs coverable by k shortest paths

06/30/2022
by   Maël Dumas, et al.
0

We show that if the edges or vertices of an undirected graph G can be covered by k shortest paths, then the pathwidth of G is upper-bounded by a function of k. As a corollary, we prove that the problem Isometric Path Cover with Terminals (which, given a graph G and a set of k pairs of vertices called terminals, asks whether G can be covered by k shortest paths, each joining a pair of terminals) is FPT with respect to the number of terminals. The same holds for the similar problem Strong Geodetic Set with Terminals (which, given a graph G and a set of k terminals, asks whether there exist k2 shortest paths, each joining a distinct pair of terminals such that these paths cover G). Moreover, this implies that the related problems Isometric Path Cover and Strong Geodetic Set (defined similarly but where the set of terminals is not part of the input) are in XP with respect to parameter k.

READ FULL TEXT VIEW PDF

page 1

page 2

page 3

page 4

02/24/2022

Polynomial Kernels for Tracking Shortest Paths

Given an undirected graph G=(V,E), vertices s,t∈ V, and an integer k, Tr...
08/17/2020

Drawing Shortest Paths in Geodetic Graphs

Motivated by the fact that in a space where shortest paths are unique, n...
11/22/2020

Algorithmic upper bounds for graph geodetic number

Graph theoretical problems based on shortest paths are at the core of re...
01/24/2020

Fixed-parameter tractable algorithms for Tracking Shortest Paths

We consider the parameterized complexity of the problem of tracking shor...
09/22/2018

Minimum Number of Test Paths for Prime Path and other Structural Coverage Criteria

The software system under test can be modeled as a graph comprising of a...
06/19/2019

Jaccard Filtration and Stable Paths in the Mapper

The contributions of this paper are two-fold. We define a new filtration...
04/25/2018

On the Structure of Unique Shortest Paths in Graphs

This paper develops a structural theory of unique shortest paths in real...

1 Introduction

Path problems such as Hamiltonian Path are among the most fundamental problems in the field of algorithms. Hamiltonian Path can be generalized as the covering problem Path Cover, where one asks to cover the vertices of an input graph using a prescribed number of paths. The corresponding packing problem is Disjoint Paths (here, given a set of pairs of terminal vertices of a graph , one asks whether there are vertex-disjoint paths in , each joining two paired terminals). Disjoint Paths is a fundamental problem and a precursor to the field of parameterized complexity due to the celebrated fixed-parameter tractable algorithm devised by Robertson and Seymour [RS95] for the parameter “number of paths”. We recall that in the field of parameterized algorithms and complexity, one studies parameterized problems, whose input comes together with a parameter . A parameterized problem is said to be FPT (fixed-parameter tractable) if it can be solved in time , for some computable function . If the problem can be solved in time , it belongs to class class ; see, e.g., [CFK+15] for more details.

In this paper, we will not consider arbitrary paths, but shortest paths, which are fundamental for many applications. In the problem Disjoint Shortest Paths, given a graph and pairs of terminals, one asks whether contains vertex-disjoint shortest paths pairwise connecting the pairs of terminals. This problem was introduced in [Eilam-Tzoreff98] and recently shown to be polynomial-time solvable for every fixed by an XP algorithm [Lochet21]. The problem Isometric Path Cover with Terminals, which we define as follows, is the covering counterpart of Disjoint Shortest Paths.

Isometric Path Cover with Terminals Input: A graph , and pairs of vertices called terminals. Question: Does there exist a set of shortest paths, the th path being an - shortest path, such that each vertex of belongs to at least one of the paths?

The name Isometric Path Cover with Terminals comes from the related Isometric Path Cover problem where the terminals are not part of the input, which was introduced in [IPC] in the context of the Cops and Robbers game on graphs (see also [AF84]).

Isometric Path Cover Input: A graph , and an integer . Question: Does there exist a set of shortest paths, such that each vertex of belongs to at least one of the paths?

Closely related variants of Isometric Path Cover with Terminals and Isometric Path Cover have been studied, in which there are only terminals, and one asks to find shortest paths joining each pair of terminals. The version without terminals has been called Strong Geodetic Set in the literature; we call the version with terminals Strong Geodetic Set with Terminals. It was first studied (independently) in [DIT21, BrazilMaster].

Strong Geodetic Set with Terminals Input: A graph , and a set of vertices of called terminals. Question: Does there exist a set of shortest paths, each path joining a distinct pair of terminals, such that each vertex of belongs to at least one of the paths?

The variant where the terminals are not given in the input was defined in [SGS] as follows.

Strong Geodetic Set Input: A graph , and an integer . Question: Does there exist a set of terminals and a set of shortest paths, each path joining a distinct pair of terminals, such that each vertex of belongs to at least one of the paths?

The complexity of these problems has been studied in the literature. Isometric Path Cover is NP-hard, even for chordal graphs, on which the problem can be approximated within a constant factor [FloManuscrit]. It was proven to be polynomial-time solvable on block graphs [IPC-block]. It is shown in [DIT21] that Strong Geodetic Set with Terminals is NP-hard. In [BrazilMaster], it is shown that this holds even for bipartite graphs of maximum degree 4 or diameter 6, however Strong Geodetic Set with Terminals is polynomial-time solvable on split graphs, graphs of diameter 2, block graphs, and cactus graphs. There is a straightforward reduction from Strong Geodetic Set with Terminals to Isometric Path Cover with Terminals, implying that the latter problem is NP-Complete. We describe such a reduction in Appendix A for the sake of completeness.

Finally, Strong Geodetic Set is known to be NP-hard [SGS], even for bipartite graphs, chordal graphs, graphs of diameter and cobipartite graphs [BrazilMaster] as well as for subcubic graphs of arbitrary girth [DIT21]. However it is polynomial-time solvable on outerplanar graphs [M20], cactus graphs, block graph and threshold graphs [BrazilMaster].

All these problems can also be studied in their edge-covering version, where one requires to cover all edges of the input graph by the corresponding shortest paths. For instance, the Strong Edge Geodetic Set problem is studied in [MKXAT17].

Our results

Our main combinatorial theorem is as follows (see Section 2 for the definition of pathwidth).

Theorem 1.

Let be a graph whose edge set can be covered by at most shortest paths. Then the pathwidth of is at most , for function .

If is such that its vertex set can be covered by at most shortest paths, then the pathwidth of is at most .

We actually show that in such graphs , given an arbitrary vertex and an integer , the number of vertices at distance exactly from is upper-bounded by a function of , that does not depend on the size of the input graph. It follows that a very simple linear-time algorithm based on a breadth-first search provides a path decomposition whose width is upper-bounded by the aforementioned function of . The complexity of the algorithm itself does not depend on .

Besides the combinatorial bounds, we employ the celebrated theorem of Courcelle [Courcelle90], stating that problems expressible in Monadic Second-Order Logic () can be solved in linear time for graphs of bounded treewidth (and thus, of bounded pathwidth). More precisely, we reduce problem Isometric Path Cover with Terminals to an optimization problem expressible in . The result can also be obtained by dynamic programming but we prefer the general logic-based framework for further extensions. The running time is linear in , the number of vertices of the graph, but super-exponential in the parameter . Together with Theorem 1, this implies the following.

Theorem 2.

Problems Isometric Path Cover with Terminals and Strong Geodetic Set with Terminals are FPT when parameterized by the number of terminals.

Moreover, this also entails the following.

Corollary 1.

Problems Isometric Path Cover and Strong Geodetic Set are in XP when parameterized by the number of terminals.

Thanks to the flexibility of Monadic Second-Order Logic, our algorithmic results easily extend to the edge-covering versions of our problems, and to variants where we require the paths to be edge-disjoint, or vertex-disjoint (as studied in [M20a]).

After some preliminaries in Section 2, we prove Theorem 1 in Sections 3 and 4. More specifically, Section 3 provides the upper bound on the pathwidth of graphs whose edges are coverable by shortest paths, then the tools are extended to vertex-coverings in the next section. Algorithmic consequences (Theorem 2) are derived in Section 5, and we conclude with some open questions.

2 Preliminaries and notations

Paths and concatenation operators and

We refer to [DiestelB] for usual notations on graphs. For simplicity, we consider that our input graph is connected, though all our combinatorial and algorithmic results extend to non-connected graphs. As usually denotes the neighborhood of vertex .

A path of graph is a sequence of distinct vertices such that for each , is an edge of the graph. We also say that is a - path. Note that our paths are simple, they do not use twice a same vertex. We denote by the vertices of path , and by its edges. Given two vertices , we denote by the subpath of between and . Moreover we let denote the length of path , that is, the number of its edges. The distance between two vertices and in is denoted and corresponds to the length of a shortest - path.

Throughout the paper, we will construct paths by concatenation operations. It is convenient to think of our paths as directed: when we speak of an - path, we think of it as being directed from to .

Given two paths and of such that is an edge of , we define the concatenation operator whose result is . In particular, .

We define similarly the glueing operator between two paths and by . Note that in this case .

Path decompositions through breadth-first search

A path decomposition of is a sequence of vertex subsets of , called bags, such that for every edge there is at least one bag containing both endpoints, and for every vertex , the bags containing form a continuous sub-sequence of . The width of is , and the pathwidth of is the minimum width over all path decompositions of .

The treewidth of graph is defined similarly (see e.g. [DiestelB]), using so-called tree decomposition; for our purpose, we only need to know that for any graph , , in particular any path decomposition is also a tree decomposition of same width. We also need the following folklore lemma on path decompositions.

Lemma 1.

Let be a graph, be a vertex of and be an upper bound on the number of vertices of at distance exactly from , for any integer .

Then, . Moreover, a path decomposition of width can be computed in linear time, by breadth-first search.

Proof.

Let be the eccentricity of vertex (i.e., ). For any with we denote by the set of vertices at distance exactly from , i.e. the layers of a breadth-first on starting at . Observe that, by taking as bags the unions of pairs of consecutive layers, , and by ordering them according to , we obtain a path decomposition of . Indeed for each edge both endpoints are in a same layer or in two consecutive layers, thus will appear in a same bag. For each vertex , it appears in at most two bags: if then is in bags and (or one bag if or ), and these bags appear consecutively in the decomposition. Since each layer has at most vertices, the width of this decomposition is at most . ∎

3 Warm-up: edge-covering with shortest paths

As a warm-up, we start by proving Theorem 1 in the case when graph is edge-coverable by shortest paths. In this case, there is a simple and elegant encoding of shortest paths leading to the desired result; the case of vertex-covering, more technical, will be studied in the next section.

In this section, denotes a graph whose edge set is coverable by shortest paths. Let us fix such a set of paths , and call them the base paths of . All constructions in this section are built on this particular set of base paths (without explicitly recalling it for each lemma, in order to ease the notations). We endow each base path with an arbitrary direction. E.g., assuming that the vertices of are numbered from to , the direction of path is from its smallest towards its largest end-vertex. A (directed) subpath of is given a positive sign if it follows the direction of , otherwise it is given a negative sign . For each edge of , let be the set of all values such that is an edge of .

Good colourings

Let be an - path of , from vertex to vertex . A colouring of is a function assigning to each edge of the path one of its colours . The colouring of is said to be good if, for any colour , the set of edges using this colour form a connected subpath of . (Since our paths are simple, this condition entails that .) A pair formed by a path together with a good colouring is called well-coloured.

Operator defined in Section 2 naturally extends to coloured paths. Given a coloured path , we simply denote by its restriction to a subpath of . Finally, we define for any path and any colour the function . Hence all edges of the coloured path have colour .

With these notations, any well-coloured - path with colours appearing in this order can be written as for some vertices . In full words, are the monochromatic subpaths of , coloured .

Lemma 2 (Good colouring lemma).

For any pair of vertices and of , there exists a well-coloured - path such that is a shortest - path.

We will simply call a well-coloured shortest - path.

Proof.

Among all shortest - paths, choose one that admits a colouring with a minimum number of monochromatic subpaths. Let be this path, and the corresponding colouring. Assume by contradiction that the colouring is not good. Then there exist three edges , and , appearing in this order, such that . Assume w.l.o.g. that the vertices appear in the order , from to . Let . Therefore and are on the same base path . Let be the path obtained from by replacing by . First, is no longer than , since is a shortest possible - path of graph . Second, in we can colour all edges of with colour , and keep all other colours unchanged. Hence has strictly fewer monochromatic subpaths than — a contradiction. ∎

Let be a well-coloured - path, with colours in this order. Recall that each monochromatic subpath of , of colour , induces a sign on the corresponding base path (positive if has the same direction as , negative otherwise). Therefore, we can define the colours-signs word on the alphabet , corresponding to the colours and signs of the monochromatic subpaths of , according to the ordering in which these subpaths appear from to . Observe that such words have at most letters on an alphabet of size . Therefore the number of different words is upper bounded by a function of :

Lemma 3.

The number of possible colours-signs words, over all well-coloured paths of , is upper bounded by .

Proof.

We claim that the number of colours-signs words of letters is upper bounded by . Observe that the colours form a word of length , on an alphabet of size , without repetition. The number of such words is (e.g., by choosing letters among the possible ones, and applying all possible permutations). Since each letter also has a sign in , we multiply this quantity by , and the conclusion follows by summing over all possible values of . ∎

The following crucial lemma implies that, given a start vertex , a distance and a colours-signs word , there is at most one vertex at distance from , such that the well-coloured shortest - path respects word . This will allow to upper bound the number of vertices at distance from .

Lemma 4 (Colours-signs encoding).

Consider two vertices and at same distance from some vertex of . Let be a well-coloured shortest - path and be a well-coloured shortest - path. If , then .

Proof.

We proceed by induction on the number of letters of the word . Let us denote it by .

Let (resp. ) be the maximal subpath of (resp. ) of colour starting from . Assume w.l.o.g. that is at least as long as . Since both are subpaths of , starting from and having the same sign w.r.t. , we actually have that is contained in , in particular is between and in and in .

Observe that, if word has only one letter, and , thus they are all of the same length. Since they are of the same sign w.r.t. , this implies that , which proves the base case of our induction.

Assume now that has letters and that the lemma is true for words of length .

Consider first the case when and have the same length. Then is also the first vertex of the subpaths of colour of both and . Then and are well-coloured shortest paths of the same length, and have the same colours-signs word , with letters. Hence the property follows by the induction hypothesis.

We now handle the second and last case, when is strictly longer than . Let be the last vertex of the subpath coloured in . In particular, and are all vertices of .

Let us make an easy but crucial observation: on , vertex is between and . To prove this claim, note that in path , vertices , and appear in this order (as observed in the beginning of the proof), and by construction appears between and . Therefore appear in this order on , which is a shortest path. Hence . Since the three vertices are all on the shortest path , they must appear in this order on the latter. Consequently, induces the same sign on as .

In particular, in the path , we can replace the first subpath coloured by , coloured , without changing the total length. We obtain the well-coloured shortest - path . Its colours-signs word is , the same as for the shortest - path . Moreover, the two paths have the same length, , hence by the induction hypothesis we have , which proves our lemma. ∎

Corollary 2.

For any vertex of and any integer , there are at most vertices at distance exactly from .

Proof.

For any fixed vertex and fixed fixed integer , thanks to Lemma 4 the number of vertices at distance exactly from is upper-bounded by the number of colours-signs words, which is in turn upper bounded by by Lemma 3. ∎

In order to complete the proof of the first part of Theorem 1 and show that , we simply apply Lemma 1 with .

4 Vertex-covering with shortest paths

In this section, denotes a graph whose vertices can be covered by shortest paths . As before we endow each base path with a direction, but now colours are assigned to vertices. We can easily adapt the notions of good colourings of the previous section to these vertex-colourings. Again, for any pair of vertices and , there is a well-coloured shortest path joining them (Lemma 5), which defines a colours-signs word. But we shall see that now (unlike in the simpler case of edge-coverings), we may have two distinct vertices and at a same distance from , and well-coloured shortest - and - paths with a same colours-signs word. More efforts will be needed to recover a (slightly larger) upper bound on the number of vertices at distance from (Corollary 4).

Good colourings

For each vertex of , let denote the set of indices (colours) such that is a vertex of . Let be an - path of , from vertex to vertex . A colouring of is a function assigning to each vertex of one of its colours . A coloured path is a pair . The colouring of is said to be good if, for any colour , the subgraph induced by the set of vertices using this colour forms a connected subpath of (which implies that ). A coloured path where is a good colouring is called well-coloured.

Operators and naturally extend to (vertex) coloured paths, with the precaution that is defined only when their common vertex , the last of and first of , satisfies . Given a coloured path , we again denote by its restriction to a subpath of . For each colour , let now denote the monochromatic colouring of with colour .

With these notations, any well-coloured - path with colours is of the form for some vertices , as in Figure 2.

Like in the previous section, we have:

Lemma 5.

For any pair of vertices and of , there exists a well-coloured shortest - path.

Proof.

Among all shortest - paths, choose one that admits a colouring with a minimum number of monochromatic subpaths. Let be such a coloured path. Assume for a contradiction that the colouring is not good. Then there exist three vertices and , appearing in this order in such that . Therefore and are on a same base path . Let be the path obtained from by replacing by . Notice that is no longer than , since is a shortest - path of graph . Moreover, in we can colour all vertices of with colour , and keep all other colours unchanged. Hence has strictly fewer monochromatic subpaths than — a contradiction. ∎

Colours-signs word

Let be a well-coloured - path; we recall that we see it as being directed from to . As in Section 3, each monochromatic subpath of , say of colour , induces a sign ( or ) depending on its direction w.r.t. , if has at least two vertices. If has a unique vertex, we assign to it sign . Therefore, we can again define the colours-signs word on the alphabet , corresponding to the colours and signs of the monochromatic subpaths of according to the ordering in which these subpaths appear from to .

In the case of edge-covering, we had the elegant statement of Lemma 4, by which, given a vertex , a colours-signs word and a distance , there is a unique vertex at distance such that the well-coloured shortest - path corresponds to this word. Unfortunately, this does not extend to vertex-covering: Figure 1 presents two distinct vertices and located at a same distance from vertex , together with a well-coloured shortest - path and a well-coloured shortest - path . These coloured paths starting from have the same colours-signs word and the same length, but this does not imply that their endpoints are equal.

Figure 1: Two well-coloured paths and with same colours-signs word , same length (5) and same start vertex (), but different end-vertices ( and ).

Canonical well-coloured paths

In order to obtain a situation somewhat similar to the case of edge-covering, we define a canonical representation of well-coloured paths (see Figure 2 for an example). Given a colours-signs word with no repetition of colours, a start vertex and a length , we define a unique well-coloured path starting from , of the prescribed length and having the colours-signs word , as follows:

  1. If , let be the vertex at distance of on the path w.r.t. . Then :

  2. Otherwise, let be the first vertex of starting from w.r.t. having a neighbour in . Among the vertices of adjacent to , choose to be the one that appears first in , according to its direction. We let:

    (1)

Note that the path might not exist, e.g. if, in the base case of the construction, or the subpath of starting from and following sign is shorter than or, in the second step, vertex does not exist, or exceeds .

Observation 1.

Given a colours-signs word , a vertex and a length , if the path exists, then it is well-coloured. Moreover, this path is unique and satisfies .

Proof.

Notice first that, by construction, we have and which implies the last part of the statement. Now since this path is recursively obtained by the concatenation of monochromatic (simple) subpaths (Equation 1), it is well-coloured. The uniqueness of path comes from the deterministic choices made during the algorithm, which concludes the proof. ∎

Figure 2: A canonical well-coloured - path with .
Definition 1 (canonical well-coloured path).

A well-coloured - path is called canonical if .

To obtain a result similar to Lemma 4, we provide an algorithm that takes as input a well-coloured - path , the corresponding good colouring with colours, and that computes a canonical well-coloured - path whose length is upper-bounded by (see Algorithm 1 and Lemma 6). As before, let be the colours-signs word of and for each , let (resp. ) denote the first (resp. last) vertex of coloured . Informally, the algorithm recursively computes a coloured path as follows: if , we let . Otherwise, we consider as the first vertex of (hence, of starting from following sign ) having a neighbour in (line 1). As in the definition of the function, we choose the neighbour of to be the vertex of that appears first on this path, according to its direction, among the neighbours of (line 1). We next replace by (see line 1 and Figure 3), and then re-apply the transformation on the new path starting from (line 1).

Input : A well-coloured - path
Output : A canonical well-coloured - path
1 Function ():
2       if  then
3             return ;
4            
      /* first vertex of starting from w.r.t. having a neighbour in */
5       first vertex of having a neighbour in ;
6       vertex of that appears first on according to its direction;
       /* is replaced by */
7       ;
8       return ;
9      
Algorithm 1 Function computing the canonical well-coloured path .
Lemma 6 (canonization of well-coloured paths).

Given a well-coloured - path (, with a colours-signs word of letters, the result of is a canonical well-coloured - path of length at most .

Proof.

Denote and let be its colours-signs word. We first claim that is a canonical well-coloured path, i.e. equal to (Definition 1). In order to prove the claim we proceed by induction on the number of colours of . The property is true if has a unique colour, since in this (base) case, and (line 1 of Algorithm 1).

Otherwise, by induction, is formed by concatenated with , where is a well-coloured - path with different colours. Let be the colours-signs word of . By the induction hypothesis, . Moreover, for constructing path we started from along following sign until we reached the first vertex adjacent to vertex of , and concatenated it with the canonical - path , as in the definition of the function. Therefore, path is canonical for the triple .

Figure 3: The construction of .

It remains to show that the length of is at most . We proceed again by induction on . The property is true if since . Otherwise, for , recall that where and is a well-coloured - path with different colours (by lines 1 and 1 of Algorithm 1). Now we show that:

(2)

We recall that in the well-coloured path , denotes the last vertex on such that and the first vertex on such that . In particular (see Figure 3),

while can be described by

Therefore, in order to prove Inequality 2, we need to show that

(3)

Observe that , otherwise would not be a shortest - path since the - path would be of length , thus shorter. Next, observe that no matter in which order the vertices and appear on . These observations prove Inequality 3, which proves Inequality 2.

Inequality 2 entails that . By the induction hypothesis on , since uses colours, we have that . Thus

Now since we have that . Plugging this into the previous inequality we have , which completes the proof of our lemma. ∎

Corollary 3 (canonical representation).

Given two vertices and , there exists a canonical well-coloured - path such that .

Proof.

Let be a shortest well-coloured - path, which exists by Lemma 5. By Lemma 6, is the required canonical well-coloured - path, of length . ∎

In particular, Lemma 6 implies the following.

Corollary 4.

Let be a graph whose vertices are covered by shortest paths. For any vertex of and any fixed distance , there are at most vertices at distance from , where:

Proof.

For any fixed vertex and fixed length , the number of vertices that can be reached from through a canonical well-coloured path of length is upper bounded by , the number of colours-signs words, by Lemma 3. Moreover for each vertex , by Corollary 3, there exists a canonical well-coloured - path such that . Therefore the number of vertices at a fixed distance from in is at most . Indeed, vertex is uniquely identified by , the colours-signs word of the well-coloured path , and the quantity . The latter has