 # Computing metric hulls in graphs

We prove that, given a closure function the smallest preimage of a closed set can be calculated in polynomial time in the number of closed sets. This confirms a conjecture of Albenque and Knauer and implies that there is a polynomial time algorithm to compute the convex hull-number of a graph, when all its convex subgraphs are given as input. We then show that computing if the smallest preimage of a closed set is logarithmic in the size of the ground set is LOGSNP-complete if only the ground set is given. A special instance of this problem is computing the dimension of a poset given its linear extension graph, that was conjectured to be in P. The intent to show that the latter problem is LOGSNP-complete leads to several interesting questions and to the definition of the isometric hull, i.e., a smallest isometric subgraph containing a given set of vertices S. While for |S|=2 an isometric hull is just a shortest path, we show that computing the isometric hull of a set of vertices is NP-complete even if |S|=3. Finally, we consider the problem of computing the isometric hull-number of a graph and show that computing it is Σ^P_2 complete.

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1. Introduction

We study the complexity of several algorithmic problems arising from metric hulls in graphs. Let be a graph. A set is convex if, for any , any -shortest path in is included in . The convex hull of a set is the smallest convex set containing . A (convex) hull set of is a set such that . The hull-number of is the size of a minimum hull set of . Let be a convex set of , let denote the size of a minimum set such that . The hull-number was introduced in , and since then has been the object of numerous papers, in particular because this may model contamination spreading processes. Most of the results on the hull number are about computing good bounds for specific graph classes, see e.g. [9, 16, 7, 6, 12, 8].

While computing the convex hull of a set vertices can be done in polynomial time, computing the hull-number of a graph is known to be NP-complete  and remains so even if is a bipartite graph  or moreover a partial cube , i.e., an isometric subgraph of a hypercube. It is well-known, that the function is a closure, where generally a function , is called closure if it satisfies the following conditions for all sets

• (extensive)

• (increasing)

• (idempotent)

This leads to the following generalization of the hull-number of a graph, that we call Minimum Generator Set (MGS):

Given a set , a polytime computable closure and an integer , is there a set with such that ?

Together with the results about the hull-number it follows that MGS is NP-complete. However, in  it was conjectured, that MGS is solvable in polynomial time if the set of images of is part of the input. Our first result is to prove this conjecture under the weaker assumption of having a pseudo-closure, which is what we call if it only satisfies for any . More precisely, we devise an algorithm that finds minimum generating sets for all images of in polynomial time (in , and the computation time of ) (Theorem 2.3). Pseudo-closures embody a large class of objects. In particular, closures are essentially the same as lattices (see the discussion above Question 2.9). Thus, deciding whether for an element in a lattice there are join-irreducibles, whose join is , can be done in polynomial time. Lattices encode many combinatorial objects (for the cases below see [17, 20]). Thus, our results for instance yield polynomial time algorithms to decide whether:

• a finite metric space has a hull-set of size , if all convex sets are given as input,

• a (semi)group can be generated by elements, if all sub(semi)groups are given,

We then consider MGS with input (only) with respect to atomistic closures, i.e., for all , and show that it is W-complete (Corollary 2.6) and its log-variant LOGMGS

Given a set , a polytime computable atomistic closure and an integer , is there a set with such that ?

