A Greedy Technique Based Improved Approach to Solve Graph Colouring Problem

Graph colouring problem is a well-known NP-class optimization problem, studied due to a lot of applications in various real-world problems. Some of these applications are: register allocation, image processing and communication networks. There are various techniques suggested by the researchers to solve the problem which is either exact or approximate in nature. In this paper, a new greedy technique, based on degrees of vertices in the graph is presented to solve the graph colouring problem in an improved manner. The technique involves the use of adjacency matrix along with another matrix generated for the set of possible colours for each vertex in the graph. The generated colour matrix is used to assign the colours among the vertices in the graph based on decreasing degrees of the vertices. Several DIMACS colouring instances solved using the suggested approach in the article and compared with some contemporary techniques for the performance and proves compatible and having better execution time with compared technique. The obtained colouing results are mostly optimal colour values corresponding to the examined colouring instances of the graph.


INTRODUCTION
In recent years graph colouring problem is one of the most recurrent problems studied in the literature due to its capability to address a lot of application problems in the area of Engineering, communication networks and in other real-world problems. The graph colouring problem involves the mapping of the available distinct colours among the nodes in the graph so that neighbouring nodes must be allocated with distinct colours. The minimum number of colours involved in the colouring process in the graph is called the chromatic number of the graph. An application of graph colouring problem is found in the crew scheduling. Researchers proposed encoding of the monthly crew scheduling problem into a graph colouring problem to find a better solution of it [1]. In the article, the researchers have suggested using tabu technique of graph colouring problem that can be employed in the crew scheduling problem as well. The tabu technique can be used along with the heuristics in a sequential manner. In the proposed solution the authors embedded the branch and bound method along with a column generation technique to achieve the improved result for the problem. The graph colouring problem can also be mapped to the register allocation in the computer. In programming, registers are allocated to different variables found in loops during the time for which proper and optimize allocation is required. This problem is also addressed using graph colouring and researchers find a solution for allocation the allocation of registers [2]. Initially, the allocation problem initiated with colouring of the vertices of a circular arc graph. The register allocation problem can be understood in terms of graph colouring by considering the variables as the vertices of the graph. The connection between the vertices in a graph implies that the variables in the particular program are required to use the same registers. The researchers suggested an improved solution for the allocation of the registers by encoding the problem into colouring problem of graph. Another application of the graph colouring problem is found in the time table scheduling. For example time table scheduling in a college or a university where we need to schedule courses among different sections. Designing a 2 time table with the limited resources involves a lot of complications and therefore this problem handled manually. By automating this process, would not only save time but can also eliminate the possibility of errors. Several techniques to resolve this problem have proposed and out of those one technique involves the use of genetic algorithms by transforming the problem into graph colouring. With the use of the genetic algorithm, researchers proposed an efficient solution to this problem by encoding it into graph colouring for successful mapping of the courses into the time table [3]. Another use of graph colouring problem comes from its use in address sorting in mailing process. In the business mail delivery process, the mails need to be delivered at the addresses mentioned on the envelopes. In the process, the mails which received at the post office are first sorted based on the address mentioned on their respective addresses using the OCR system. Generally, the OCR system only makes use of linear architecture which just localizes the address block. This process is not very efficient and thus has found its way to be optimized by using various techniques. One of those includes the use of graph colouring based solution. The investigators suggested a model based on hierarchical graph colouring problem to resolve the issue related to block localization and generate an improved solution for it [4].
Just like time table scheduling, examination scheduling problem can also be addressed using graph colouring technique. The constraints related to the feasible courses for which students registered along with feasible dates on which examination may be scheduled for a particular course so that common students may appear in the examination. The entire scheduling of the examination should be done efficiently with the least possible duration for scheduling the examination of all the courses. Investigators suggested the solution of the problem by encoding constraints of examination in graph colouring problem and gave the solution by creating the clusters of the nodes and then applied heuristic to get the solution of the problem [5]. There are many more applications of the graph colouring problem in other areas like personal safety issues in nuclear applications [6], frequency assignment problem in communication networks [7], resource allocation in bus networks [8], sharing of channels in dynamic spectrum network [9], caching of files near to small base station [10], minimization of spatial tube collision in video browsing [11], resource allocation in LTE networks [12], sparse matrix compression [13], spectrum utilization in femtocell network [14], role assignment in sensor network [15], in robot design [16] and in electronic equipment partitioning [17] are several key application areas addressed using graph colouring problem. In the proposed research work, we present a greedy technique for colouring of the vertices based on the computation of the degree of each vertex in the graph and then using computed information and applying the colouring procedure to allocate the colour to each vertex in the graph. The technique involves several other auxiliary procedures to perform the colouring process which is exact in nature with improved execution time. Although the graph colouring problem can be addressed using several optimization techniques but we tried to solve the problem using the explicit constraint of the problem with the help data structure available in the literature. Since the running time of the operations performed on the used data structure is most of the polynomial order and therefore the proposed technique produces colouring solution in more optimized running time. The mechanism used to devise the algorithms for solving the problem is independent of the types of graph and therefore algorithms may be applied to any kind of graph. The colouring scheme of vertices in the graph is based on the construction of a set of vertices in the decreasing order of degree and entire procedures implemented using array data structure to handle sets generated and matrices used to store graphs and other information.

