 # Hardness results for three kinds of colored connections of graphs

The concept of rainbow connection number of a graph was introduced by Chartrand et al. in 2008. Inspired by this concept, other concepts on colored version of connectivity in graphs were introduced, such as the monochromatic connection number by Caro and Yuster in 2011, the proper connection number by Borozan et al. in 2012, and the conflict-free connection number by Czap et al. in 2018, as well as some other variants of connection numbers later on. Chakraborty et al. proved that to compute the rainbow connection number of a graph is NP-hard. For a long time, it has been tried to fix the computational complexity for the monochromatic connection number, the proper connection number and the conflict-free connection number of a graph. However, it has not been solved yet. Only the complexity results for the strong version, i.e., the strong proper connection number and the strong conflict-free connection number, of these connection numbers were determined to be NP-hard. In this paper, we prove that to compute each of the monochromatic connection number, the proper connection number and the conflict free connection number for a graph is NP-hard. This solves a long standing problem in this field, asked in many talks of workshops and papers.

## 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

All graphs considered in this paper are undirected, finite and simple. We follow  for notation and terminology not described here. Let be a graph. We use to denote the vertex-set, edge-set, the number of vertices, number of edges, and the diameter of , respectively.

A path of an edge-colored graph is said to be a rainbow path if no two edges on the path have the same color. The graph is called rainbow connected if every pair of distinct vertices of is connected by a rainbow path in . An edge-coloring of a connected graph is called a rainbow connection coloring if it makes the graph rainbow connected. For a connected graph , the rainbow connection number of is defined as the smallest number of colors that are needed in order to make rainbow connected. These concepts on the rainbow connection of graphs were introduced by Chartrand et al.  in 2008. The reader is referred to [22, 23, 24] for details.

Inspired by the rainbow connection colorings and proper colorings in graphs, Borozan et al.  in 2012, and Andrews et al.  independently, introduced the concept of proper-path coloring. Let be a nontrivial connected graph with an edge-coloring. A path in is called a proper path if no two adjacent edges of the path receive the same color. An edge-coloring of a connected graph is called a proper-path coloring if every pair of distinct vertices of are connected by a proper path in . If colors are used, then is called a proper-path -coloring. An edge-colored graph is proper connected if any two vertices of are connected by a proper path. For a connected graph , the minimum number of colors that are needed in order to make proper connected is called the proper connection number of , denoted by . For more details, we refer to [14, 16, 19, 12] and a dynamic survey .

Czap et al.  in 2018 introduced the concept of conflict-free connection of graphs. An edge-colored graph is called conflict-free connected if each pair of distinct vertices is connected by a path which contains at least one color used on exactly one of its edges. This path is called a conflict-free path, and this coloring is called a conflict-free connection coloring of . The conflict-free connection number of a connected graph , denoted by , is defined as the smallest number of colors needed to color the edges of such that is conflict-free connected. More results can be found in [6, 7, 8].

Note that a rainbow path has the maximum number of colors allowed on the path. Inspired by the concept of rainbow connection, we would like to ask what about a path uses the minimum number of colors ? This will be the minimum cost when we try to establish a point to point communication. As mentioned by Caro and Yuster , it is a natural opposite counterpart of the rainbow connection colorings. At first, we introduce the notion color-distance in the following.

Let be a nontrivial connected graph associated with an edge-coloring , . Let and be two vertices of the edge-colored graph . The color-distance between and , denoted by , is the minimum number of distinct colors that a -path can have. It is easy to see that ; if and only if ; ; . Then is a metric space. We can also define color-distance between two sets of vertices: . Naturally, the color-diameter of , denoted by , is the maximum color-distance among all pairs of vertices. We have . The question is, when we fix the color-diameter, how colorful can a coloring be ? That is to say, we already have , and then we tend to maximize the number of distinct colors . We call a -color connection coloring if . The -color connection number of a connected graph , denoted by , is the maximum number of colors that are needed to make a -color connection coloring. We call an extremal -color connection coloring if uses colors.