is LOGSNP-complete (Cor. 2.8.

Whether the corresponding results hold for the hull-number of a graph is open. In particular, in  it was conjectured that given a poset together with all its linear extensions, its dimension can be computed in polynomial time. Moreover, it was shown this problem is an instance of LOGHULL-NUMBER for partial cubes. While trying to establish a reduction to the hull-number problem for partial cubes, in order to show that LOGHULL-NUMBER for partial cubes is LOGSNP-complete, we arrive at the second metric hull-problem of concern in this paper, which to our knowledge is a novel problem: Let again be a graph. A set is isometric if, for any , a -shortest path if is included in . An isometric hull of a set is a smallest isometric set containing . Thus, this problem can be seen as a variation of the Steiner Tree problems. In particular, an isometric hull of two vertices is simply a shortest path. An isometric hull set of is a set such that . The isometric hull-number of is the size of a minimum isometric hull set of . In Section 3 we show that computing an isometric hull of a set of vertices is NP-complete even if (Theorem 3.1) and that computing the isometric hull-number of a graph is complete (Theorem 3.2).

## 2. Minimum generators of pseudo-closures

Let be any set and a pseudo-closure. Note, that setting in one obtains, that for all , i.e., pseudo-closures are idempotent. In particular, pseudo-closures generalize closures in a different way than preclosures, which are not required to be idempotent. Finally, is said size-increasing if or for all . Let us first argue that in a way pseudo-closures are closures without the property of being extensive.

###### Lemma 2.1.

Let . The following are equivalent:

• is a closure,

• is an extensive pseudo-closure,

• is an extensive and size-increasing pseudo-closure.

###### Proof.

(i)(iii): Let be a closure, then it is extensive and increasing by definition and clearly also size-increasing. Since and , then . Hence, . Moreover, and , therefore, . Therefore is an extensive and size-increasing pseudo-closure.

(iii)(ii): trivial.

(ii)(i): Let be an extensive pseudo-closure. As argued above is idempotent. It remains to prove that is increasing. Let . We have

 f(X)⊆f(X)∪f(Y)⊆f(f(X)∪f(Y))=f(X∪Y)=f(Y),

where the second inclusion uses that is extensive and the first equality uses that is a pseudo-closure.

Just to give an example of a pseudo-closure, that is not a closure, consider:

###### Proposition 2.2.

Let be a closure and . Then is an increasing pseudo-closure that is not extensive.

###### Proof.

To see that is a pseudo-closure, we transform which by equals which since is extensive equals . Now, since by Lemma 2.1 is a pseudo-closure, we can transform to which equals .

It is easy to see, that is increasing and since it is not extensive. ∎

We now turn our attention to the problem of generating images of a pseudo-closure. A set generates , and is minimum (for ) if there is no set such that and .

### 2.1. Generating with large input

In this section, we design a dynamic programming algorithm that computes a minimum generator of any . We assume that, for any and given , determining can be done in time . A similar algorithm has been published previously in a different language and restricted to closure functions . Moreover, the approach in  is incremental which leads to a time-complexity of (while no runtime analysis is presented there). We include our algorithm here to be self-contained but also because the complexity of our algorithm is slightly better and we think that our presentation might be more accessible to our community.

Let us describe the algorithm informally. Every set is assigned to one of its generators stored in the variable . Initially, may be any generator of (for instance, itself). The algorithm considers the sets in in non decreasing order of their size and aims at refining their labels. More precisely, from a set with generator , the algorithm considers every set generated by for some . If is smaller than then becomes the new label of .

###### Theorem 2.3.

Algorithm computes a minimum generator of any in time .

Moreover, if is size-increasing, its time-complexity is .

###### Proof.

Let us first show that, at the end of the execution of the algorithm, is a minimum generator for every .

Clearly, is initially a generator of (Line ). Moreover, can only be modified when it is replaced by such that (Line 11). Let us show that is minimum.

For purpose of contradiction, let such that the value of at the end of the algorithm is not a minimum generator of . Moreover, let us consider such a counter example such that the size of a minimum generator is minimum. Hence, there is with and and is a minimum generator for . By line 1, we know that . Hence, let and . Any minimum generator of has size at most . Therefore, by minimality of the size of a minimum generator of our counter-example, is a minimum generator of . In particular, .

First, let us show that . Indeed, otherwise, . Therefore, , contradicting the fact that is a minimum generator for .

Consider the step when receives its final value. After this step, must equal . Therefore, there is another iteration of the -loop. During this next iteration, there must be an iteration of the -loop (Line 6) that considers and an iteration of the -loop (Line 7) that consider . At this iteration, we set . Because the size of the set is non increasing during the execution, the value of at this step is such that . In particular, . Therefore, during this execution (Line 11), should become equal to . Since, again, the size of the set is non increasing, it contradicts the fact that at the end of the algorithm.

First note, that since is idempotent and in Line 1 we can set , i.e., this can be done in constant time. Each iteration of the -loop takes time . Moreover, each new iteration of this loop comes after a modification of some label in the previous iteration (Line 11, because is set to ). Since there are labels and each of them will receive at most values (because the size of a label is not increasing), the time-complexity of the algorithm is .

In case when is size-increasing, we prove that each label contains its final value after the first iteration of the -loop. So, there is exactly iterations of this loop in that case and the time-complexity is when is size-increasing.

More precisely, we show that the label of contains its final value just before is considered in the -loop (line 6) of the first iteration. The proof is similar to the one of the correctness of the algorithm.

For purpose of contradiction, let such that the value of just before is considered in the -loop (line 6) of the first iteration is not a minimum generator of . Moreover, let us consider such a counter example such that is minimum. Hence, there is with and . Let and . Any minimum generator of has size at most . Moreover, because is size-increasing, (because since their minimum generators have different sizes). Therefore, by minimality of the counter-example, is a minimum generator of just before is considered in the -loop of the first iteration, and moreover, is considered before . In particular, .

Similarly as before, . Hence, during the iteration (of the -loops) that considers and , either must become or . In both cases, it is a contradiction since is considered before and .∎

From Th. 2.3, Lemma 2.1, and the preceding discussion we immediately get:

###### Corollary 2.4.

Let be a closure. MGS can be solved in time.

This confirms a conjecture of 

(which could have probably also been extracted from

) and slightly improves the time-complexity of  in the case of a closure. Furthermore, it is well-known and easy to see that for a closure . Thus, is in yielding a uniform bound of .

### 2.2. Generating with small input

In this section we show that for an atomistic closure , the problem MGS is W-complete with respect to the size of the solution, when only is the input. Furthermore, LOGMGS is LOGSNP-complete. We then introduce the problem COORDINATE REVERSAL, show an equivalence with HITTING SET, and finally relate it to the hull-number problem in partial cubes.

For us, the optimization problem DOMINATING SET consists in given a directed graph to find the minimum , such that there is with and every has an incoming arc from a vertex in .

###### Proposition 2.5.

MGS and DOMINATING SET are L-equivalent, i.e., there are polynomial reductions both ways that preserve optimal solutions.

###### Proof.

Given a directed graph we construct an atomistic closure such that a minimum dominating set of is of the same size as a minimum generating set of . First, we can assume that the collection of closed in-neighborhoods is a set without inclusions, since dominating set is L-equivalent to hitting set on . For the same reason, we may assume that for any two vertices there is a set in closed in-neighborhood containing but not . We define by setting the closed sets to be all possible intersections of the complements of closed in-neighborhoods , i.e., is the smallest set of vertices containing which can be expressed as intersection of . It is easy to check that is a closure and since for any two vertices there is a set in closed in-neighborhood containing but not , we have for all , i.e., is atomistic. Clearly, can be computed in polynomial time for a given .

Now, a dominating set corresponds to a hitting set of which in turn is a set of elements not contained in any of the maximal proper closed sets of , i.e., . This construction is clearly reversible, so we have proved the claim.∎

While it was known before that determining the hull-number of graphs, bipartite graphs, and even partial cubes is NP-complete, the known reductions reduce variants of 3-SAT to the decision version of hull-number. Here, we have shown that two decision versions of combinatorial optimization problems are equivalent in the stronger sense of L-reductions, i.e., sizes of solutions are preserved. This has some immediate consequences.

Since DOMINATING SET is W-complete, Proposition 2.5 gives:

###### Corollary 2.6.

MGS is W-complete.

Using results of Dinur and Steurer , by Proposition 2.5 we get:

###### Corollary 2.7.

MGS cannot be approximated to unless P=NP.

In  it is shown that LOGDOMINATING SET is LOGSNP (aka LOG) complete, which with Proposition 2.5 gives:

###### Corollary 2.8.

LOGMGS is LOGSNP-complete.

Since the -operator for graphs is an atomistic closure, we wonder if similar results can be proved for the hull-number problem, or if this problem is essentially easier. For instance in , a fixed parameter tractable algorithm to compute the hull-number of any graph was obtained. But there the parameter is the size of a vertex cover. How about the complexity when parameterized by the size of a solution?

It is well-known that closures correspond to lattices in the following way: Given a closure define the inclusion order on the closed sets, i.e., . Since this order has a unique maximal element and the intersection of closed sets is closed, it is a lattice. On the other hand given a lattice with set of join-irreducibles associate to every the set of join-irreducibles that are less or equal than . Now, is the inclusion order on . In turn the latter is the set of closed sets of defined as , where denotes the join of . This is easily seen to be a closure. Recall that a lattice is atomistic if all its elements can be generated as joins of atoms. The corresponding class of closures are precisely the atomistic closures. Now we can state the following :

###### Question 2.9.

What are the atomistic lattices that come from the convex subgraphs of a graph?

Clearly, these lattices are quite special, in particular any such lattice is entirely determined by its first two levels, since these correspond to vertices and edges of the graph. On the other hand, it is not clear what other properties such lattices enjoy. For instance, the graph in Figure 1 shows that convexity lattices of graphs are not graded in general, i.e., not all maximal chains are of the same length. Figure 1. A family of graphs with lattice of convex subgraphs being arbitrary far from ranked.

For example, Ptolemaic graphs are exactly those graphs whose lattice of convex subgraphs is lower locally distributive . Also, in  the lattices of convex subgraphs of partial cubes were characterized. However, we do not know how to make use of this characterization.

Let us now approach the hull-number problem in partial cubes via a different reduction. We call COORDINATE REVERSAL the following problem:

Given a set of vertices of the hypercube and an integer , is there a subset , with and such that for every coordinate of there are vertices with .

###### Proposition 2.10.

COORDINATE REVERSAL is L-equivalent to HITTING SET.

###### Proof.

Let be an instance of hitting set with , where . This assumption clearly does not change the problem. Assume that for any two vertices there is a set in containing but not , which is clearly OK as an assumption. Second, we extend with one vertex and with the set of complements with respect to the new ground set, i.e., . Note that since , we have . The new instance has a hitting set of size if and only if the old one has one of size .

We can interpret the hitting set instance as a set of vertices of of the hypercube of dimension . Every vertex has coordinates A hitting set of corresponds to a solution of COORDINATE REVERSAL, i.e., a minimum subset of such that each coordinate is reversed, i.e., appears once positive and once negative.

Conversely, an instance of COORDINATE REVERSAL in is equivalent to the HITTING SET instance , where and .∎

Now, in  it is shown that in a partial cube HULL-NUMBER coincides with COORDINATE REVERSAL for and , therefore, HULL-NUMBER in partial cubes is a special case of COORDINATE REVERSAL. In order to L-reduce COORDINATE REVERSAL to partial cube hull-number along the lines of Proposition 2.10, it would be interesting to check, if given a subset a smallest partial cube containing has to be polynomial in . Moreover it is important to maintain the same solution size with respect to COORDINATE REVERSAL. In [15, Theorem 15.59] it is shown that LOGHITTING SET is LOGSNP (aka LOG) complete. Hence, this would show LOGSNP-completeness of LOGHULL-NUMBER for partial cubes, one instance of which is calculating the dimension of a poset given its linear extensions, see . So as a first step we wonder:

###### Question 2.11.

Let be a set of vertices of the hypercube , does there exist an isometric subgraph of , containing , such that is polynomial in ?

Let a -matrix whose columns are all the

-vectors of length

. Now, is defined as the set of rows of . We do not know the answer to Question 2.11 for the set .

These questions lead to the problem of computing a small isometric subgraph containing a given set of vertices, which is the subject of the next section.

## 3. Isometric hull

We recall the definitions related to the isometric hull from the introduction. Let be a graph. For any , let denote the distance between and , i.e., the minimum number of edges of a path between and in . A subgraph (i.e., and ) of is isometric if for any . Given , an isometric hull of is any subgraph of such that and is isometric. An isometric hull of is minimum if is minimum, i.e., there are no isometric hulls of with strictly less vertices. Note that a set may have several minimum isometric hulls. As an example, consider the -node cycle : the subgraphs induced by and are minimum isometric hulls of . More generally, for any , inclusion-minimal isometric hulls of are any shortest path between and . So, if , all minimal isometric supergraphs of are of the same size and computing a minimum isometric hull of is easy. For it is easy to find examples with minimal isometric supergraphs that are not minimum. We show below that computing a minimum isometric hull is NP-complete if . An isometric-hull set (or simply hull set) of is any subset of the vertices such that is the (unique) minimum isometric hull of .

This section is devoted to prove the following theorems.

###### Theorem 3.1.

Given an -node bipartite graph , and , deciding whether there exists an isometric hull of with is NP-complete, even if and . In particular, deciding whether a set of vertices is a hull set of a graph is coNP-complete.

###### Theorem 3.2.

Given a graph and , the problem of deciding whether admits an isometric-hull set of size at most is -complete.

Let us start with an easier result where neither the size of the input set nor the size of the isometric hull are constrained, but where the class of bipartite graphs is restricted to have diameter .

###### Lemma 3.3.

Given bipartite with diameter , and , deciding if there exists an isometric hull of with is NP-complete.

###### Proof.

The problem is clearly in NP since testing whether a subgraph is isometric can be done in polynomial-time.

To prove that the problem is NP-hard, let us present a reduction from the HITTING SET Problem that takes a ground set and a set of subsets of and an integer as inputs and aims at deciding if there exists of size at most such that for every . Note that we may assume that at least two sets of are disjoint (up to adding a dummy vertex in and a set restricted to this vertex).

Let us build the graph as follows. We start with the incidence graph of , i.e., the graph with vertices and edges for every , such that . Then add a vertex adjacent to every vertex in and a vertex adjacent to every vertex in . Note that has diameter . Finally, let .

We show that admits a hitting set of size if and only if has an isometric hull of size . Note that, because at least two sets are disjoint, must be in any isometric hull of (to ensure that these sets are at distance two). Moreover, for every set containing (at least) , and , all distances are preserved but possibly the ones between and some vertices of . We show that is an isometric hull of if and only if is a hitting set of . Indeed, for every , the distance between and equals in if and only if contains a vertex adjacent to , i.e., for every . ∎

Now, let us consider a restriction of Theorem 3.1 in the case (without constraint on ). For this purpose, we present a reduction from 3-SAT. Figure 2. Example of T7. Edges are bold only to better distinguish the different “levels”.

#### Preliminaries: the triangle gadget Tγ.

Let us first describe a gadget subgraph, parameterized by an odd integer

111 is set odd only to avoid parity technicality in the computation of the distances., for which only vertices generate the whole graph. That is, we describe a graph with size such that there are vertices (called the corners) whose minimum isometric hull is the whole graph. Moreover, some vertex (called the center) of is “far” (at distance ) from the corners.

Let be any odd integer. Let us define recursively a -triangle with corners and center as follows.

A -triangle is a where the big bipartition class are the corners and the center is the remaining vertex .

Let be an odd integer and let be a -triangle with corners and center . The -triangle is obtained as follows. First, let be the cycle of length with vertices that are pairwise at distance . For any , let be the vertex at distance from and in . The graph is obtained from and by identifying with , and , respectively. The corners of are and , and the center of is the center of . Note that the center of is the center of the “initial” “triangle” . An example is depicted on Figure 2.

The following claim can be easily proved by induction on . The second statement also comes from the fact that is an isometric subgraph of .

###### Claim 1.

For any odd integer , let with corners

• ;

• the (unique) isometric hull of is ;

• the distance between any two corners in is ;

• the distance between the center and any corner in is ;

• since is planar and all faces are even, is bipartite.

###### Lemma 3.4.

Given a bipartite -node graph , , deciding whether there exists an isometric hull of with is NP-complete.

###### Proof.

The problem is clearly in NP since testing whether a subgraph is isometric can be done in polynomial-time. To prove that the problem is NP-hard, let us present a reduction from -SAT.

Let be a CNF formula with variables and clauses . Let us describe a graph , and such that an isometric hull of has size at most if and only if is satisfiable.

Let and be three integers satisfying: and are even and is odd and

 m<<2α<2β<γ<2(α+β).

Variable-gadget. For any , the variable-gadget consists of a cycle of length with four particular vertices such that and are antipodal, i.e., at distance of each other, and are antipodal, and . Let and be the shortest path between and in passing through and , respectively.

Clause-gadget. For any and clause (where is the literal corresponding to variable in clause ), the clause-gadget is a -triangle with corners denoted by (abusing the notation, we identify the corner-vertices and the literals they correspond to) and center denoted by .

The graph . The graph is obtained as follows. First, let us start with disjoint copies of , for , and of , for . Then, add one vertex and, for any , add a path of length between and and a path of length between and (these paths are vertex-disjoint except in ). Finally, for any and any literal in the clause , let us identify the corner of with vertex (in the variable-gadget ) if variable appears negatively in (i.e., if ) and identify the corner of with vertex if variable appears positively in (i.e., if ). Let us emphasize that, if variable appears positively (negatively) in , then a corner of is identified with a vertex of the path (). By the parity of and , is clearly bipartite. An example is depicted in Figure 3. Figure 3. An example for the graph G0 of the reduction of Lemma 3.3 for Φ with variables v1,v2,v3,v4 and two clauses C1=v1∨¯v2∨¯v3 and C2=v2∨¯v3∨¯v4. The solid bold lines represent the clause-gadget C1 which is a γ-triangle (only few “levels” are depicted), and the dotted bold lines represent the clause-gadget C2. The vertices c1 and c2 denote the centers of C1 and C2 respectively. Red vertices are the ones of the set S={r,d1,g1,d2,g2,d3,g3,d4,g4}. Finally, the red subgraph is the isometric hull of S corresponding to the truth assignment (v1,v2,v3,v4)=(1,0,1,0). The graph G is obtained from G0 by adding a vertex q adjacent to c1 and c2.

The set . Finally, let .

We first show that has an isometric hull of size at most in if and only if is satisfiable.

###### Claim 2.

has an isometric hull of size at most in if and only if is satisfiable.

Proof of the claim.

Let us start with some simple observations (following from the constraints on and ):

1. For any , and there are exactly two shortest paths and between and . Intuitively, choosing (resp., ) in the isometric hull will correspond to a positive (resp., negative) assignment of variable .

2. For any , and (resp., ) is the unique shortest path between and (resp., between and ). In particular, each of these paths has to be in any isometric hull of .

3. For any , and the unique shortest path between them is the one going through (because ).

4. For any and clause , (where denotes if appears positively in and it denotes otherwise). This is because and the unique shortest path between these vertices is the one in .

5. For any , and such that literals and do not appear in a same clause, then (because ). In particular, every shortest path between and does not cross any clause-gadget.

6. Let , and appearing in a clause . For any vertex in the shortest path between and in the clause-gadget , and for any for some , . In particular, any shortest path between and does not pass through the third corner (different from and ) of . This is because .

• First, let us show that, if is satisfiable, there is an isometric hull of with size at most in . Indeed, consider a truth assignment of and let be the subgraph defined as follows. For any , the paths and belong to . For any , if is assigned to True, add in , and add otherwise. Finally, for any , for any two corners of the clause-gadget , if these two corners are in , then add to the path of length between them in .

Clearly, contains all vertices in . To show that is isometric, let us first show that any clause-gadget has at most two corners in . Let be a corner of a clause-gadget which is in . If (resp., ) is in , it implies that the path (resp., ) has been added in . Therefore, the variable is assigned to False (resp., to True) in the assignment. On the other hand, if (resp., ) is a corner of , it means that the variable appears positively (resp., negatively) in clause . Altogether, this implies that, in the assignment, Variable cannot satisfy clause . Since the assignment satisfies , each clause must be satisfied by at least one of its variables, which implies that at least one of its corners is not in .

To sum-up consists of the paths from to the vertices , , of exactly on path or , , and of at most one path between two corners of , . Hence, has at most vertices. The fact that is isometric comes from the above observations on the shortest paths in .

• To conclude, let us show that, if is not satisfiable, then any isometric hull of , in , has size at least , i.e., strictly larger than (since ).

As already mentioned, any isometric hull of has to contain each of the paths