Recoloring k-degenerate graphs

Similar documents
Properties of red-black trees

Figure 4.1: The evolution of a rooted tree.

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1

March 20/2003 Jayakanth Srinivasan,

Search Trees. Undirected graph Directed graph Tree Binary search tree

We will show that the height of a RB tree on n vertices is approximately 2*log n. In class I presented a simple structural proof of this claim:

7.1 Introduction. A (free) tree T is A simple graph such that for every pair of vertices v and w there is a unique path from v to w

Trees. 3. (Minimally Connected) G is connected and deleting any of its edges gives rise to a disconnected graph.

Trees. Arash Rafiey. 20 October, 2015

W4231: Analysis of Algorithms

Trees. Truong Tuan Anh CSE-HCMUT

Throughout this course, we use the terms vertex and node interchangeably.

Kernelization Upper Bounds for Parameterized Graph Coloring Problems

Trees : Part 1. Section 4.1. Theory and Terminology. A Tree? A Tree? Theory and Terminology. Theory and Terminology

12/5/17. trees. CS 220: Discrete Structures and their Applications. Trees Chapter 11 in zybooks. rooted trees. rooted trees

Treewidth and graph minors

Lecture 3: Art Gallery Problems and Polygon Triangulation

Graph Theory CS/Math231 Discrete Mathematics Spring2015

implementing the breadth-first search algorithm implementing the depth-first search algorithm

Priority Queues. 1 Introduction. 2 Naïve Implementations. CSci 335 Software Design and Analysis III Chapter 6 Priority Queues. Prof.

Lecture 3: Graphs and flows

Chapter 11: Graphs and Trees. March 23, 2008

Binary Decision Diagrams

Efficient Generation of Evolutionary Trees

Graph and Digraph Glossary

Algorithms. Deleting from Red-Black Trees B-Trees

Stackless BVH Collision Detection for Physical Simulation

Undirected Graphs. V = { 1, 2, 3, 4, 5, 6, 7, 8 } E = { 1-2, 1-3, 2-3, 2-4, 2-5, 3-5, 3-7, 3-8, 4-5, 5-6 } n = 8 m = 11

The Structure of Bull-Free Perfect Graphs

Chapter 10: Trees. A tree is a connected simple undirected graph with no simple circuits.

Red-Black Trees. Based on materials by Dennis Frey, Yun Peng, Jian Chen, and Daniel Hood

Trees Rooted Trees Spanning trees and Shortest Paths. 12. Graphs and Trees 2. Aaron Tan November 2017

CHAPTER 10 GRAPHS AND TREES. Alessandro Artale UniBZ - artale/

Efficient pebbling for list traversal synopses

(2,4) Trees. 2/22/2006 (2,4) Trees 1

Introduction to Computers and Programming. Concept Question

CS521 \ Notes for the Final Exam

These notes present some properties of chordal graphs, a set of undirected graphs that are important for undirected graphical models.

6. Finding Efficient Compressions; Huffman and Hu-Tucker

Chapter 3 Trees. Theorem A graph T is a tree if, and only if, every two distinct vertices of T are joined by a unique path.

Paths, Flowers and Vertex Cover

Section 5.5. Left subtree The left subtree of a vertex V on a binary tree is the graph formed by the left child L of V, the descendents

CSE 530A. B+ Trees. Washington University Fall 2013

4 Basics of Trees. Petr Hliněný, FI MU Brno 1 FI: MA010: Trees and Forests

CS 6783 (Applied Algorithms) Lecture 5

Balanced search trees. DS 2017/2018

Advanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret

Copyright 2000, Kevin Wayne 1

Optimization I : Brute force and Greedy strategy

Trees Algorhyme by Radia Perlman

Module 5 Graph Algorithms

Data Structure Lecture#10: Binary Trees (Chapter 5) U Kang Seoul National University

Lecture 6: Analysis of Algorithms (CS )

Algorithms. AVL Tree

Algorithm Design and Analysis

Outline. Definition. 2 Height-Balance. 3 Searches. 4 Rotations. 5 Insertion. 6 Deletions. 7 Reference. 1 Every node is either red or black.

Problem Set 2 Solutions

Lecture 4: September 11, 2003

An undirected graph is a tree if and only of there is a unique simple path between any 2 of its vertices.

Depth-First Search Depth-first search (DFS) is another way to traverse the graph.

Section Summary. Introduction to Trees Rooted Trees Trees as Models Properties of Trees

Discrete mathematics

Part 2: Balanced Trees

Fixed-Parameter Algorithms, IA166