If , then is exactly the monochromatic connection number introduced by Caro and Yuster  in 2011. More results on the monochromatic connection of graphs can be found in [25, 4, 13, 15, 26].

Now, for a given a graph we have got four parameters , , and . The question is that for a given graph, weather there exist efficient ways to compute these parameters ? Chakraborty et al.  first solved this problem for the rainbow connection number . They proved that computing is NP-hard. However, for a long time it has been tried to fix the computational complexity for , and of a graph. Till now it has not been solved, yet. Only the complexity results for the strong version, i.e., the strong proper connection number  and the strong conflict-free connection number , were determined to be NP-hard. In this paper, we prove that to compute each of , and of a graph is NP-hard. This solves a long standing problem in this field, asked in many talks of workshops and papers; see [20, 21, 25, 7, 8, 18].

The paper is organized as follows. In Sections 2,3 and 4, we prove the NP-hardness for the proper connection number, conflict-free connection number and monochromatic connection number, respectively. In the last section, Section 5, we work on the -color connection number and give a linear-time algorithm to compute the -color connection number of trees.

## 2 NP-hardnes for the proper connection number

The classical 3-Satisfiability problem (3SAT for short) is well-known to be NP-complete. Its variant Not-All-Equal 3 Satisfiability problem (NAE-3SAT for short) was also proved to be NP-complete by Schaefer’s dichotomy theorem . For ease of reading, we state the variant problem as follows.

The NAE-3SAT problem:

INSTANCE: A boolean formula in 3 conjunctive normal form (3CNF for short) such that each clause is made up of three distinct literals.

QUESTION: Is there a satisfiable assignment for such that in each clause, at least one literal is equal to true and at least one literal is equal to false ?

Our aim is to reduce the NAE-3SAT problem to the problem of deciding if for a graph . We then obtain our main result of this section.

###### Theorem 2.1

For a graph , deciding if is NP-complete. In particular, computing is NP-hard.

Proof. At first, we show that deciding if is in NP. Actually, Edmonds and Manoussakis showed that to check if a 2-edge-coloring of a graph makes the graph proper connected is polynomial-time solvable; see . From their result, one can see that given a yes-instance of a 2-edge-colored connected graph, it is polynomial-time checkable if the graph is proper connected. Then we prove that the problem is NP-complete by reducing the NAE-3SAT problem to it.

Given a 3CNF on variables , the clause is made up of three distinct literals for each . We construct a graph as follows:

First, we construct the variable garget for a variable for each (see Figure 1). Assume that the variable appears in clauses of . For each , we start from a path . Next we add pendent vertices as follows: each of the pendent vertices and is adjacent to , the pendent vertex is adjacent to , the pendent vertex is adjacent to , and each of the pendent vertices and is adjacent to . Then we add a new vertex , and a set of edges . Now we get the graph . The variable garget is obtained by adding a set of edges to the union of the graphs .

Second, we construct the graph represent for the clause for each , see Figure 2. We start from the vertices and such that there are three edge-disjoint paths , and between them. Next we add a new vertex such that is adjacent to . Then we add two pendent vertices and such that each of and is adjacent to . Then we add three vertices such that is adjacent to , is adjacent to , and is adjacent to . If a variable is positive such that in the clause for some , then we add an edge for some . If a variable is negative such that in the clause for some , then we identity the vertices and for some . We do this similarly for the literals and .

Third, we add some extra vertices and edges to complete the construction of the graph . We construct a complete graph on the set of vertices . For each , we add a new vertex such that is adjacent to , and add two pendent vertices and such that each of and is adjacent to . Next we add a set of edges . Now we get the graph .

In the following, we only need to show that if and only if is satisfiable.

Suppose . Let be a proper-path coloring of using 2 colors.

Claim. The three entries , and of share a same color for each .

Proof of the Claim: Assume, to the contrary, that the three entries , and of do not share a same color. Notice that is the only path between the vertices and (see Figure 1). Then we can assume that the edge is colored with 1 and the edge is colored with 2. Similarly, we can assume that the edges , are colored with 1 and the edges , are colored with 2. We distinguish the following two cases to complete the proof.

Case 1. The two entries and share a same color.

