Abstract

A rainbow -coloring of a -connected graph is an edge coloring such that for any two distinct vertices and of there are at least internally vertex-disjoint rainbow -paths. In this work, we apply a Rank Genetic Algorithm to search for rainbow -colorings of the family of Moore cages with girth six -cages. We found that an upper bound in the number of colors needed to produce a rainbow 4-coloring of a -cage is 7, improving the one currently known, which is 13. The computation of the minimum number of colors of a rainbow coloring is known to be NP-Hard and the Rank Genetic Algorithm showed good behavior finding rainbow -colorings with a small number of colors.

1. Introduction and Definitions

Evolutionary algorithms have been applied to a wide variety of engineering problems [1], and they have also been applied to mathematics problems. For instance, Jong and Spears [2] showed that Genetic Algorithms (GA) can be used to solve NP-Complete problems, [3] applied a GA to a geometry problem, and [4] solved nonlinear algebraic equations by using a GA. Here we have successfully applied a Rank Genetic Algorithm (Rank GA) [5] to the graph theory problem of finding the rainbow connection number of a graph (). Chakraborty et al. [6] proved that, for a given graph , deciding whether is NP-Complete and that it is also NP-Complete to decide whether a given edge-colored (with an unbounded number of colors) graph is rainbow connected. Therefore, our motivation is to try using the Rank GA heuristic on this problem. To our best knowledge, this problem has not been approached in this way nor using any other heuristic algorithms.

In a genetic algorithm we have an initial population of individuals; in our case, each individual represents a particular edge-colored graph. Each individual of the population is evaluated according to a fitness function; this function measures the ability of the individual for reaching a predetermined objective. Once individuals are evaluated, the next generation is obtained by applying genetic operators to the population inspired by the evolution in nature, such as cross-over between individuals, selection of the fittest individuals, and mutations. This procedure is repeated until the genetic algorithm finds an individual that achieves the required objective or until a maximum number of generations are reached. A genetic algorithm can solve mathematical problems that are intractable by exhaustive search, as is the case of the problem described here.

A graph is -connected if and only if there are at least internally disjoint -paths connecting every two distinct vertices and of [7]. A rainbow path is a path such that all the edges of have different colors (a path of is a sequence of distinct vertices such that is an edge for ). An edge coloring of a graph is called a rainbow -coloring if for every pair of distinct vertices and there are at least internally disjoint rainbow -paths. The rainbow -connectivity (defined by Chartrand et al. [8]) of a graph is the minimum integer such that there exists an edge coloring using colors which is a rainbow -coloring. The rainbow -connectivity is known as the rainbow connection number and was introduced by Chartrand et al. [9].

The rainbow -connectivity of a graph has applications in the Cybernetic Security (see Ericksen [10]). For any fixed , deciding if is NP-Complete [6, 11]. For more references on rainbow connectivity and rainbow -connectivity we refer the reader to the survey by Li [12] et al. and the book of Li and Sun [13].

A graph is -regular if every vertex of has degree . The girth of is the length of a shortest cycle of . Given two integers and a -cage is a -regular graph with girth and the minimum possible number of vertices. Let denote the order of a -cage. For references on cages see the dynamic survey of Exoo and Jajcay [14]. By counting the vertices emerging from a vertex or from an edge the lower bound , known as the Moore bound, is obtained. That is, , whereWhen the -cage is called a Moore -cage; for references on Moore cages see [15]. The Moore cages have been characterized [1618]. The existence of -Moore cages is related to the existence of finite geometries. For instance, the -cage is the incidence graph of Fano’s plane. Concerning connectivity of -cages it has been proved that they are -connected [19].

Chartrand et al. [20] showed that the rainbow -connectivity of the -cage (the Moore cage known as Heawood graph) is between 5 and 7 inclusive. Recently, Balbuena et al. [21] proved that it is not 5, and they bounded the rainbow -connectivity of -cages as follows: if is a Moore -cage, thenIf is a -cage, then for , , and , respectively, we have , , and , respectively. In this paper we use a genetic algorithm to search for rainbow -colorings of -cages with and [21] in order to see if the upper bound for can be improved.

The structure of this paper is as follows. In Section 2 we explain how the Rank GA was applied to the rainbow coloring problem. Results are presented in Section 3 and finally the conclusions are drawn in Section 4.

2. Finding Rainbow Colorings in a Moore Cage with a Genetic Algorithm

Finding a particular rainbow -coloring of a graph using colors (that is a coloring with internally disjoint rainbow paths between any pair of vertices) implies that . We use an adapted version of the Rank GA [5] to find rainbow colorings in a Moore cage. To do so, each individual in the population contains a list of the assigned colors of each edge in the graph and is initialized randomly. In the Rank GA, the individuals of the population are ranked from best to worst in terms of their fitness before the genetic operators (selection, recombination and mutation) are applied. The application of these genetic operators depends on the rank of each individual in the population. The top ranked individuals tend to vary less than the bottom ranked ones. This is to make the latter try to escape from local optima of the fitness function. Also, top ranked individuals tend to be cloned more than others who tend to disappear.

The adapted RankGA pseudocode that was used is given in Algorithm 1 and its parameters are shown in Table 1.

procedure RankGA
and
while not end Criteria met do
and
and
procedure Rank Selection
for in do
for in do
is cloned times
while do
is the fractional part of
if then
one extra clone of
mod
replace population
procedure Rank Recombination
for in step do
for in do
if then
Switch(, ) mating is with
procedure Rank Mutation
for in do
for in do
if then
random integer in the range
2.1. The Fitness Function

