Indian Journal of Science ANALYSIS International Journal for Science ISSN 2319 – 7730 EISSN 2319 – 7749

Graph colouring problem applied in genetic algorithm

Malathi R

Assistant Professor, Dept of Mathematics, Scsvmv University, Enathur, Kanchipuram, Tamil Nadu 631561, India, Email Id: [email protected]

Publication History Received: 06 January 2015 Accepted: 05 February 2015 Published: 18 February 2015

Citation Malathi R. Graph colouring problem applied in genetic algorithm. Indian Journal of Science, 2015, 13(38), 37-41

ABSTRACT In this paper we present a hybrid technique that applies a genetic algorithm followed by wisdom of artificial crowds that approach to solve the graph-coloring problem. The genetic algorithm described here, utilizes more than one parent selection and mutation methods depending u p on the state of fitness of its best solution. This results in shifting the solution to the global optimum, more quickly than using a single parent selection or mutation method. The algorithm is tested against the standard DIMACS benchmark tests while, limiting the number of usable colors to the chromatic numbers. The proposed algorithm succeeded to solve the sample data set and even outperformed a recent approach in terms of the minimum number of colors needed to color some of the graphs. The Problem (GCP) is also known as complete problem. Graph coloring also includes vertex coloring and . However, mostly the term graph coloring refers to vertex coloring rather than edge coloring.

Given a number of vertices, which form a connected graph, the objective is that to color each vertex so that if two vertices are connected in the graph (i.e. adjacent) they will be colored with different colors. Moreover, the number of different colors that is used to color the vertices is limited and a secondary objective is that to find the minimum number of different colors needed to color a certain graph without violating the adjacency constraint. That number for a given graph (G) is also known as Chromatic Number (χ(G)) (Isabel Méndez Díaz and Paula Zabala 1999). If k = {1, 2, 3...} and P(G, k) is the possible number of solutions for coloring the graph G with k colors, then

χ(G) = min( k : P(G,k)>0) ……… (1)

Graph coloring problems are very interesting problems from the theoretical standpoint since they are a class of NP complete problems that also belongs to Constraint Satisfaction Problems (CSPs). The practical applications of GCP (Graph Coloring Problems) include but are not limited to:  Map coloring (B. H. Gwee, M. H. Lim and J. S.Ho 1993)  Scheduling (Daniel Marx and D Aniel Marx 2004)  Radio Frequency Assignment (W. K. Hale 1980;S. Singha, T. Bhattacharya and S. R. B. Chaudhuri 2008)  Register allocation (Wu Shengning and Li Sikun 2007)  Pattern Matching  Sudoku 37

Malathi, Page Graph colouring problem applied in genetic algorithm, Indian journal of Science, 2015, 13(38), 37-41, www.discovery.org.in http://www.discovery.org.in/ijs.htm © 2015 Discovery Publication. All Rights Reserved In this paper we demonstrate the use of genetic algorithms to solve the graph-coloring problem while strictly adhering to the usage of not more than the number of colors equal to the chromatic index to color the various test graphs. Genetic algorithms and evolutionary approaches have been used extensively for the solutions in the Graph Coloring Problem and its applications. The concept of utilizing a crowd of individuals for solving NP complete problems has also been the topic in various papers. Most notably the Wisdom of Crowds concept has been used in solving the Traveling Salesman Problem (Sheng Kung Michael Yi, et al. 2010b) as well as for the Minimum Spanning Tree Problem (Sheng Kung Michael Yi, et al. 2010a). In this paper we attempt to add-on or increase the solution produced by the genetic algorithm utilizing an artificial crowd.

Graph or network: A collection of n links connected by m edges is known as graph or network. A network can be directed to the edges of point in one direction. Edges go in both directions is undirected. The edge can join more than two vertices together is well – known as hyper graph.