Without loss of generality, we can assume that the entries , are colored with 1, and the third entry is colored with 2. Since there exists a proper path between vertices and , we can assume that the proper path is . Since there is a proper path between vertices and , it follows that the edge is colored with 1. Notice that there exists a proper path between vertices and , then the edge is colored with 2. There is a proper path between vertices and , then the edge is colored with 1. Also there is a proper path between vertices and , then the edge is colored with 1. However, there is no proper path between vertices and . Thus, is not a proper-path coloring, a contradiction.

Case 2. The two entries and do not share a same color.

Without loss of generality, we assume that the entries is colored with 1, and the other two entries , are colored with 2. Then the proper path between vertices and is . Since there is a proper path between vertices and , it follows that the edge is colored with 1. Notice that there exists a proper path between vertices and , then the edge is colored with 2. Suppose that the edge is colored with 2. Then the edge is colored with 1. There is no proper path between vertices and , then is not a proper-path coloring, a contradiction. We have that the edge is colored with 1. Since there is a proper path between vertices and , the edge is colored with 1. Also, there is a proper path between vertices and , then the edge is colored with 1. However, there is no proper path between vertices and . Thus, is not a proper-path coloring, a contradiction.

As a result, the three entries , and of share a same color for each .

Now we have that the edges in the edge set share a same color for each . If the edge is colored with 1, then we set for each . If the edge is colored with 2, then we set for each . Let be two vertices, be a path from to such that is in a graph for some . Then the length of is even. Thus, two of the four edges should be colored with 1, and the other two edges should be colored with 2 for each . Then admits a Not-All-Equal satisfiable assignment for the clause . As a result, we get a satisfiable assignment for .

Suppose that is satisfiable. Given a Not-All-Equal satisfiable assignment on the variables , we color the graph as follows:

If , then is colored with 1. For each , the edges , , , , , are colored with 1, and the remaining edges in the graph is colored with 2. If , then is colored with 2. For each , the edges , , , , , are colored with 2, and the remaining edges in the graph is colored with 1. For each , the edge shares a same color with the edge , and the edges , receive the distinct color. If a variable is positive in the clause for some , then the edge shares a same color with the edge and the edge receives a distinct color. If a variable is negative such that in the clause for some , then the edge and the edge receive distinct colors. The coloring is similar for the literals and . Without loss of generality, we can assume that the edges and are colored with 1, the edge is colored with 2, since is satisfiable. Then the edges , , , , , , are colored with 1, the edges , , , , , are colored with 2. Let be a vertex in . Then there exists a unique vertex such that is adjacent to . If the edge is colored with 1, then we color the edge with 2. If the edge is colored with 2, then we color the edge with 1. Let be two vertices. If the edges and share a same color 1, then we color the edge with 1. If the edges and share a same color 2, then we color the edge with 2. The remaining edges can be arbitrarily colored.

One can verify that there exists a proper path between every pair of vertices in the graph . Thus, . The proof is now complete. Figure 1: The variable garget Hi corresponding to a variable xi. Figure 2: The graph Ij representing for the clause cj such that the literals lj,1, lj,3 are positive and the literal lj,2 is negative.

## 3 NP-hardness for the conflict-free connection number

Let be the subgraph of induced by the set of cut-edges of , and let . The following result was obtained in .

###### Lemma 3.1

 If is a connected graph with cut-edges, then

 h(G)≤cfc(G)≤h(G)+1.

Moreover, the bounds are sharp.

In the following, our aim is to reduce the NAE-3SAT problem to the problem of deciding whether or for the case when . We then know that deciding whether or is NP-complete by Theorem 3.4. At first, we need the following lemma.

###### Lemma 3.2

Let be a graph such that contains two edge-disjoint Hamilton paths and . The edges of is colored with 1 and the edges of is colored with 2. Then between any pair of vertices of , there exists a monochromatic color 1 path, a monochromatic color 2 path, a conflict-free path with color 1 used only once and a conflict-free path with color 2 used only once.