RELATED WORK
The allocation of channels for frequency in the communication network is addressed by transforming the problem as colouring problem of a graph then formulating the colouring problem using set covering technique, the researchers computed an optimal number of channels required to assign the frequency in the network [18]. The graphs produced in the application involves VLSI technology is another area in which the produced graphs needs to be coloured. The technique used to colour the vertices of the generated graphs is by decomposing the graph in a binary fashion. The resulted decomposition is in the form of balanced height decomposition and the authors suggested approximation based procedure using max-cut principle to solve the colouring problem of graph [19]. The computation based on the optimization of biological operations by the use of DNA Computing technique researchers suggested an optimal way to produce the colouring solution of graphs [20]. The approach is based on the proposition that vertices in the graph is ordered in such a way that mostly nth and (n+1)th labelled vertex is neighbouring nodes to each other. The second constraint used in the technique is related to the use of the least number of encodings representing the colours in the problem. The applied technique is examined by conducting the experiment with a graph of twelve vertices and the result obtained with three colours which was the chromatic number of the examined graph. Although the experimental data set is small but it gives the new technique to address the solution for the problem that can also be applied to find the solution for graphs having a large number of nodes. Evolutionary technique is also applied for finding the graph colouring problem's solution. In one approach that uses A Greedy Technique Based Improved Approach to Solve Graph Colouring Problem 3 optimization technique involving Multiple-Resart Quasi-Hopfield network [21]. The authors identified three variants of colouring problems for finding the solution. The addressed colouring problems are as under.
i-Minimum Colouring problem ii-Spanning Subgraph k-colouring problem iii-Induced Sugraph k-colouring problem For getting the efficient running time for their proposed algorithms the technique involves the use of k-state neurons instead of binary neurons that reduces the connections in the constructed neural network. Several other approaches are available in the literature to address the problem using optimization techniques. Artificial Bee Colony optimization-based approach [22] , DNA algorithm based multi separation model [23], learning automata-based solution [24], using chaos neural network [25] in which researchers non-monotonous activation function in the proposed model to get the solution of the problem. The researchers suggested a technique to assign the colours among the vertices in the graph using a method that is exact in nature, comprises of linear decomposition applied on the considered graph for colouring [26]. For handling the graphs with unbounded linear width they suggested a hybrid technique based on decomposition and heuristic method. The brief outlines of the procedure adopted to find the colouring solution for bounded linear width graphs is as under. 1. Consider the graph G(V,E) as input 2. Compute lower bound and upper bound of C // here C is chromatic number of the considered graph for colouring 3. Repeat

4.
Establish the value of C between the lower bound and upper bound computed in step 2
If( solution = FALSE) then lower bound= lower bound+1 Else upper bound= C 7. Until ( lower bound != upper bound) 8. End In the above steps, C-colouring is an auxiliary procedure that computes the colouriing solution and it returns True value when the graph is C-colourable graph and this computation is based on the decomposition of the graph. The suggested procedure works efficiently for the graphs having a small linear width like in case mug category of graphs. Authors also suggested the solution of the problem by transforming the graph into the trees to compute maximal independent sets so that each vertex in a particular set may be assigned similar colour [27]. Authors suggested a hybrid technique that uses the Learning Automata along to perform local search and Michigan technique to generate colouring solution [28]. The suggested procedure works in a distributed manner in which each chromosome locally grows using evolutionary operator by improving solution set using local search. The technique involves branch and pricing model for constructing the colouring solution is another approach that uses a good mix of metaheuristic, tabu search and column generation mechanism to get optimal colour values for the graph [29]. Researchers developed a model, based for the design of railway station with the optimized infrastructural capability to accommodate facilities by encoding the problem in graph colouring problem [30]. In this problem, authors tried to provide shortest infrastructure occupation time of the track from the current running time of all the tracks on the station. Improved utilization of cellular capacity in the vehicle to vehicle communication is another application area that has addressed efficiently using graph colouring problem [31]. The caching of files in the memories of small cell base station is addressed by the researchers by transforming the problem into graph colouring to find the optimized caching of the files in the memory of base station cells [32]. The versatile applications of this problem in various realworld problems always motivate the researchers to provide an improved way of finding the colouring solution of the graphs generated from the application problem.