We detail below the fitness function. As this is an interdisciplinary work, we express the fitness function mathematically (below) and also in a computational way in Algorithm 2.

function
for Each vertex pair in the Graph do
Accumulate the product
return
function
for Each InternallyDisjointPathsSet of pair do
if then
Select best fitness
return
function
for Each Path in do
Accumulate the product
return
function
return
function
for Each Step in do
if not then count colors only once
mark color as already used
return

Let be a graph, let be the set of all possible colorings of the edges , and let be the set of all pairs of vertices of , that is, . The fitness function to be maximized using the RankGA is given aswhere andwhere is the set of all sets of internally disjoint paths between the vertices in andwherewhere is the set of all edges in path andwhere is the color that the coloring assigns to edge .

The function , in (12), calculates the cardinality of a set made out of the colors assigned to the edges in path . The function , in (10), calculates the ratio of the over the length of path , being this a value in the range , yielding 1 only in case the path has a rainbow coloring and lower values as the number of colors used in the path is reduced. The function , in (8), calculates the geometric mean of all the values of all the paths in the disjoint path set , yielding a value in the range with 1 representing a rainbow disjoint path set. The function , in (6), returns the maximum that can be obtained from the set of disjoint path sets between the vertices in the vertex pair yielding 1 if and only if there exists at least one rainbow disjoint path set in . Finally, the function in (4) computes the geometric mean of all the values yielding a result that is 1 if and only if all pairs of vertices have a fitness value of 1; i.e., the given coloring is a rainbow coloring.

The pseudocode of the fitness function is given in Algorithm 2.

2.2. Finding the Set of Internally Disjoint Paths Sets between Pairs of Vertices in a Graph

The total number of possible sets of paths (internally disjoint or not) between the vertices in pair is very high as grows so in order to save computing time when calculating the fitness of an individual, the function in (6) iterates only on the elements of the set which is the set of path sets that contain internally disjoint paths between the vertices in . Algorithm 3 describes a way to calculate and store the set of all .

procedure
set the neighbors of each vertex for current
for Each do
function RECURSIVE
if then wrong length
return
if then has already been visited
return No paths to
if then destination reached
single vertex in path
return single path in the set
for to do
neighbor of
for Each path in do
concatenate paths
aggregate path
return
function
for Each path set of paths do may have huge # of iterations
for Each internal vertex of do
if then
next
return

In this algorithm, the procedure takes each vertex pair in and calls function in order to get the full set of paths between the vertices in with length (since longer paths cannot be rainbow colored). Then it calls another function which tests each set containing paths between the vertices in to see if is a disjoint paths set and returns the set of disjoint paths sets .

The function is recursive and takes 3 parameters: a vertex pair , a graph , and a maximum length of the paths to be found. Figure 1 illustrates how this function works. Paths that go from vertex to vertex are made by adding the step from to of to all paths that go from of to for each . But before doing this, vertex is marked as visited in order to avoid paths that visit a vertex more than once. After computing the set of paths, vertex is unmarked.

In Table 2 we show how several measures grow with parameter . First there is the number of vertices in the cage followed by the total number of vertex pairs. Then there is the number of vertex pairs with distances , , and between them, respectively. We can see how the total number of paths with length between vertex pairs changes with distance and with . The next measure is the important one because it shows the drastic increase with of the total number of paths sets containing paths (internally disjoint and noninternally disjoint) that can be formed with the paths between the pairs of vertices with distances , , and between them, respectively. All these sets need to be tested to see which of them are disjoint pats sets. Finally we show the total number of paths sets that need to be tested and the approximate time to compute this with our existing algorithms and computing power. As one can see the numbers are much bigger as increases making it practically impossible, at the moment, to do the work for .

3. Results

The genetic algorithm was able to find several rainbow colorings of the -Moore cage for and using 7 colors. Using 6 colors, the algorithm could not find any rainbow colorations for neither nor . A sample rainbow coloring that was found can be seen in Figure 2.

4. Conclusions

The problem of finding the rainbow -connectivity of -cages is intractable by exhaustive search. So it had not been possible to verify if it is possible to improve the upper bound given by (2). With the Rank GA we could see that it is unlikely that the upper bound for -cages is less than 7, since with 6 colors no solution was found after having let the algorithm run for a long time. We also found that for the -cage there is an upper bound of 7 colors since the algorithm found rainbow colorings in this case. This upper bound improves quite a lot the 13 colors given by (2) which binds the rainbow -connectivity of -cages with a quadratic function. By finding out that the upper bound for the -cage is 7 we know that this upper bound function could be one that grows slower than a quadratic function and may be much slower. To find the form of this function the problem should be scaled to Moore cages with ; however, for , the problem is computationally very expensive, with the algorithms and computing power that we currently use. Thus, as for future work we will consider different approaches such as taking into account the symmetries of the graph, parallelization, and improvement of algorithms.

We believe that graph theory can benefit from the use of artificial intelligence techniques in some known NP-Complete and NP-Hard problems such as the one presented in this paper and there may be many of these cases.

Data Availability

No data were used to support this study.

Conflicts of Interest

The authors declare that they do not have any conflicts of interest.

Acknowledgments

This work was funded by Universidad Autónoma Metropolitana-Cuajimalpa. The authors would like to thank Dr. Rodolfo René Suárez Molnar, UAM-Cuajimalpa Unit Rector, for institutional support.