List coloring: Generally, for a function (f) assigning a positive integer f(v) to each vertex(v ), a graph G is f-choosable (or f-list- colorable) if it has a list coloring no matter how one assigns a list of f(v) colors to each vertex (v). In particular, if for all vertices (v), f-choosability corresponds to k-choosability.

List edge coloring: In mathematics, list edge-coloring is a type of graph coloring that joins list coloring and edge coloring. An instance of a list edge-coloring problem consists of a graph together with a list of allowed colors, for each edge. A list edge-coloring is a choice of a color for each edge, from its list of allowed colors; a coloring is proper only if no two adjacent edges receive the same color. A graph G is k-edge-choosable if every instance of list edge-coloring that has G as its fundamental graph and that provides at least k allowed colors for each edge of G has a proper coloring. The edge choosability, or list edge color ability list edge chromatic number, or list chromatic index, ch′(G) of graph (G) is the least number k such that G is k-edge-choosable

Total coloring: In , total coloring is a type of graph coloring on the vertices and edges of a graph. When used without any qualification, a total coloring is always assumed to be proper in the sense that no adjacent edges and no edge and its end vertices are assigned the same color. The total chromatic number χ″(G) of a graph G is the least number of colors needed in any total coloring of G. The total graph T = T(G) of a graph (G) is a graph such that (i) the vertex set of T corresponds to the vertices and edges of G and (ii) two vertices are adjacent in T  their corresponding elements are either adjacent or incident in G. Then total coloring becomes a proper vertex coloring of the total graph.

Some properties of χ″(G): 1. χ″(G) ≥ Δ( G) + 1. 2. χ″(G) ≤ Δ( G) + 1026. 3. χ″(G) ≤ Δ( G) + 8 ln8(Δ(G)) for sufficiently large Δ(G). 4. χ″(G) ≤ ch′(G) + 2.

Here Δ(G) is the maximum ; and ch′(G), the edge choosability.

Total coloring occurs naturally since it is simply a combination of vertex and edge colorings. The next step is to look for any Brooks-typed orVizing-typed upper bound on the entire chromatic number in terms of maximum degree. It turns out that the total coloring version of maximum degree upper bound is a difficult problem and has evaded mathematicians for 40 years.

Harmonious colouring In graph theory, a harmonious coloring is a proper vertex coloring in which every pair of colors appears on at most one pair of adjacent vertices. The harmonious chromatic number χH(G) of a graph G is the least number of colors needed for any harmonious coloring of G. Every graph has a harmonious coloring, since it suffices to allot every vertex a distinct color; thus χH(G) ≤ |V(G)|. They slightly exist graphs G with χH(G) > χ(G) (where χ is the chromatic number); one example is the path of length 2, which can be 2-colored but has no harmonious coloring with 2 colors.

Some properties of χH(G):

χH(Tk,3) = (3/2)(k+1) , where Tk,3 is the complete k-ary tree with 3 levels (Mitchem 1989). Harmonious coloring was first proposed by Harary and Plantholt (1982). Still very little is known about it. ⌈ ⌉ 38

Malathi, Page Graph colouring problem applied in genetic algorithm, Indian journal of Science, 2015, 13(38), 37-41, www.discovery.org.in http://www.discovery.org.in/ijs.htm © 2015 Discovery Publication. All Rights Reserved Complete colouring: In graph theory, is the reverse of harmonious coloring in the sense that it is a vertex coloring in which every pair of colors appears on at least one pair of adjacent vertices. Equivalently, a complete coloring is least in the sense that it cannot be transformed into a proper coloring with fewer colors by merging pairs of color classes. The achromatic number ψ(G) of a graph G is the highest number of colors possible in any complete coloring of G.

Extract colouring: In graph theory, an is a proper vertex coloring in which every pair of colors appears on exactly one pair of adjacent vertices. In essence, an exact coloring is a coloring that is together harmonious and complete. Graphs that confess exact colorings have been classified.