MOTIVATION FOR OUR APPROACH
Graph colouring problem is studied due to its various applications in the real world problem which required to be solved efficiently not only in terms of optimal colour values but also for the result in better execution time. There is a lot of techniques available in the literature to address the problem using different techniques. But there is no single technique available in the literature that solves all different categories of colouring instances of the graphs generated from different real-world applications. Therefore we have tried devise a technique that may be used to solve any graph instances generated from application problems at least in terms of successful colouring results. The technique is also experimentally examined for several categories of DIMACS colouring instances for its running time and optimal colouring values of tested graphs

DATA STRUCTURE & TECHNIQUE USED FOR COLOURING
The proposed technique involved the use of adjacency matrix representation of graph that stores the adjacent node of each vertex in the graph. The adjacent node information of each vertex is retrieved from the matrix after assigning a particular colour to the designated vertex to forbid used colour to other neighbouring vertices. Let a graph drawn in EAI Endorsed Transactions Scalable Information Systems 04 2021 -06 2021 | Volume 8 | Issue 31 | e4 Figure 1 is a 3-colourable graph and its adjacency matrix is shown in Table 1.

Figure1: An example of 3-colourable graph
The neighbouring information of the vertices in the above graph is stored in the matrix created in Table 1.  The entries in the matrix stored in table 1 consist of binary values. The value 0 in any cell represents that the vertex in the corresponding row is non-adjacent vertex of the corresponding column (like node 0 is non-adjacent node to 3) otherwise vertex in the row is the adjacent vertex of corresponding column vertex (like node 1 is the adjacent node to vertex 3). The adjacency matrix generated for the graph is stored in a two-dimensional array of size NxN where N is the number of vertices in the graph. We used additionally colour matrix that stores feasible colour information corresponding to each vertex in the graph. The colour matrix created for the graph in figure 1 is shown in table 2. 0  0  1  2  3   1  0  1  2  3  2  0  1  2  3  3  0  1  2  3   Table 2: Colour matrix created for the graph of figure 1.

Set of feasible colours
The objective of the above colour matrix created in table 2 is that initially, we assuming that the number of colours required to colour the nodes in the graph is maximum up to the number of vertices in the graph and it is true in case of a graph generated in the application problem is a completely connected graph. Although in this assumption the only drawback is that it consumes more memory to represent a colour matrix in case of the chromatic number of a graph is smaller than the number of nodes but its execution time is not varied so much for usual cases except for initialization phase where the entire matrix is initialized with discrete values. The marking of forbidden colours for a particular row is done only for the currently used colours that is supposed to be restricted in adjacent nodes.

PROPOSED ALGORITHMS
The proposed technique selects the un-coloured vertex having a maximum degree in every phase for colouring. Initially, the degree of each vertex in the graph is computed and stored in a one-dimensional array.  The algorithm Greedy_GCP( ) computes the degrees of each vertex in the graph initially before the actual colouring process. After that procedure discovers the un-coloured vertex with the highest degree for colouring. Then it calls the procedure search to select the appropriate colour for the selected vertex for colouring. Finally, the procedure terminates with updating the colour matrix g for adjacent nodes of the currently coloured vertex.

ANALYSIS OF THE PROPOSED ALGORITHMS
The formal analysis of the suggested procedure is straightforward and simple. The algorithm Greedy_GCP ( ) started with the one-time initialization of the colour matrix followed with the computation of degrees of the vertices in the graph. In the later phase of the algorithm each vertex selected for colouring in the decreasing order of degrees. Finally, after allocation of the colour to a particular vertex, the update procedure called for each adjacent vertex of currently coloured vertex to forbid the used colour. The run time analysis of the suggested procedures is computed in the following way. 1

ILLUSTRATION WITH EXAMPLE
Suppose the graph shown in figure 1 is coloured using the suggested algorithms in section 4 that requires initially a colour matrix as constructed in table 2. The number of degree corresponding to each vertex of the graph is computed in table 3   Vertex  Degree  0  2  1  3  2  3  3 2 Table 3: The degrees of the vertices in the graph of Figure 1 Now the vertex with the highest degree is selected for colouring. In the case of few vertices having the same maximum values the last vertex found is selected for colouring. Like in above table 3 vertex 1 and vertex 2 is having the same highest degree 3 and therefore the vertex 2 is selected for colouring. The first non-negative colour available in colour matrix corresponding row containing vertex 2 is returned by the search procedure for the allocation to node 2 in the graph. The updated colour matrix after assigning the colour to To forbid a particular colour from the adjacent nodes of currently assigned colour vertex the colour value is reset with value -1.