Proof. Let and be two vertices of . Clearly, and lie on , then the path is a monochromatic color 1 path. Similarly, the path is a monochromatic color 2 path. Now consider the path . Let be the edge incident with on the path . Then contains two component and ( lies on ). Since is a Hamilton path, there exists an edge on such that . Now we have that the path is a conflict-free path with color 1 used only once. Similarly, there exists a conflict-free path with color 2 used only once.

Next we need the lemma given by M Ji et al.  as following:

###### Lemma 3.3

 Given a connected graph and a coloring : of , determining whether or not is, respectively, conflict-free connected, conflict-free vertex-connected, strongly conflict-free connected under the coloring can be done in polynomial-time.

Our main result of this section is as follows. Figure 3: The variable garget Hi corresponding to a variable xi. Figure 4: The graph Ij representing for the clause cj such that the variable xi=lj,1 is positive in cj.
###### Theorem 3.4

Let be a graph such that . Then deciding whether or 3 is NP-complete. In particular, computing is NP-hard.

Proof. As a result of Lemma 3.3, the problem is in NP. Then we prove that the problem is NP-complete by reducing the NAE-3SAT problem to it. Given a 3CNF on variables , the clause is made up of three distinct literals for each . We construct a graph as follows.

First, we construct the variable garget for a variable for each . We start from a complete graph on four vertices . Next we add two pendent vertices such that each of the vertices is adjacent to . Then we get by adding a cycle of length 5.

Second, we construct the graph representing for the clause for each . We start from a complete graph on four vertices . Next we add two pendent vertices and such that each of and is adjacent to . Let the resulting graph be . Then we add two copies and of . Finally, we get by adding the set of edges to the union of , and . If a literal is positive in the clause for some , then is adjacent to . If a literal is negative in the clause for some , then is adjacent to . We do this similarly for the literals and .

Third, we add some extra vertices and edges to complete the construction of the graph . We construct a complete graph on vertices . Next we add two vertices and such that is a path of length two. Then the resulting graph is .

In the following, we only need to show that if and only if is satisfiable.

Suppose . Notice that is the only path between the vertices and (see Figure 4). Then we can assume that the edge is colored with 1 and the edge is colored with 2. Similarly, we can assume that the edges , are colored with 1 and the edges , are colored with 2. We can assume that is colored with 1 and is colored with 2, since is the only path between vertices and (see Figure 3). There exists a monochromatic color 1 path between vertices and , since color 1 has been used at least twice on the conflict-free path between vertices and . Similarly, there exists a monochromatic color 2 path between and . The graph has exact three entries, then these three edges can not have a same color; otherwise, we can not get both a monochromatic color 1 path and a monochromatic color 2 path between and .

Claim. There exists no monochromatic path going through some .

Proof of the Claim: Suppose that there exists a monochromatic color 1 path going through some two entries of . Then the third entry should be colored with 2. There exists a monochromatic color 1 path and a monochromatic color 2 path between vertices and , since any path between and goes through the vertex . Similarly, there exists a monochromatic color 1 path and a monochromatic color 2 path between vertices and ; there exists a monochromatic color 1 path and a monochromatic color 2 path between vertices and . Then we have that the edge is colored with 2. Next, we color the edge with 1 and the edge with 2. Hence, there exists no monochromatic color 1 path going through for any . Similarly, there exists no monochromatic color 2 path going through some .

Notice that is the only path between vertices and (see Figure 4). Then we can assume that the edge is colored with 1 and the edge is colored with 2. We have that there exists a monochromatic color 1 path and a monochromatic color 2 path between vertices and . Then the two edges and are colored with distinct colors by our Claim. If (, respectively) is incident with the entry (, respectively) of , then the edge (, respectively) and the edge (, respectively) share a same color to ensure the monochromatic paths between vertices and . Similar thing happens for the remaining two entries of . If is colored with 1, then we set . If is colored with 2, then we set . As a result, the variables admit a Not-All-Equal satisfiable assignment of .

Suppose that is satisfiable. Given a Not-All-Equal satisfiable assignment on variables ,  we color the graph as follows.