Cyclic colouring: In graph theory, an acyclic coloring is a proper vertex coloring in which every 2-chromatic sub – graph is acyclic. The acyclic chromatic number A(G) of a graph (G) is the minimum number of colors needed in any acyclic coloring of G. Acyclic coloring is often associated with graphs fixed on non-plane surfaces.

Star colouring: In graph-theoretic mathematics, a star coloring of a graph G is a proper vertex coloring in which every path on four vertices uses at least three separate colors. Equivalently, in a star coloring, the induced sub - graphs formed by the vertices of any two colors has connected components that are star graphs. Star coloring has been introduced by Grünbaum (1973). The star chromatic number of G is the minimum number of colors needed to star color G. One generalization of star coloring is the closely related concept of acyclic coloring, where it is required that every cycle uses at least three colors, so the two-color tempted sub – graphs are forests. If we indicate the acyclic chromatic number of a graph G by , we have that , and in fact every star coloring of G is an acyclic coloring.

Strong colouring In graph theory, a strong coloring, with respect to a divider of the vertices into (disjoint) subsets of equal sizes, is a proper vertex coloring in which every color appears exactly once in every divider. When the order of the graph G is not isolatable by k, we add isolated vertices to G just enough to make the order of the new graph G′ divisible by k. In that case, a strong coloring of G′ defect the previously added isolated vertices is considered a strong coloring of G. A graph is strongly k-colorable if, for each partition of the vertices into sets of size k, it own up a strong coloring.

The strong chromatic number sχ(G) of a graph G is the least k such that G is strongly k-colorable. A graph is strongly k-chromatic if it has strong chromatic number k.

Some properties of sχ(G): 1. sχ(G) > Δ(G). 2. sχ(G) ≤ 3 Δ(G) − 1 3. Asymptotically, sχ(G) ≤ 11 Δ( G) / 4 + o(Δ(G)). Here Δ(G) is the maximum degree.

Cycle rank coloring: The cycle rank r(G) of a digraph G = (V, E) is inductively definite as follows:  If G is acyclic, then r(G) = 0.

If G is strongly connected and E is non – empty, then where G - v is the digraph resulting from removal of vertex v and all edges beginning or ending at v.  If G is not strongly connected, then r(G) is equal to the maximum cycle rank among all strongly connected mechanism of G.

Vertex coloring Algorithms: There is no good algorithm for coloring the vertices of a graph using the minimum number of colors and as a result there is no good algorithm for determining the chromatic index of a graph. However there are a number of coloring algorithms which give estimates to minimal colorings and we present some of these in this section. The first of these is called the simple in order algorithm. This starts with any sorting of the vertices of the graph G, say v1,…..vn. Now allot color 1 to v1. Moving to vertex v2 color it 1 if it is not adjacent to v1; or else color it 2. Proceeding to v3, color it 1 if it is not adjacent to v1; if it is adjacent to v1, color it 2 if it is not adjacent to v2; if not color it 3. Proceed in this method, coloring each vertex with the first obtainable color that has not been used by any of its neighbors. 39

Malathi, Page Graph colouring problem applied in genetic algorithm, Indian journal of Science, 2015, 13(38), 37-41, www.discovery.org.in http://www.discovery.org.in/ijs.htm © 2015 Discovery Publication. All Rights Reserved The simple sequential Colouring Algorithm:

 Step 1. List the vertices of G as x1,x2,……..,xn. List the colors obtainable as 1, 2,… ………,n  Step 2. For each I = 1,……,n let Ci = {1,2,……,i}, the catalog of colors that could color vertex xi.  Step 3. Set i= 1

 Step 4. Let ci be the first color in Ci and allot this to vertex xi  Step 5. For each j with i < j and xi adjacent to xj in G set Ci = Cj – {ci}.(This means that xj will not be given the same color as xi). Alter I to i+1 and if i+1 n return to Step 4.  Step 6. Trace each vertex and its color.