Vertex
Set of feasible colours 0 -1 1 2 3 Table 4: Updated colour matrix after allocation of colour 0 to vertex 2.
In the above table, -1 entry corresponding to each row indicates that colour 0 cannot be assigned to nodes 0,1and node 2 respectively. The reason for making vertex as -2 is that at the time of updating the colours for other vertices this node will not be explored as previously it has already allocated some colour. Table 5: Updated degrees of the vertices in the graph after assigning the colour to vertex 2. Similarly in the above table containing the degree of vertex 2 is reset with value -2 indicates that this node has assigned some colour and therefore in the next phase of finding the node with a maximum degree, this node is automatically discarded. Finally, the vertex selected for colouring, set feasible colours and colour allocated to a particular vertex is shown in table 6.
In the above table, the set of colour values is considered from 0 to m-1 in the increasing order and m is the number of vertices in the graph. The negative colour values indicate that these colour sequences have forbidden to the corresponding vertex.

EXPERIMENTAL OUTCOMES AND DISCUSSIONS
The algorithms presented in section 5, have examined on the several graph colouring instances of DIMACS [37]. These graphs are in the form of (vertex, edge) pair (see at https://mat.tepper.cmu.edu/COLOR02). The algorithms executed on Turbo C3 2.2.0 compiler on Windows 7(32 bit) platform with Intel Pentium D CPU@2.8 GHZ, 4 GB RAM. The tested graphs is stored in the form of an adjacency matrix by converting the DIMACS instances using Python 3.6. The proposed algorithms terminated with optimal colouring values for most of the tested graphs. The DIMACS graph colouring instances and the associated result on the execution of the proposed algorithms are computed in Table 7. In the table the first column indicates the name of graph, subsequently, 2nd column contains the number of vertices in the graph, 3rd column contains the number of edges in the graph, 4th column contains colouring results (K) after the execution of the proposed algorithms and 5th column contains execution time in seconds. X (G) is the chromatic number of the graph and entry in the 6th column as "?" indicates that chromatic number is unknown and 7th column shows the best-known colouring values for the graphs of the corresponding 1st column.   On analyzing the comparison results shown in table 8, the colouring results for compared graphs are the same but in a few cases, the running time of our proposed technique indicated in bold is better than MOCA. Although the hardware configuration used for experimentation in MOCA is unknown and therefore the execution mentioned in the research article is used for comparison. The comparison result with a technique based on edge cover-based graph colouring [34] and phase dynamics coupled oscillatory networks [35] finds more promising in terms of optimal colouring values for the tested graphs. The comparison results are shown in Table 9.  The comparison results are shown in Table 9 with edge cover-based graph colouring technique our greedy technique based approach is found better and produces optimal colouring values or near to optimal colouring for 11 graphs mentioned in bold entries in 3 rd column [34] in the getting the solution our technique finds more promising and achieved the optimal colouring values for the compared graphs and other fails to achieve that. For the graphs myciel6, david and huck the colouring values in the 4 th of the table is optimal in our case however for [35] it is not so. Blank entries in the 4 th column indicate that the graphs corresponding to those columns not considered in the paper. On comparing the result obtained in greedy based improved technique for graph colouring problem with modified simulated annealing technique [36] our result is better in terms of execution time for each compared graph instances (Table 10). In a few class of graphs, our technique produces optimal or near to optimal colouring values (bold entries in 2 nd column) but modified simulated annealing technique fails to achieve optimal colour values for those graphs Graph Name  Although the hardware used in [36] for the implementation of the suggested algorithm by the researchers Xeon@2.4 GHZ with 1 GB RAM which is a little bit slower than our case (CPU@ 2.8 and 4 GB RAM) but there is a significant difference between running time with our case and [36] and our technique is more efficient as compared to modified simulated annealing technique for solving the graph colouring problem.

CONCLUSION AND FUTURE SCOPE
The proposed work intends to solve the graph colouring problem based on the greedy selection of vertex in the decreasing order of degree for colouring. The algorithms proposed can be applied to any kind of graphs for finding the colouring solution in an exact manner. The computed complexity for the procedures results in polynomial order and on most of the tested DIMACS graph colouring instances our technique produces optimal colouring values.
Although there is no single technique available in the literature that can solve all categories of the graphs with optimal colour values. Therefore in the presented technique we used data structure available in the literature and tried to solve the problem with efficient running time for those problems that may be successfully solved with our technique. Since this graph colouring problem is an NP-complete problem and therefore there is always a hope that the running time of the contemporary techniques may be optimized. The other improvement may be possible in terms of memory uses in the proposed technique. Like in our case initially colour matrix uses m number of colours which is only possible in case the graph is completely connected graph. Another improvement may be possible by eliminating the requirement of colour matrix that reduces the memory requirement as well as its processing time for keeping the previous assigned colour information of the vertices.