Graphs and Algorithms Exercise 1 (Greedy Coloring)

Total Page:16

File Type:pdf, Size:1020Kb

Graphs and Algorithms Exercise 1 (Greedy Coloring) ETH Z¨urich FS 2010 Institute of Theoretical Computer Science Sample Solution 4 Dr. Dan Hefetz Anna Gundert Graphs and Algorithms Exercise 1 (Greedy Coloring) (a) Prove that there is an ordering v1, v2, . , vn of the vertices of G such that the greedy color- ing algorithm yields an optimal coloring when using this ordering. Let c : V (G) 7→ [k] with k = χ(G) be an optimal coloring of the vertices of G. Con- sider the color classes Ci = {v ∈ V (G) | c(v) = i} and let ki = |C1 ∪ C2 ∪ ... ∪ Ci| for 1 ≤ i ≤ k. Set k0 = 0. Now, order the vertices of G such that for 1 ≤ i ≤ k we have Ci = {vki−1+1, vki−1+2, . , vki }, i.e. the ordering is built of blocks of consecutive vertices belonging to one color class. Given this ordering the greedy algorithm will color the graph with χ(G) colors. (b) Show that there is a tree T = (V, E) on n vertices and a permutation π : {1, 2, . , n} → V such that the algorithm Greedy-Coloring(T, π) needs Ω(log n) colors. We construct an infinite family of rooted trees Tk (k ≥ 0) as follows: Let T0 be an isolated ver- tex and Tk the tree that is obtained by connecting a new root vertex v to the root vertices of k copies of all trees T0,T1,...,Tk−1. Clearly we have n(Tk) = 2 . We want to show that there is an ordering π of the vertices of Tk such that Greedy-Coloring(Tk, π) = k+1 = Ω(log n). Such an ordering π can be defined recursively. T0 has only one vertex and there is only one possible ordering. The ordering of the vertices of Tk is defined as follows: First visit the vertices of T0, then those of T1 etc. up to Tk−1, and finally visit the new root vertex v (the vertices in each subtree are visited in the order defined for this subtree). It is easy to see by induction that using this ordering the greedy coloring algorithm will always need an additional (k + 1)-th color to color the new root vertex v. Exercise 2 (Completing the proof of Brooks’ Theorem) (For the whole proof: The proof presented on http://www.win.tue.nl/ wscor/OW/CO1b/brooks.pdf is similar to the one given in class and the tutorial.) From the lecture, we know that we can assume that ∆(G) ≥ 3 and that G is ∆(G)-regular and κ(G) = 2, i.e. G is 2-connected but not 3-connected. Let {x, y} be a minimal cut-set and let C be one of the connected components of G \{x, y}. Then V (G) \ c is not-empty and we can consider the two graphs G1 = G[C ∪ {x, y}] and G2 = G[V (G) \ C]. We distinguish two cases: Case 1: {x, y} ∈ E(G) x and y both have neighbors in both G1 and G2. Hence, both G1 and G2 are not regular and by the part of the proof treated in the lecture, we know that they can be colored with ∆(G) colors. Let the resulting colorings be c1 abd c2. Because {x, y} ∈ E(G), x and y have to get different colors in both colorings. We can hence swop colors to get a coloring for G: c1(v) if v ∈ V (G1), c2(v) if v ∈ V (G2), c2(v) ∈/ {a, b, c, d} a if v ∈ V (G ), c (v) = c c(v) = 2 2 , b if v ∈ V (G ), c (v) = d 2 2 c if v ∈ V (G2), c2(v) = a d if v ∈ V (G2), c2(v) = b. where we assume c1(x) = a, c1(y) = b, c2(x) = c, c2(y) = d. Case 2: {x, y} ∈/ E(G) 0 0 0 In this case, we add {x, y} to our three graphs, obtaining the graphs G , G1 and G2. If one of x 0 and y has at least two neighbors in both G1 and G2, it has degree ≤ ∆(G) − 1 in both G1 and 0 0 0 G2. In this case we can proceed as above. If e.g. degG1 (x) = degG1 (y) = 1, let x and y be their 0 neighbors in G1. Then {x, y } is also a cut-set and it fulfills the condition of the first argument of this case..
Recommended publications
  • A Fast and Scalable Graph Coloring Algorithm for Multi-Core and Many-Core Architectures
    A Fast and Scalable Graph Coloring Algorithm for Multi-core and Many-core Architectures Georgios Rokos1, Gerard Gorman2, and Paul H J Kelly1 1 Software Peroformance Optimisation Group, Department of Computing 2 Applied Modelling and Computation Group, Department of Earth Science and Engineering Imperial College London, South Kensington Campus, London SW7 2AZ, United Kingdom, fgeorgios.rokos09,g.gorman,[email protected] Abstract. Irregular computations on unstructured data are an impor- tant class of problems for parallel programming. Graph coloring is often an important preprocessing step, e.g. as a way to perform dependency analysis for safe parallel execution. The total run time of a coloring algo- rithm adds to the overall parallel overhead of the application whereas the number of colors used determines the amount of exposed parallelism. A fast and scalable coloring algorithm using as few colors as possible is vi- tal for the overall parallel performance and scalability of many irregular applications that depend upon runtime dependency analysis. C¸ataly¨ureket al. have proposed a graph coloring algorithm which relies on speculative, local assignment of colors. In this paper we present an improved version which runs even more optimistically with less thread synchronization and reduced number of conflicts compared to C¸ataly¨urek et al.'s algorithm. We show that the new technique scales better on multi- core and many-core systems and performs up to 1.5x faster than its pre- decessor on graphs with high-degree vertices, while keeping the number of colors at the same near-optimal levels. Keywords: Graph Coloring; Greedy Coloring; First-Fit Coloring; Ir- regular Data; Parallel Graph Algorithms; Shared-Memory Parallelism; Optimistic Execution; Many-core Architectures; Intel®Xeon Phi™ 1 Introduction Many modern applications are built around algorithms which operate on irreg- ular data structures, usually in form of graphs.
    [Show full text]
  • I?'!'-Comparability Graphs
    Discrete Mathematics 74 (1989) 173-200 173 North-Holland I?‘!‘-COMPARABILITYGRAPHS C.T. HOANG Department of Computer Science, Rutgers University, New Brunswick, NJ 08903, U.S.A. and B.A. REED Discrete Mathematics Group, Bell Communications Research, Morristown, NJ 07950, U.S.A. In 1981, Chv&tal defined the class of perfectly orderable graphs. This class of perfect graphs contains the comparability graphs. In this paper, we introduce a new class of perfectly orderable graphs, the &comparability graphs. This class generalizes comparability graphs in a natural way. We also prove a decomposition theorem which leads to a structural characteriza- tion of &comparability graphs. Using this characterization, we develop a polynomial-time recognition algorithm and polynomial-time algorithms for the clique and colouring problems for &comparability graphs. 1. Introduction A natural way to color the vertices of a graph is to put them in some order v*cv~<” l < v, and then assign colors in the following manner: (1) Consider the vertxes sequentially (in the sequence given by the order) (2) Assign to each Vi the smallest color (positive integer) not used on any neighbor vi of Vi with j c i. We shall call this the greedy coloring algorithm. An order < of a graph G is perfect if for each subgraph H of G, the greedy algorithm applied to H, gives an optimal coloring of H. An obstruction in a ordered graph (G, <) is a set of four vertices {a, b, c, d} with edges ab, bc, cd (and no other edge) and a c b, d CC. Clearly, if < is a perfect order on G, then (G, C) contains no obstruction (because the chromatic number of an obstruction is twu, but the greedy coloring algorithm uses three colors).
    [Show full text]
  • COLORING and DEGENERACY for DETERMINING VERY LARGE and SPARSE DERIVATIVE MATRICES ASHRAFUL HUQ SUNY Bachelor of Science, Chittag
    COLORING AND DEGENERACY FOR DETERMINING VERY LARGE AND SPARSE DERIVATIVE MATRICES ASHRAFUL HUQ SUNY Bachelor of Science, Chittagong University of Engineering & Technology, 2013 A Thesis Submitted to the School of Graduate Studies of the University of Lethbridge in Partial Fulfillment of the Requirements for the Degree MASTER OF SCIENCE Department of Mathematics and Computer Science University of Lethbridge LETHBRIDGE, ALBERTA, CANADA c Ashraful Huq Suny, 2016 COLORING AND DEGENERACY FOR DETERMINING VERY LARGE AND SPARSE DERIVATIVE MATRICES ASHRAFUL HUQ SUNY Date of Defence: December 19, 2016 Dr. Shahadat Hossain Supervisor Professor Ph.D. Dr. Daya Gaur Committee Member Professor Ph.D. Dr. Robert Benkoczi Committee Member Associate Professor Ph.D. Dr. Howard Cheng Chair, Thesis Examination Com- Associate Professor Ph.D. mittee Dedication To My Parents. iii Abstract Estimation of large sparse Jacobian matrix is a prerequisite for many scientific and engi- neering problems. It is known that determining the nonzero entries of a sparse matrix can be modeled as a graph coloring problem. To find out the optimal partitioning, we have proposed a new algorithm that combines existing exact and heuristic algorithms. We have introduced degeneracy and maximum k-core for sparse matrices to solve the problem in stages. Our combined approach produce better results in terms of partitioning than DSJM and for some test instances, we report optimal partitioning for the first time. iv Acknowledgments I would like to express my deep acknowledgment and profound sense of gratitude to my supervisor Dr. Shahadat Hossain, for his continuous guidance, support, cooperation, and persistent encouragement throughout the journey of my MSc program.
    [Show full text]
  • Graph Coloring Major Themes Vertex Colorings Χ(G) =
    CSC 1300 – Discrete Structures 17: Graph Coloring Major Themes • Vertex coloring • Chromac number χ(G) Graph Coloring • Map coloring • Greedy coloring algorithm • CSC 1300 – Discrete Structures Applicaons Villanova University Villanova CSC 1300 - Dr Papalaskari 1 Villanova CSC 1300 - Dr Papalaskari 2 What is the least number of colors needed for the verFces of Vertex Colorings this graph so that no two adjacent verFces have the same color? Adjacent ver,ces cannot have the same color χ(G) = Chromac number χ(G) = least number of colors needed to color the verFces of a graph so that no two adjacent verFces are assigned the same color? Source: “Discrete Mathemacs” by Chartrand & Zhang, 2011, Waveland Press. Source: “Discrete Mathemacs with Ducks” by Sara-Marie Belcastro, 2012, CRC Press, Fig 13.1. 4 5 Dr Papalaskari 1 CSC 1300 – Discrete Structures 17: Graph Coloring Map Coloring Map Coloring What is the least number of colors needed to color a map? Region è vertex Common border è edge G A D C E B F G H I Villanova CSC 1300 - Dr Papalaskari 8 Villanova CSC 1300 - Dr Papalaskari 9 Coloring the USA Four color theorem Every planar graph is 4-colorable The proof of this theorem is one of the most famous and controversial proofs in mathemacs, because it relies on a computer program. It was first presented in 1976. A more recent reformulaon can be found in this arFcle: Formal Proof – The Four Color Theorem, Georges Gonthier, NoFces of the American Mathemacal Society, December 2008. hp://www.printco.com/pages/State%20Map%20Requirements/USA-colored-12-x-8.gif
    [Show full text]
  • Results on the Grundy Chromatic Number of Graphs Manouchehr Zaker
    Discrete Mathematics 306 (2006) 3166–3173 www.elsevier.com/locate/disc Results on the Grundy chromatic number of graphs Manouchehr Zaker Institute for Advanced Studies in Basic Sciences, 45195-1159 Zanjan, Iran Received 7 November 2003; received in revised form 22 June 2005; accepted 22 June 2005 Available online 7 August 2006 Abstract Given a graph G,byaGrundy k-coloring of G we mean any proper k-vertex coloring of G such that for each two colors i and j, i<j, every vertex of G colored by j has a neighbor with color i. The maximum k for which there exists a Grundy k-coloring is denoted by (G) and called Grundy (chromatic) number of G. We first discuss the fixed-parameter complexity of determining (G)k, for any fixed integer k and show that it is a polynomial time problem. But in general, Grundy number is an NP-complete problem. We show that it is NP-complete even for the complement of bipartite graphs and describe the Grundy number of these graphs in terms of the minimum edge dominating number of their complements. Next we obtain some additive Nordhaus–Gaddum-type inequalities concerning (G) and (Gc), for a few family of graphs. We introduce well-colored graphs, which are graphs G for which applying every greedy coloring results in a coloring of G with (G) colors. Equivalently G is well colored if (G) = (G). We prove that the recognition problem of well-colored graphs is a coNP-complete problem. © 2006 Elsevier B.V. All rights reserved. Keywords: Colorings; Chromatic number; Grundy number; First-fit colorings; NP-complete; Edge dominating sets 1.
    [Show full text]
  • Algorithmic Graph Theory Part III Perfect Graphs and Their Subclasses
    Algorithmic Graph Theory Part III Perfect Graphs and Their Subclasses Martin Milanicˇ [email protected] University of Primorska, Koper, Slovenia Dipartimento di Informatica Universita` degli Studi di Verona, March 2013 1/55 What we’ll do 1 THE BASICS. 2 PERFECT GRAPHS. 3 COGRAPHS. 4 CHORDAL GRAPHS. 5 SPLIT GRAPHS. 6 THRESHOLD GRAPHS. 7 INTERVAL GRAPHS. 2/55 THE BASICS. 2/55 Induced Subgraphs Recall: Definition Given two graphs G = (V , E) and G′ = (V ′, E ′), we say that G is an induced subgraph of G′ if V ⊆ V ′ and E = {uv ∈ E ′ : u, v ∈ V }. Equivalently: G can be obtained from G′ by deleting vertices. Notation: G < G′ 3/55 Hereditary Graph Properties Hereditary graph property (hereditary graph class) = a class of graphs closed under deletion of vertices = a class of graphs closed under taking induced subgraphs Formally: a set of graphs X such that G ∈ X and H < G ⇒ H ∈ X . 4/55 Hereditary Graph Properties Hereditary graph property (Hereditary graph class) = a class of graphs closed under deletion of vertices = a class of graphs closed under taking induced subgraphs Examples: forests complete graphs line graphs bipartite graphs planar graphs graphs of degree at most ∆ triangle-free graphs perfect graphs 5/55 Hereditary Graph Properties Why hereditary graph classes? Vertex deletions are very useful for developing algorithms for various graph optimization problems. Every hereditary graph property can be described in terms of forbidden induced subgraphs. 6/55 Hereditary Graph Properties H-free graph = a graph that does not contain H as an induced subgraph Free(H) = the class of H-free graphs Free(M) := H∈M Free(H) M-free graphT = a graph in Free(M) Proposition X hereditary ⇐⇒ X = Free(M) for some M M = {all (minimal) graphs not in X} The set M is the set of forbidden induced subgraphs for X.
    [Show full text]
  • Greedy Defining Sets of Graphs
    Greedy defining sets of graphs Manouchehr Zaker Department of Mathematical Sciences, Sharif University of Technology, P.O. Box 11365-9415, Tehran, IRAN [email protected] Abstract For a graph G and an order a on V(G), we define a greedy defining set as a subset S of V(G) with an assignment of colors to vertices in S, such that the pre-coloring can be extended to a x( G)-coloring of G by the greedy coloring of (G, a). A greedy defining set ofaX( G)-coloring C of G is a greedy defining set, which results in the coloring C (by the greedy procedure). We denote the size of a greedy defining set of C with minimum cardinality by G D N (G, a, C). In this paper we show that the problem of determining GDN(G,a,C), for an instance (G,a,C) is an NP-complete problem. 1 Introduction and preliminaries We begin with some terminology and notation which are used throughout the paper. For the other necessary definitions and notation, we refer the reader to texts such as [4]. A harmonious coloring of a graph G is a proper vertex coloring of G, such that the subgraph induced on any two different colors has at most one edge. By a hypergraph we mean an ordinary hypergraph which consists of a vertex set V and a collection of subsets of V, called (hyper)edges. In a hypergraph 1£ a block­ ing set is a subset of the vertex set which intersects every edge of 1£.
    [Show full text]
  • The Edge Grundy Numbers of Some Graphs
    b b International Journal of Mathematics and M Computer Science, 12(2017), no. 1, 13–26 CS The Edge Grundy Numbers of Some Graphs Loren Anderson1, Matthew DeVilbiss2, Sarah Holliday3, Peter Johnson4, Anna Kite5, Ryan Matzke6, Jessica McDonald4 1School of Mathematics University of Minnesota Twin Cities Minneapolis, MN 55455, USA 2Department of Mathematics, Statistics, and Computer Science University of Illinois at Chicago Chicago, IL 60607-7045, USA 3Department of Mathematics Kennesaw State University Kennesaw, GA 30144, USA 4Department of Mathematics and Statistics Auburn University Auburn, AL 36849, USA 5Department of Mathematics Wayland Baptist University Plainview, TX 79072, USA 6Department of Mathematics Gettysburg College Gettysburg, PA 17325, USA email: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected] (Received October 27, 2016, Accepted November 19, 2016) Key words and phrases: Grundy coloring, edge Grundy coloring, line graph, grid. AMS (MOS) Subject Classifications: 05C15. This research was supported by NSF grant no. 1262930. ISSN 1814-0432, 2017 http://ijmcs.future-in-tech.net 14 Anderson, DeVilbiss, Holliday, Johnson, Kite, Matzke, McDonald Abstract The edge Grundy numbers of graphs in a number of different classes are determined, notably for the complete and the complete bipartite graphs, as well as for the Petersen graph, the grids, and the cubes. Except for small-graph exceptions, these edge Grundy numbers turn out to equal a natural upper bound of the edge Grundy number, or to be one less than that bound. 1 Grundy colorings and Grundy numbers A Grundy coloring of a (finite simple) graph G is a proper coloring of the vertices of G with positive integers with the property that if v ∈ V (G) is colored with c > 1, then all the colors 1,...,c − 1 appear on neighbors of v.
    [Show full text]
  • Chordal Graphs MPRI 2017–2018
    Chordal graphs MPRI 2017{2018 Chordal graphs MPRI 2017{2018 Michel Habib [email protected] http://www.irif.fr/~habib Sophie Germain, septembre 2017 Chordal graphs MPRI 2017{2018 Schedule Chordal graphs Representation of chordal graphs LBFS and chordal graphs More structural insights of chordal graphs Other classical graph searches and chordal graphs Greedy colorings Chordal graphs MPRI 2017{2018 Chordal graphs Definition A graph is chordal iff it has no chordless cycle of length ≥ 4 or equivalently it has no induced cycle of length ≥ 4. I Chordal graphs are hereditary I Interval graphs are chordal Chordal graphs MPRI 2017{2018 Chordal graphs Applications I Many NP-complete problems for general graphs are polynomial for chordal graphs. I Graph theory : Treewidth (resp. pathwidth) are very important graph parameters that measure distance from a chordal graph (resp. interval graph). 1 I Perfect phylogeny 1. In fact chordal graphs were first defined in a biological modelisation pers- pective ! Chordal graphs MPRI 2017{2018 Chordal graphs G.A. Dirac, On rigid circuit graphs, Abh. Math. Sem. Univ. Hamburg, 38 (1961), pp. 71{76 Chordal graphs MPRI 2017{2018 Representation of chordal graphs About Representations I Interval graphs are chordal graphs I How can we represent chordal graphs ? I As an intersection of some family ? I This family must generalize intervals on a line Chordal graphs MPRI 2017{2018 Representation of chordal graphs Fundamental objects to play with I Maximal Cliques under inclusion I We can have exponentially many maximal cliques : A complete graph Kn in which each vertex is replaced by a pair of false twins has exactly 2n maximal cliques.
    [Show full text]
  • Graph Theory, Part 2
    Graph Theory, Part 2 7 Coloring Suppose that you are responsible for scheduling times for lectures in a university. You want to make sure that any two lectures with a common student occur at different times to avoid a conflict. We could put the various lectures on a chart and mark with an \X" any pair that has students in common: Lecture A C G H I L M P S Astronomy X X X X Chemistry X X Greek X X X X X History X X X X Italian X X X Latin X X X X X X Music X X X X Philosophy X X Spanish X X X X A more convenient representation of this information is a graph with one vertex for each lecture and in which two vertices are joined if there is a conflict between them: S H P C I L G A M Now, we cannot schedule two lectures at the same time if there is a conflict, but we would like to use as few separate times as possible, subject to this constraint. How many different times are necessary? We can code each time with a color, for example 11:00-12:00 might be given the color green, and those lectures that meet at this time will be colored green. The no-conflict rule then means that we need to color the vertices of our graph in such a way that no two adjacent vertices (representing courses which conflict with each other) have the same color. This motivates us to make a definition: Definition 15 (Proper Coloring, k-Coloring, k-Colorable).
    [Show full text]
  • 13.1 Vertex Coloring 13.2 Greedy Coloring
    13.1 Vertex Coloring Assume all graphs are connected and without self loops. A k-coloring of a graph is a labeling f : V (G) ! S, with k = jSj. Essentially, each vertex is assigned a color of 1 : : : k. A coloring is proper if no adjacent vertices share the same color. A graph is k-colorable if it has a proper k-coloring. The chromatic number of a graph χ(G) is the least k for which G is k-colorable. A graph is k-chromatic if χ(G) = k. A proper k-coloring of a k-chromatic graph is an optimal coloring. Note that an optimal coloring is not necessarily unique. If χ(H) < χ(G) = k for every subgraph H of G, then G is color-critical. Remember back to when we discussed independent sets. We can observe that sets com- prised of vertices of the same color in a proper coloring are all independent. 13.2 Greedy Coloring A simple greedy algorithm for creating a proper coloring is shown below. The basic idea is do a single pass through all vertices of the graph in some order and label each one with a numeric identifier. A vertex will labeled/colored with the lowest value that doesn't appear among previously colored neighbors. procedure GreedyColoring(Graph G(V; E)) for all v 2 V (G) do color(v) −1 for all v 2 V (G) in order do isCol(1 ::: ∆(G) + 1) false for all u 2 N(v) where color(u) 6= −1 do isCol(color(u)) true for k = 1 ::: ∆(G) + 1 do if isCol(k) = false then color(v) k break k max(color(1 : : : n)) return k 36 13.3 Coloring Bounds Obviously, 1 ≤ χ(G) ≤ n.
    [Show full text]
  • Arxiv:1807.09034V1 [Math.CO]
    Connected greedy coloring H-free graphs Esdras Mota1, Ana Silva2⋆, and Leonardo Rocha3⋆ 1 Instituto Federal de Educac¸˜ao, Ciˆencia e Tecnologia do Cear´a(UFC) - Quixad´a, CE, Brazil [email protected] 2 Departamento de Matem´atica, Universidade Federal do Cear´a(UFC) - Fortaleza, CE, Brazil [email protected] 3 Universidade Estadual do Cear´a(UECE) - Fortaleza, CE, Brazil [email protected] Abstract. A connected ordering (v1, v2,...,vn) of V (G) is an ordering of the vertices such that vi has at least one neighbour in {v1,...,vi−1} for every i ∈ {2,...,n}.A connected greedy coloring (CGC for short) is a coloring obtained by applying the greedy algorithm to a connected ordering. This has been first introduced in 1989 by Hertz and de Werra, but still very little is known about this problem. An interesting aspect is that, contrary to the traditional greedy coloring, it is not always true that a graph has a connected ordering that produces an optimal coloring; this motivates the definition of the connected chromatic number of G, which is the smallest value χc(G) such that there exists a CGC of G with χc(G) colors. An even more interesting fact is that χc(G) ≤ χ(G) + 1 for every graph G (Benevides et. al. 2014). In this paper, in the light of the dichotomy for the coloring problem restricted to H-free graphs given by Kr´al et.al. in 2001, we are interested in investigating the problems of, given an H-free graph G: (1).
    [Show full text]