The largest – First Sequential Algorithm (Welsh and Powell)  Step 1. List the Vertices of G as x1,x2,……xn so that d(x1) d(x2)≥……≥d(xn).List the colors obtainable as 1,2,……,n. Now go on with steps 2 though to 6 of the simple sequential coloring algorithm . We note that there may be some option in the listening in step 1 in particular if the graph is regular!. We demonstrate the welsh and Powell Algorithm using the graph of figure 6.9.

 Step:2. C1 = {1}, …….,C6 = {1,2,3,4,5,6}.  Step:3. i = 1

 Step:4. x1 is allotted color 1, i.e., v3 has color 1.  Step:5. C2 = {2}, C5 = {2,3,4,5}, C6 = {2,3,4,5,6}. i become 2  Step:4. x2is allotted color 2, i.e., v4 has color 2.  Step:5. C3 = {1,3}, C4 = {1,3,4}. i becomes 3.  Step:5. X3 is allotted color 1, i.e., v1 has color 1 and so on until we reach the final result , namely the top three vertices are colored 1 and the bottom three colored 2, so that we have a 2 – coloring. This is the best likely outcome since G is bipartite.

In fact it turns out any degree- downward listing of the vertices of this graph G will give a two coloring of G so this is indeed an development on the arbitrary simple sequential coloring algorithm. The Welsh and Powell algorithm does not forever give a minimal coloring, even for the bipartite graphs, as can be seen. However it can be shown that the algorithm forever uses atmost +1 colors. We now described a third algorithm called the smallest last in order algorithm due to Matula, Marble and Isaacson which often do better than the welsh and Powell algorithm. It is also a alteration of the simple sequential color algorithm. This time we make a list by first choosing xn, the last vertex in the list as a vertex of least degree in G then we choose xn-1, the second last vertex is the list, to be a vertex of minimum degree in the vertex- deleted sub – graph G-xn. Carry on in this way creating vertex –deleted sub graphs and choosing vertices of minimum degree. This gives us the following original step.

The Smallest last sequential Algorithm:

Step:1 Choose xn to be a vertex of least degree in G. a) For i=n-1, n-2,……1, choose xi to be a vertex of minimum degree in the vertex removed sub graph G-{xn, xn-1, …….xi+1}. b) Catalog the vertices as x1,….. xn. c) List the colors obtainable as 1,……n. Now proceed with steps 2 through to 6 of the simple in order coloring algorithm. We give up a detailed worked example on the smallest- last sequential algorithm. Instead we refer the reader to the graph there the given listing x1,x2,x3…….x7 has been shaped by step:1 parts(a) and (b) of the algorithm (although other listings are also possible). The algorithm then continues to create a 3-colouring for the graph with vertices x1,x3 and x7 colored 1,x2 and x5 colored 2,x4 and x6 colored 3.

Edge Coloring: In this section we turn our attention to coloring edges of a graph in its place of vertices. Recall that two edges of a graph are also known as adjacent. If they have an end vertex in ordinary. As in the vertex coloring case we will guess that all our graphs are simple. Let G be a nonempty graph. An edge coloring of G assigns colors, usually indicated by 1,2,3….., to the edges of G, one color per edge , so that adjacent edges are allotted different colors. A k-edge coloring of graph(G) is a coloring of G which consists of k- different colors and in this case G is said to be k- edge colorable. The least number n for which there is n-coloring of G is called the edge chromatic number (of edge chromatic index) of G and is indicated by χ1(G). If χ1(G)= k we say that G is k-edge chromatic.

Algorithm: wisdom Of Artificial Crowds define: aggregate Chromosome, new Color, expert Chromosomes; expert Chromosomes = best half of the final population; 40 aggregate Chromosome = best performing chromosome; Malathi, Page Graph colouring problem applied in genetic algorithm, Indian journal of Science, 2015, 13(38), 37-41, www.discovery.org.in http://www.discovery.org.in/ijs.htm © 2015 Discovery Publication. All Rights Reserved for each (vertex in graph) { if (vertex is part of a bad edge) { newColor = most used color for vertex among expertChromosomes; aggregateChromosome.setColor(vertex, newColor) } }