If , then the edges incident with the vertex are colored with 1 and the edges incident with the vertex is colored with 2 for each . If , then the edges incident with the vertex are colored with 2 and the edges incident with the vertex is colored with 1 for each . The three entries of do not share a same color, since is satisfiable for each . Without loss of generality, assume that the entry incident with and the entry incident with are colored with 1, and the entry incident with is colored with 2 for each . Then we color the two edges and with 2, and color the edge with 1 for each . Next the edges , , are colored with 1, and the edges , , are colored with 2 for each . The edge is colored with 1 and the edge is colored with 2 for each . The remaining parts consist of complete subgraphs of order at least 4. By induction, we know that a complete graph of order at least 4 contains two edge-disjoint Hamilton paths. For each complete subgraph, one Hamilton path is colored with 1, and the other is colored with 2.

Next we should verify that there exists a conflict-free path between every pair of vertices. Notice that there exist both a monochromatic color 1 path and a monochromatic color 2 path between and for each . Let be two vertices. Then there exists a conflict-free path between and by Lemma 3.2. Let be two vertices for some . Then there exists a conflict-free path between and by Lemma 3.2. Let be two vertices for some . Then there exists a conflict-free path between and by Lemma 3.2. Let , be two vertices for some . Then there exists a conflict-free path between and by Lemma 3.2. Let , be two vertices for some . Then there exists a conflict-free path between and by Lemma 3.2. Without loss of generality, for some , assume that the entry incident with and the entry incident with are colored with 1, and the entry incident with is colored with 2. Then we color the two edges and with 2, and color the edge with 1. Let , be two vertices. Then we can find a conflict-free path from to with color 2 which is the unique color such that edge is in . Let , be two vertices. Then we can find a conflict-free path from to with color 2 which is the unique color such that edge is in . Let , be two vertices. Then we can find a conflict-free path from to with color 1 which is the unique color such that edge is in . As a result, we have that . The proof is now complete.

## 4 NP-hardness for the monochromatic connection number

In the last section we will deal with the complexity for the monochromatic connection number. The following result was obtained in .

###### Theorem 4.1

 Let be a connected graph with vertices and edges. If satisfies one of the following conditions, then .

1. is 4-connected.

2. is triangle-free.

3. . In particular, this holds if or .

4. .

5. has a cut vertex.

Inspired by the concept of a monochromatic path which uses exact one color, we consider a path using at most distinct colors. Next, we will use the color-distance as a tool. Given a positive integer and a graph , if one asks for an edge-coloring of satisfying that for any pair of vertices of there exists a path in which uses at most distinct colors between the two vertices, then the maximum number of distinct colors for the edge-coloring is . We can consider in an opposite way which counts the total number of ”wasted” colors in the following lemma.

###### Lemma 4.2

Let be an extremal -color connection coloring of . Then each color forms a forest. For a color , denote by the subgraph induced by the set of edges colored with . We call the color forest of the color . A color forest with edges is said to waste colors. Hence, is said to be nontrivial if and only if . Let be the total number of wasted colors. Then .

Proof. We claim that the subgraph induced by the set of edges colored with is a forest. Assume to the contrary, there is a cycle in . Then it is possible to choose any edge in this cycle and color it with a fresh color while still maintaining a -color connecting coloring, a contradiction.

Next, the -color connection number counts the number of distinct color forests. Hence, we have .

###### Lemma 4.3

For a connected graph , .

Proof. By definition, we know that if and only if is at most . Let be a connected induced subgraph of . We can construct a -color connecting coloring of by adding new colors to a -color connecting coloring of , and hence . Then we have by Lemma 4.2.

Next we consider the upper bound of . Let be a spanning tree of graph . Then can be calculated in Section 4. Hence, is an alternative upper bound. In general, we have by our Algorithms 1 and 2 in next section. Moreover, achieves its upper bound if and only if is a path.

###### Lemma 4.4

Let be a positive integer. Given a connected graph associated with an edge-coloring on vertices, one can decide if in polynomial time.

Proof. Let be the color set of . Clearly, . Next we choose a pair of vertices in arbitrarily. Let be a color set chosen from such that . In this step, we have exact