180 likes | 356 Views
Computing the chromatic number for block intersection graphs of Latin squares. Ed Sykes CS 721 project. McMaster University, December 2004. Slide 1. A Latin square is a combinatorial structure that plays a large role in the combinatorial design theory.
E N D
Computing the chromatic numberfor block intersection graphs of Latin squares Ed SykesCS 721 project McMaster University, December 2004 Slide 1
A Latin square is a combinatorial structure that plays a large role in the combinatorial design theory. A Latin square is a square matrix of positive integers so that the sum of each column and each row gives the same number: 0 1 2 3 4 1 3 0 4 2 2 4 1 0 3 3 2 4 1 0 4 0 3 2 1 10 10 Slide 2
A block of a Latin square is formed by a triple {i,j,aij} where i is the row index, j is the column index, and aij the entry at that position. For the purpose of creating the block intersection graph, we make sure that the set of row indexes and the set of column indexes are disjoint: Slide 3
{A,a,0}{A,b,1}{A,c,2}{A,d,3}{A,e,4}{B,a,1}{B,b,3}{B,c,0}{B,d,4}{B,e,2}{A,a,0}{A,b,1}{A,c,2}{A,d,3}{A,e,4}{B,a,1}{B,b,3}{B,c,0}{B,d,4}{B,e,2} {C,a,2}{C,b,4}{C,c,1}{C,d,0}{C,e,3}{D,a,3}{D,b,2}{D,c,4}{D,d,1}{D,e,0} {E,a,4}{E,b,0}{E,c,3}{E,d,2}{E,e,1} a b c e dA 0 1 2 3 4B 1 3 0 4 2C 2 4 1 0 3D 3 2 4 1 0E 4 0 3 2 1 Slide 4
The block intersection graph of a Latin square is formed by the blocks as the vertices and two blocks form an edge if their intersection is non-empty. Slide 5
{A,a,0}{A,b,1}{A,c,2}{A,d,3}{A,e,4}{B,a,1}{B,b,3}{B,c,0}{B,d,4}{B,e,2}{A,a,0}{A,b,1}{A,c,2}{A,d,3}{A,e,4}{B,a,1}{B,b,3}{B,c,0}{B,d,4}{B,e,2} {C,a,2}{C,b,4}{C,c,1}{C,d,0}{C,e,3}{D,a,3}{D,b,2}{D,c,4}{D,d,1}{D,e,0} {E,a,4}{E,b,0}{E,c,3}{E,d,2}{E,e,1} See someedges: Slide 6
01111101001001010001110001011111000011000101001001110110010110100011000011011101010100001110010001101111000011010010010110001110000111110100100101000101010101110100111000011001010011011001100010101100000111110101010001101001000101111101000101001000111010010001011111100010010010010101010111011001100001100101001101100110001011001000110111010001101010000110100111110100010010110010110001000101111101000110001001110001011101010001010011001100110111010001010100100011011101000111000100101000111111001001100011001011000101000111111000011000101001001101110011001100001011010011011001100001110010010101110101001100010010100011111100111110100100101000111000101111100001100010100100111011001011010001100001101110101010000111001000110111100001101001001011000111000011111010010010100010101010111010011100001100101001101100110001010110000011111010101000110100100010111110100010100100011101001000101111110001001001001010101011101100110000110010100110110011000101100100011011101000110101000011010011111010001001011001011000100010111110100011000100111000101110101000101001100110011011101000101010010001101110100011100010010100011111100100110001100101100010100011111100001100010100100110111001100110000101101001101100110000111001001010111010100110001001010001111110 A complete adjacency matrix for the graph is shown here: Slide 7
A colouring of a graph is an assignment of colours to vertices so that no two adjacent vertices get the same colour: For our block intersection graph: Slide 8
{A,b,1} gets colour 1 {A,c,2} gets colour 2{A,d,3} gets colour 3 {A,e,4} gets colour 4{B,a,1} gets colour 2 {B,b,3} gets colour 4{B,c,0} gets colour 3 {B,d,4} gets colour 5{B,e,2} gets colour 1 {C,a,2} gets colour 4{C,b,4} gets colour 2 {C,c,1} gets colour 5{C,d,0} gets colour 1 {C,e,3} gets colour 0{D,a,3} gets colour 5 {D,b,2} gets colour 3{D,c,4} gets colour 0 {D,d,1} gets colour 4{D,e,0} gets colour 2 {E,a,4} gets colour 3{E,b,0} gets colour 5 {E,c,3} gets colour 1{E,d,2} gets colour 0 {E,e,1} gets colour 6 Slide 9
The chromatic number of a graph is the smallest number of colours one can use to colour the graph.Thus computing the chromatic number of a graph is a combinatorial problem of finding the smallest colouring among all colourings. Prof. Franek asked me to design and implement a simple bound-and-branch backtracking program in C++ to compute chromatic numbers of block intersection graphs of various Latin squares. Slide 10
The input into the program is a line that represents row by row format of a Latin square. • The “real” Latin square is computed and displayed • The blocks are computed and displayed. • The block intersection graph is computed in the form of the adjacency matrix and displayed. Slide 11
The maximum degree (=number of adjacent vertices to a given vertex) is computed, for it is well-known that the chromatic number <= max. degree. • The first N blocks are assigned fixed colours (for a Latin square N x N), for they must have different colours as the first N blocks are all connected by edges (form a clique). • A simple recursive implementation of backtracking is used for generating all possible colourings. Slide 12
When the number of colours used reaches the current minimum (that starts with the max. degree), this line of search is abolished. • On each recursive call all so-far used colours are tried and the first new colour is tried as well. • When all colourings are found and the minimum is established, it is displayed and the last minimal colouring is displayed as well. Slide 13
latin square number 1: 0123413042241033241040321 abcdeA01234B13042C24103D32410E40321{A,a,0}{A,b,1}{A,c,2}{A,d,3}{A,e,4}{B,a,1}{B,b,3}{B,c,0}{B,d,4}{B,e,2}{C,a,2}{C,b,4}{C,c,1}{C,d,0}{C,e,3}{D,a,3} Slide 14
{D,b,2}{D,c,4}{D,d,1}{D,e,0}{E,a,4}{E,b,0}{E,c,3}{E,d,2}{E,e,1}{D,b,2}{D,c,4}{D,d,1}{D,e,0}{E,a,4}{E,b,0}{E,c,3}{E,d,2}{E,e,1} Slide 15
01111101001001010001110001011111000011000101001001110110010110100011000011011101010100001110010001101111000011010010010110001110000111110100100101000101010101110100111000011001010011011001100010101100000111110101010001101001000101111101000101001000111010010001011111100010010010010101010111011001100001100101001101100110001011001000110111010001101010000110100111110100010010110010110001000101111101000110001001110001011101010001010011001100110111010001010100100011011101000111000100101000111111001001100011001011000101000111111000011000101001001101110011001100001011010011011001100001110010010101110101001100010010100011111100111110100100101000111000101111100001100010100100111011001011010001100001101110101010000111001000110111100001101001001011000111000011111010010010100010101010111010011100001100101001101100110001010110000011111010101000110100100010111110100010100100011101001000101111110001001001001010101011101100110000110010100110110011000101100100011011101000110101000011010011111010001001011001011000100010111110100011000100111000101110101000101001100110011011101000101010010001101110100011100010010100011111100100110001100101100010100011111100001100010100100110111001100110000101101001101100110000111001001010111010100110001001010001111110 Slide 16
max degree=12chromatic number=7minimum colouring:{A,a,0} gets colour 0{A,b,1} gets colour 1{A,c,2} gets colour 2{A,d,3} gets colour 3{A,e,4} gets colour 4{B,a,1} gets colour 2{B,b,3} gets colour 4{B,c,0} gets colour 3{B,d,4} gets colour 5{B,e,2} gets colour 1{C,a,2} gets colour 4{C,b,4} gets colour 2{C,c,1} gets colour 5{C,d,0} gets colour 1{C,e,3} gets colour 0{D,a,3} gets colour 5{D,b,2} gets colour 3{D,c,4} gets colour 0{D,d,1} gets colour 4{D,e,0} gets colour 2{E,a,4} gets colour 3{E,b,0} gets colour 5 Slide 17
{E,b,0} gets colour 5{E,c,3} gets colour 1{E,d,2} gets colour 0{E,e,1} gets colour 6 In conclusion: The program performed well for Latin squares of size 5, 6, and 7. However, for Latin squares of size 8 the combinatorial explosion occurred and to compute just one chromatic number took over 12 days. For even larger Latin squares the problem is not computationally feasible. Slide 18