On Structural Parameterizations of the Matching Cut Problem

Lecture 20 : Trees DRAFT

Consistency and Set Intersection

Lecture 2 : Counting X-trees

Algorithms. Red-Black Trees

Distributed minimum spanning tree problem

Garbage Collection: recycling unused memory

Trees and Tree Traversal

COL351: Analysis and Design of Algorithms (CSE, IITD, Semester-I ) Name: Entry number:

Hamilton paths & circuits. Gray codes. Hamilton Circuits. Planar Graphs. Hamilton circuits. 10 Nov 2015

Chapter 4 Trees. Theorem A graph G has a spanning tree if and only if G is connected.

DDS Dynamic Search Trees

Topic 18 Binary Trees "A tree may grow a thousand feet tall, but its leaves will return to its roots." -Chinese Proverb

MAT 145: PROBLEM SET 6

v V Question: How many edges are there in a graph with 10 vertices each of degree 6?

Foundations of Computer Science Spring Mathematical Preliminaries

Binary Trees

Diversity Coloring for Distributed Storage in Mobile Networks

Λέων-Χαράλαμπος Σταματάρης

THE EULER TOUR TECHNIQUE: EVALUATION OF TREE FUNCTIONS

4 Fractional Dimension of Posets from Trees

How to Sort by Walking on a Tree

Characterizations of graph classes by forbidden configurations

Uses for Trees About Trees Binary Trees. Trees. Seth Long. January 31, 2010

arxiv:cs/ v1 [cs.ds] 20 Feb 2003

4. Suffix Trees and Arrays

Lecture 8: The Traveling Salesman Problem

Drawing Problem. Possible properties Minimum number of edge crossings Small area Straight or short edges Good representation of graph structure...

1 Leaffix Scan, Rootfix Scan, Tree Size, and Depth

3.1 Basic Definitions and Applications

Fully dynamic algorithm for recognition and modular decomposition of permutation graphs

Chapter Summary. Introduction to Trees Applications of Trees Tree Traversal Spanning Trees Minimum Spanning Trees

Self-Balancing Search Trees. Chapter 11

A graph is finite if its vertex set and edge set are finite. We call a graph with just one vertex trivial and all other graphs nontrivial.

Constructions of hamiltonian graphs with bounded degree and diameter O(log n)

Introduction. for large input, even access time may be prohibitive we need data structures that exhibit times closer to O(log N) binary search tree

Transcription:

Recoloring k-degenerate graphs Jozef Jirásek jirasekjozef@gmailcom Pavel Klavík pavel@klavikcz May 2, 2008 bstract This article presents several methods of transforming a given correct coloring of a k-degenerate graph into another given coloring by changing colors of vertices one by one, while still maintaining correctenss of the coloring We will prove the following: ny coloring of a k-degenerate graph by k + 2 colors can be transformed into another such coloring ny coloring of a k-path, k-tree and a partial k-tree by k+2 colors can be transformed to another such coloring in O `n 2 steps 1 Introduction Consider a d-degenerate graph G with n vertices, and two given correct colorings of G by d + c colors We ask how many operations of changing the color of one vertex are necessary to change one coloring of G to the other, such that G is correctly colored during the entire process We are especially interested whether this number grows polynomially or exponentially with the number of vertices of G For c = 1 this recoloring is not always possible (consider a complete graph with d + 1 vertices) For c = 2 we will prove that there always exists such a sequence of steps, although the maximum number of steps might be exponential relative to number of vertices of G We will consider two special cases of d-degenerate graphs, k-paths and k-trees We will show a method providing O ( n 2) steps for the transition between any two given colorings Note: Throughout the text we will consider only simple connected graphs In case of a graph with several components, we can recolor each component independently 1

2 Definitions d-degenerate graph is a graph which contains at least one vertex v with degree less than or equal d, and its subgraph G = G v is also d-degenerate, or an empty graph coloring of graph G by c colors is a function f : V (G) C where C is a finite set of colors correct coloring is a coloring such that for no two connected vertices u and v holds f(u) = f(v) graph G with such a function f is a colored graph G f We will always denote the colors by capital letters: C = {,, } The intuitive definition of coloring will be often used, such as vertex u has a color or change the color of u from to recoloring of a colored graph G f to a different coloring G f is a series of steps, where each steps consists of changing the value of f(v) for one vertex v V (G) fter every step G f has to be correctly colored efore the first step the coloring of G is f, after the last step it is f The length of such recoloring is the number of steps it contains 3 Recoloring d-degenerate graphs d-degenerate graph can always be colored by d+1 colors, but there might not always exist a recoloring between two such colorings Consider a complete graph with d + 1 vertices with each vertex having a unique color It is clearly d-degenerate and changing the color of any vertex will create an incorrect coloring Theorem 1 For a d-degenerate graph G with n vertices and two given colorings of G using d + 2 colors there always exists a recoloring between those two colorings Proof: We will prove it by induction according to n For n = 1 the recoloring is trivial We want to prove n + 1 n Graph G is d-degenerate, therefore it contains a vertex v with at most d neighbors Consider the graph G = G v y definition it is d-degenerate, and from induction we know that there exists a recoloring of G The steps in this recoloring will be also valid for G, apart from cases when a vertex u which is a neighbor of v is being recolored to the color of v However, we know that v has at most d neighbors Those can have at most d different colors s we can use d + 2 colors, there always exists a color different from all of those and also different from the color we want u to receive Therefore we can first recolor v to this color and then proceed with the recoloring normally However this method gives an exponential number of steps, as in the worst case we need to recolor v for every step of recoloring of G, therefore we need twice the ammount of steps needed to recolor a graph with n 1 vertices In the following, we will try to lower the number of required steps for certain special classes of d-degenerated graphs 2

4 Recoloring k-paths k-path is a graph created from a single path (or 1-path) by adding edges between each two vertices which are distant at most k vertices on the path Figure 1: 3-path with 6 vertices Each k-path is also k-degenerate We can remove a vertex of degree k from one end of the path and the resulting graph will be a k-path again 41 Coloring tree Given a fixed coloring of several (at least k) vertices from one end of a k-path G, the first still uncolored vertex v can get only one of two colors It has k neighbors with fixed colors, and those from a clique, therefore each of them must have a different color s we have only k + 2 colors and cannot use any of the k colors given to the neighbors of v, v must have one of the two remaining colors v C D Figure 2: Two possible colors of v For each of the choices, the next vertex u on the path has k 1 neighbors with fixed colors, and vertex v, the color of which we have chosen Therefore for each choice of a color of v the vertex u has again only two possible colors v u C D D C Figure 3: Possible colors of v and u In this way we can build a binary coloring tree T for the k-path G Each vertex in G corresponds with one level of vertices in T Each path in T from the root to a leaf 3

represents one correct coloring of G We can also see that the possible choice of colors for one vertex depends only on the colors of k previous vertices We will note colors of these vertices in lower-left index, to stress the fact that the last color is the actual color the vertex will have C D C CD DC D D D D C C C C D D D C C C D D C D C C D Figure 4: Coloring tree for a 2-path Lemma 2 fter k + 1 levels, the whole tree structure begins to repeat itself in exactly two subtrees of T Proof: The possible colors of a vertex v depend only on the colors of k previous vertices on the path Therefore, the tree structure of T starting with vertex v is determined only by the combination of the color of v and colors of k previous vertices If the same combination of colors appears on any other vertex of T, a subtree starting with that vertex will be the same as the one starting with v (Not exactly the same, as they might not have equal depths, but up to the depth of the shorter one they will be identical) It is also easy to see that given a vertex t of T, the lower index of both children of t will be the same as the lower index of t without the first color, and with the color of t as the last color The neighbors of a vertex v in G represented by children of t are the last k 1 neighbors of the vertex represented by t, and that vertex will be the last neighbor of v If a vertex t in T for a k-path G will be marked CJK L, its two children will be CDKLM and CDKL N In order to get the sequence CJK L again, we have to push the M or N out of the left end of the index, and at the same time rebuild the original sequence This gives us only one choice of k + 1 following vertices for either child of t CDKLM CDELM DEFM MIJ K CJK L CDKLN CDELN DEFN NIJ K CJK L Therefore, for each child of t, the structure of T will repeat itself up to the depth of T after k + 1 levels again 4

We will draw the coloring trees so that the repeated subtrees will be the leftmost and rightmost ones, as shown in Figure 4 42 Recoloring the k-path Now we have established that for a given k-path G with several vertices at one end already colored we can uniquely construct a coloring tree T, and that every correct coloring of G corresponds with one path from the root of T to one of its leaves If we imagine this path as a series of directions to go left or go right as we progress through the tree, we can represent it as a sequence of left and right arrows with length equal to the depth of T Lemma 3 Every valid coloring of G with fixed color of at least k vertices at one end can be represented as a sequence of left and right arrows Proof: Each valid coloring of G is represented by one path in T from the root to a leaf Each such path can be represented as a unique sequence of left and right arrows Inversely, each sequence of arrows represents one path in T, and that represents one coloring of G Lemma 4 Changing the color of one vertex v in G is equivalent to flipping a sequence of k+1 consequent equally oriented arrows in the arrow representation of the coloring Proof: We will show how the arrow sequence changes if we recolor one vertex v of G First, colors of vertices on the path before v do not change, therefore we can consider them fixed Second, colors of vertices after v do not change, so they have to have the same labels in T To assure this, the path representing the coloring must pass through one of the two identical subtrees fter the recoloring, it will pass through the other identical subtree Generally, if there is a sequence of k + 1 subsequent arrows pointing in one direction, we can find a place in the coloring tree T where the path goes k + 1 times left (or right) and goes from the root of some subtree to one of the two subtrees identical to it Then, as shown above, we can change the color of one vertex in G while maintaining correctness of the coloring (the path will be still valid in T, therefore representing a correct coloring) It is easy to see that the k + 1 arrows in the sequence will flip lso note that no other arrows will change in the process 5

v C C D C CD DC D D D D C C C C C D D D C C C D D C D C C D Figure 5: Changing the color of one vertex of a k-path v D C D C CD DC D D D D C C C C C D D D C C C D D C D C C D Figure 6: to another color Lemma 5 We can change the orientation of one arrow in the sequence in O (n) steps, without changing the arrows before the one we want to change Proof: ssume for a while that we can find a sequence of k + 1 consecutive arrows with equal orientation somewhere in the sequence, after the one we want to flip Let s take the first such sequence, and flip it according to Lemma 4 ecause it was the first such sequence, the arrow preceding it must have pointed in the other direction Therefore, after the flipping, its direction will be the same as direction of the arrows in the flipped sequence Now, we can repeat the procedure, starting with the first arrow of the newly-created sequence Every operation happens closer to the one arrow we want to change, because there is always at least one arrow added to the beginning of the sequence being flipped We can continue in this manner until we finally flip the arrow 6

we were considering t most, we do O (n) such flips, as with each one we move at least one arrow (ie one vertex) closer The following figure shows the procedure to flip one arrow (fourth in the row) for k = 2 The arrows being flipped are underlined rrows in the left part are not affected Figure 7: Changing the orientation of one arrow We can now repeat the process for the next arrow in the sequence, if it is oriented in the wrong direction The operation will not change orientations of any of already processed arrows We can turn each arrow in O (n) steps, and therefore change the sequence as we like in O ( n 2) steps ccording to Lemmas 3 and 4 we have just recolored a k-path in O ( n 2) steps of changing the color of one vertex 43 Edge conditions So far, we were always considering vertices far enough from either end of the path That is, for every vertex being recolored we assumed existence of at least k vertices in both direction on the path to guarantee an unique way of recoloring We can fix this by adding several virtual vertices to either end of the path and color them as necessary Note that for every operation of changing one arrow to the desired orientation as described by Lemma 5 we might need a different set of virtual vertices t the end of the path, we can add k virtual vertices, build the coloring tree for them and color them in such a way that their arrows in the arrow sequence will have the same orientation as the last arrow belonging to the original k-path This way we can ensure that there will always be a sequence of k + 1 consecutive equally orinted arrows, as we required in the proof of Lemma 5 t the begining of the path, we need to create k vertices with fixed colors to build a unique coloring tree If we already have l vertices colored correctly, we can consider their colors fixed If l k we are done Otherwise we need to add another k l virtual vertices colored such that the next vertex will only have two possible colors the one it has now and the one we want it to have in the final coloring However, as there are k + 2 possible colors, l of those are taken by already colored vertices and we need two more for the next vertex, that leaves us with exactly k l colors for the virtual vertices Note that if we start adding them to the beginning of the path, each will have its color predetermined, as there are always k vertices which will be its neighbors, and we have to leave one color free for the vertex being recolored fter adding them, the coloring tree can be built correctly 7

44 Conclusion Theorem 6 It is possible to recolor a given k-path from one given coloring by k + 2 colors to another in O ( n 2) steps Proof: We will show an algorithm to do this Take the first vertex which has a color different from the one required in the final coloring If it is one of the first k vertices, create virtual vertices at the begining of the path as above uild the coloring tree and find arrow sequences for both colorings If there is not a sequence of k + 1 consecutive equally oriented arrows, add virtual vertices to the end of the path as shown above Flip the arrows to change the color of the incorrectly colored vertex This will take O (n) steps Repeat this procedure for every vertex, starting at one end of the path and ending at the other end ccording to Lemma 5, colors of already processed vertices will not change Therefore, recoloring the whole path will take O ( n 2) steps 5 Recoloring k-trees We will now extend this method to k-trees (complete) k-tree is built similarly to a k-path, from a tree graph (or 1-tree) by adding edges from each vertex to its parent, the parent of its parent, the parent of the parent of its parent, etc up to k predecessors Figure 8: n example of a 3-tree Theorem 7 It is possible to recolor a given k-tree from one given coloring by k + 2 colors to another in O ( n 2) steps We will recolor vertices one by one similarly to k-paths, except for the places where the k-tree branches However, observe that all of the individual branches are either smaller k-trees, or just k-paths, which we are already able to recolor We can make all of them have the same colors of the first k vertices Observe that we can do this in linear time, as it is enough to bring a sequence of k equally oriented arrows to the beginning the arrow sequence for every branch When this is done, we can recolor the vertex at the branching The possible colors of that vertex will be the same as if there was only one such colored k-path instead of all the branches Therefore, again, we can change the color of one vertex, considering colors of its ancestors fixed, in O (n) time In the worst case we will have to flip every sequence of 8

k + 1 consecutive arrows in every branch once to bring it to the front of the sequence, this corresponds to changing the color of every descendant of the vertex we want to change once Note that once again we are not changing colors of any ancestors of this vertex If we begin at the root of the tree and progress towards the leaves, for example using the breadth-first method, we will use O (n) operations for every vertex, and therefore O ( n 2) steps to recolor the whole k-tree 6 Partial k-trees partial (or incomplete) k-tree is a connected subgraph of a k-tree The most notable difference between partial and complete k-trees is that given a k-tree G and a partial k-tree G which is a subgraph of G, any coloring of G is a valid coloring of G, but not vice versa Two vertices connected in G but not in G can share the same color in G The recoloring method for partial k-trees will not be as straightforward as for complete k-trees Consider the obvious fact that if we can change a coloring G f into G f in c steps, we can repeat the steps in the opposite way and change G f into G f in c steps too Then, if we want to change the coloring of G f into another coloring G g, we will do it in four steps: Find a recoloring of G f to any correct coloring of the complete k-tree G f Find a recoloring of G g to any correct coloring of G g s in section 5, find a recoloring of G f to G g Now recolor in this way: G f G f G g G g s every correct coloring of G is also a correct coloring of G, the recoloring of G f into G g obtained in step three will also be valid in G 61 Recoloring a partial k-tree into a coloring of a complete k-tree Consider the changes in the coloring tree T(G ) resulting from omitting an edge in G If we follow the creation of a coloring tree, a vertex which had one or more edges removed will now have more colors available, as it has less neighbors restricting certain colors Therefore, T(G ) will no longer be a binary tree, it may contain several vertices with more than two children Figure 9: Vertex of T with more than two children 9

Now, every such vertex v has two children which are also in the recoloring tree T(G) of a complete k-tree G If the current recoloring path is passing through one of them, we can simply forget about all the other children of v as the color of the current vertex in G is also correct in G In the other case, we can always pick two childern of v: the one the coloring path is passing through and one of the children which are in T(G) Now consider only those two children and forget the rest of children of v This will make v have only two children lso we will pick v as the lowest vertex in T(G ) which has more than two children That way, all the descendants of v will form a correct binary coloring tree of a k-tree Now we can see that we will also have a correct coloring tree if we consider the vertex v and only the two selected children of v and their subtrees We can now find a way to switch the first arrow on the path, making the recoloring path go through the child of v which is also in T(G), therefore fixing the vertex This can be done in O (n) steps, as it is equivalent to the operation of flipping one arrow in a complete k-tree Recolor as a complete k-tree Figure 10: We have to consider only two children of v This way, we can always find one such vertex of T(G ) from which the path goes to a vertex not in T(G) and fix the vertex so that the path passes only through T(G) Notice also that this will always keep the changing part of the path fully contained in T(G), as the operations being executed always work only in T(G) s we can fix every vertex where the path goes outside of T(G) in O (n) steps, we can fix the whole path in T(G ) to contain only vertices of T(G) in O ( n 2) steps Theorem 8 Given any two colorings of a partial k-tree G, G f and G g, we can find a recoloring transforming G f into G g in O ( n 2) steps Consider the order of operations given in the list above We have just shown that the first two will take O ( n 2) steps, and in section 5 we have shown that the third one will also take O ( n 2) steps Therefore, the whole recoloring process will also take O ( n 2) steps 10