Data used to test our approach are resulting from the DIMACS benchmarking graph collection. DIMACS is the middle for Discrete Mathematics and Theoretical Computer Science. The data are often used in challenges involving constraint satisfaction problems.

CONCLUSION The overarching algorithm used in this approach is a genetic algorithm with a following Wisdom of Crowds post-processor. Within the genetic algorithm itself is a set of workers that utilize methods from the genetic algorithm area as well as applying various heuristics in a stochastic manner. The end result is a fast progressive climb to the peak of the globally optimum solution. The algorithms described here can also be useful to the various subsets of the general Graph Coloring Problem (GCP). In particular, Sudoku can advantage from these algorithms where it can be represented as a graph with 81 vertices that must be colored using no more than 9 different colors (i.e. Different numbers). To end our conclusions on a positive note, we can report a very strong effect from changing genetic structures. While we at current have little of worth to say about which genetic structures are good for what problem, we see that (i) changing the genetic structure has a significant effect on solution time and (ii) different genetic structures are excellent for different problems.

REFERENCES 1. Chartrand, Gary (1985), Introductory Graph Theory, Dover, ISBN 0-486- 10. Panconesi, A.; Srinivasan, A. (1996), "On the complexity of distributed 24775-9. network decomposition",Journal of Algorithms 2. Gibbons, Alan (1985), Algorithmic Graph Theory, Cambridge University 11. Schneider, J. (2010), "A new technique for distributed symmetry Press. breaking", Proceedings of theSymposium on Principles of Distributed 3. Harary, Frank (1969), Graph Theory, Reading, MA: Addison-Wesley. Computing 4. C. Flament, Application of Graph Theory to Group Structure (Prentice- 12. R.P. Abelson and M.J. Rosenberg, Symbolic psycho-logic: a model of Hall, Englewood Cliffs,N.J., 1963). attitudinal cognition,Behavior Sci. 3 (1958) 1-13. 5. Harary, Frank; Palmer, Edgar M. (1973), Graphical Enumeration, New 13. Schneider, J. (2008), "A log-star distributed maximal independent set York, NY: Academic Press. algorithm for growth-bounded graphs", Proceedings of the Symposium on 6. Mahadev, N.V.R.; Peled, Uri N. (1995), Threshold Graphs and Related Principles of Distributed Computing Topics, North-Holland. 14. Beigel, R.; Eppstein, D. (2005), "3-coloring in time O(1.3289n)", Journal of 7. Mark Newman (2010), Networks: An Introduction, Oxford University Algorithms 54 (2)):168–204, doi:10.1016/j.jalgor.2004.06.008 Press. 15. Björklund, A.; Husfeldt, T.; Koivisto, M. (2009), "Set partitioning via 8. Y. Caro, R. Yuster, and D. B. West, Connected domination and spanning inclusion–exclusion", SIAM Journal on Computing 39 (2): 546–563, trees, SIAM J. Discrete Math. 13 (2000), 202–211. doi:10.1137/070683933 9. Barenboim, L.; Elkin, M. (2009), "Distributed (Δ + 1)-coloring in linear (in 16. Brélaz, D. (1979), "New methods to color the vertices of a graph", Δ) time", Proceedings of the 41st Symposium on Theory of Computing,pp. Communications of the ACM 22(4):251-256, doi:10.1145/359094.359101 111–120, doi:10.1145/1536414.1536432,ISBN 978-1-60558-506-2 41

Malathi, Page Graph colouring problem applied in genetic algorithm, Indian journal of Science, 2015, 13(38), 37-41, www.discovery.org.in http://www.discovery.org.in/ijs.htm © 2015 Discovery Publication. All Rights Reserved