Recoloring k-degenerate graphs

Size: px
Start display at page:

Download "Recoloring k-degenerate graphs"

Transcription

1 Recoloring k-degenerate graphs Jozef Jirásek Pavel Klavík 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 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

3 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

4 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

5 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

6 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

7 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

8 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

9 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

10 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

Properties of red-black trees

Properties of red-black trees Red-Black Trees Introduction We have seen that a binary search tree is a useful tool. I.e., if its height is h, then we can implement any basic operation on it in O(h) units of time. The problem: given

More information

Figure 4.1: The evolution of a rooted tree.

Figure 4.1: The evolution of a rooted tree. 106 CHAPTER 4. INDUCTION, RECURSION AND RECURRENCES 4.6 Rooted Trees 4.6.1 The idea of a rooted tree We talked about how a tree diagram helps us visualize merge sort or other divide and conquer algorithms.

More information

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1 CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford (sidford@stanford.edu) January 11, 2018 Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1 In this lecture

More information

March 20/2003 Jayakanth Srinivasan,

March 20/2003 Jayakanth Srinivasan, Definition : A simple graph G = (V, E) consists of V, a nonempty set of vertices, and E, a set of unordered pairs of distinct elements of V called edges. Definition : In a multigraph G = (V, E) two or

More information

Search Trees. Undirected graph Directed graph Tree Binary search tree

Search Trees. Undirected graph Directed graph Tree Binary search tree Search Trees Undirected graph Directed graph Tree Binary search tree 1 Binary Search Tree Binary search key property: Let x be a node in a binary search tree. If y is a node in the left subtree of x, then

More information

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:

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: We have seen that the insert operation on a RB takes an amount of time proportional to the number of the levels of the tree (since the additional operations required to do any rebalancing require constant

More information

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

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 Chapter 7 Trees 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 Tree Terminology Parent Ancestor Child Descendant Siblings

More information

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

Trees. 3. (Minimally Connected) G is connected and deleting any of its edges gives rise to a disconnected graph. Trees 1 Introduction Trees are very special kind of (undirected) graphs. Formally speaking, a tree is a connected graph that is acyclic. 1 This definition has some drawbacks: given a graph it is not trivial

More information

Trees. Arash Rafiey. 20 October, 2015

Trees. Arash Rafiey. 20 October, 2015 20 October, 2015 Definition Let G = (V, E) be a loop-free undirected graph. G is called a tree if G is connected and contains no cycle. Definition Let G = (V, E) be a loop-free undirected graph. G is called

More information

W4231: Analysis of Algorithms

W4231: Analysis of Algorithms W4231: Analysis of Algorithms 10/21/1999 Definitions for graphs Breadth First Search and Depth First Search Topological Sort. Graphs AgraphG is given by a set of vertices V and a set of edges E. Normally

More information

Trees. Truong Tuan Anh CSE-HCMUT

Trees. Truong Tuan Anh CSE-HCMUT Trees Truong Tuan Anh CSE-HCMUT Outline Basic concepts Trees Trees A tree consists of a finite set of elements, called nodes, and a finite set of directed lines, called branches, that connect the nodes

More information

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

Throughout this course, we use the terms vertex and node interchangeably. Chapter Vertex Coloring. Introduction Vertex coloring is an infamous graph theory problem. It is also a useful toy example to see the style of this course already in the first lecture. Vertex coloring

More information

Kernelization Upper Bounds for Parameterized Graph Coloring Problems

Kernelization Upper Bounds for Parameterized Graph Coloring Problems Kernelization Upper Bounds for Parameterized Graph Coloring Problems Pim de Weijer Master Thesis: ICA-3137910 Supervisor: Hans L. Bodlaender Computing Science, Utrecht University 1 Abstract This thesis

More information

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

Trees : Part 1. Section 4.1. Theory and Terminology. A Tree? A Tree? Theory and Terminology. Theory and Terminology Trees : Part Section. () (2) Preorder, Postorder and Levelorder Traversals Definition: A tree is a connected graph with no cycles Consequences: Between any two vertices, there is exactly one unique path

More information

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

12/5/17. trees. CS 220: Discrete Structures and their Applications. Trees Chapter 11 in zybooks. rooted trees. rooted trees trees CS 220: Discrete Structures and their Applications A tree is an undirected graph that is connected and has no cycles. Trees Chapter 11 in zybooks rooted trees Rooted trees. Given a tree T, choose

More information

Treewidth and graph minors

Treewidth and graph minors Treewidth and graph minors Lectures 9 and 10, December 29, 2011, January 5, 2012 We shall touch upon the theory of Graph Minors by Robertson and Seymour. This theory gives a very general condition under

More information

Lecture 3: Art Gallery Problems and Polygon Triangulation

Lecture 3: Art Gallery Problems and Polygon Triangulation EECS 396/496: Computational Geometry Fall 2017 Lecture 3: Art Gallery Problems and Polygon Triangulation Lecturer: Huck Bennett In this lecture, we study the problem of guarding an art gallery (specified

More information

Graph Theory CS/Math231 Discrete Mathematics Spring2015

Graph Theory CS/Math231 Discrete Mathematics Spring2015 1 Graphs Definition 1 A directed graph (or digraph) G is a pair (V, E), where V is a finite set and E is a binary relation on V. The set V is called the vertex set of G, and its elements are called vertices

More information

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

implementing the breadth-first search algorithm implementing the depth-first search algorithm Graph Traversals 1 Graph Traversals representing graphs adjacency matrices and adjacency lists 2 Implementing the Breadth-First and Depth-First Search Algorithms implementing the breadth-first search algorithm

More information

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

Priority Queues. 1 Introduction. 2 Naïve Implementations. CSci 335 Software Design and Analysis III Chapter 6 Priority Queues. Prof. Priority Queues 1 Introduction Many applications require a special type of queuing in which items are pushed onto the queue by order of arrival, but removed from the queue based on some other priority

More information

Lecture 3: Graphs and flows

Lecture 3: Graphs and flows Chapter 3 Lecture 3: Graphs and flows Graphs: a useful combinatorial structure. Definitions: graph, directed and undirected graph, edge as ordered pair, path, cycle, connected graph, strongly connected

More information

Chapter 11: Graphs and Trees. March 23, 2008

Chapter 11: Graphs and Trees. March 23, 2008 Chapter 11: Graphs and Trees March 23, 2008 Outline 1 11.1 Graphs: An Introduction 2 11.2 Paths and Circuits 3 11.3 Matrix Representations of Graphs 4 11.5 Trees Graphs: Basic Definitions Informally, a

More information

Binary Decision Diagrams

Binary Decision Diagrams Logic and roof Hilary 2016 James Worrell Binary Decision Diagrams A propositional formula is determined up to logical equivalence by its truth table. If the formula has n variables then its truth table

More information

Efficient Generation of Evolutionary Trees

Efficient Generation of Evolutionary Trees fficient Generation of volutionary Trees MUHMM ULLH NN 1 M. SIUR RHMN 2 epartment of omputer Science and ngineering angladesh University of ngineering and Technology (UT) haka-1000, angladesh 1 adnan@cse.buet.ac.bd

More information

Graph and Digraph Glossary

Graph and Digraph Glossary 1 of 15 31.1.2004 14:45 Graph and Digraph Glossary A B C D E F G H I-J K L M N O P-Q R S T U V W-Z Acyclic Graph A graph is acyclic if it contains no cycles. Adjacency Matrix A 0-1 square matrix whose

More information

Algorithms. Deleting from Red-Black Trees B-Trees

Algorithms. Deleting from Red-Black Trees B-Trees Algorithms Deleting from Red-Black Trees B-Trees Recall the rules for BST deletion 1. If vertex to be deleted is a leaf, just delete it. 2. If vertex to be deleted has just one child, replace it with that

More information

Stackless BVH Collision Detection for Physical Simulation

Stackless BVH Collision Detection for Physical Simulation Stackless BVH Collision Detection for Physical Simulation Jesper Damkjær Department of Computer Science, University of Copenhagen Universitetsparken 1, DK-2100, Copenhagen Ø, Denmark damkjaer@diku.dk February

More information

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

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 Chapter 3 - Graphs Undirected Graphs Undirected graph. G = (V, E) V = nodes. E = edges between pairs of nodes. Captures pairwise relationship between objects. Graph size parameters: n = V, m = E. V = {

More information

The Structure of Bull-Free Perfect Graphs

The Structure of Bull-Free Perfect Graphs The Structure of Bull-Free Perfect Graphs Maria Chudnovsky and Irena Penev Columbia University, New York, NY 10027 USA May 18, 2012 Abstract The bull is a graph consisting of a triangle and two vertex-disjoint

More information

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

Chapter 10: Trees. A tree is a connected simple undirected graph with no simple circuits. Chapter 10: Trees A tree is a connected simple undirected graph with no simple circuits. Properties: o There is a unique simple path between any 2 of its vertices. o No loops. o No multiple edges. Example

More information

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

Red-Black Trees. Based on materials by Dennis Frey, Yun Peng, Jian Chen, and Daniel Hood Red-Black Trees Based on materials by Dennis Frey, Yun Peng, Jian Chen, and Daniel Hood Quick Review of Binary Search Trees n Given a node n... q All elements of n s left subtree are less than n.data q

More information

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

Trees Rooted Trees Spanning trees and Shortest Paths. 12. Graphs and Trees 2. Aaron Tan November 2017 12. Graphs and Trees 2 Aaron Tan 6 10 November 2017 1 10.5 Trees 2 Definition Definition Definition: Tree A graph is said to be circuit-free if, and only if, it has no circuits. A graph is called a tree

More information

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

CHAPTER 10 GRAPHS AND TREES. Alessandro Artale UniBZ -  artale/ CHAPTER 10 GRAPHS AND TREES Alessandro Artale UniBZ - http://www.inf.unibz.it/ artale/ SECTION 10.5 Trees Copyright Cengage Learning. All rights reserved. Trees In mathematics, a tree is a connected graph

More information

Efficient pebbling for list traversal synopses

Efficient pebbling for list traversal synopses Efficient pebbling for list traversal synopses Yossi Matias Ely Porat Tel Aviv University Bar-Ilan University & Tel Aviv University Abstract 1 Introduction 1.1 Applications Consider a program P running

More information

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

(2,4) Trees. 2/22/2006 (2,4) Trees 1 (2,4) Trees 9 2 5 7 10 14 2/22/2006 (2,4) Trees 1 Outline and Reading Multi-way search tree ( 10.4.1) Definition Search (2,4) tree ( 10.4.2) Definition Search Insertion Deletion Comparison of dictionary

More information

Introduction to Computers and Programming. Concept Question

Introduction to Computers and Programming. Concept Question Introduction to Computers and Programming Prof. I. K. Lundqvist Lecture 7 April 2 2004 Concept Question G1(V1,E1) A graph G(V, where E) is V1 a finite = {}, nonempty E1 = {} set of G2(V2,E2) vertices and

More information

CS521 \ Notes for the Final Exam

CS521 \ Notes for the Final Exam CS521 \ Notes for final exam 1 Ariel Stolerman Asymptotic Notations: CS521 \ Notes for the Final Exam Notation Definition Limit Big-O ( ) Small-o ( ) Big- ( ) Small- ( ) Big- ( ) Notes: ( ) ( ) ( ) ( )

More information

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

These notes present some properties of chordal graphs, a set of undirected graphs that are important for undirected graphical models. Undirected Graphical Models: Chordal Graphs, Decomposable Graphs, Junction Trees, and Factorizations Peter Bartlett. October 2003. These notes present some properties of chordal graphs, a set of undirected

More information

6. Finding Efficient Compressions; Huffman and Hu-Tucker

6. Finding Efficient Compressions; Huffman and Hu-Tucker 6. Finding Efficient Compressions; Huffman and Hu-Tucker We now address the question: how do we find a code that uses the frequency information about k length patterns efficiently to shorten our message?

More information

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.

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. Chapter 3 Trees Section 3. Fundamental Properties of Trees Suppose your city is planning to construct a rapid rail system. They want to construct the most economical system possible that will meet the

More information

Paths, Flowers and Vertex Cover

Paths, Flowers and Vertex Cover Paths, Flowers and Vertex Cover Venkatesh Raman, M.S. Ramanujan, and Saket Saurabh Presenting: Hen Sender 1 Introduction 2 Abstract. It is well known that in a bipartite (and more generally in a Konig)

More information

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

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 Section 5.5 Binary Tree A binary tree is a rooted tree in which each vertex has at most two children and each child is designated as being a left child or a right child. Thus, in a binary tree, each vertex

More information

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

CSE 530A. B+ Trees. Washington University Fall 2013 CSE 530A B+ Trees Washington University Fall 2013 B Trees A B tree is an ordered (non-binary) tree where the internal nodes can have a varying number of child nodes (within some range) B Trees When a key

More information

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

4 Basics of Trees. Petr Hliněný, FI MU Brno 1 FI: MA010: Trees and Forests 4 Basics of Trees Trees, actually acyclic connected simple graphs, are among the simplest graph classes. Despite their simplicity, they still have rich structure and many useful application, such as in

More information

CS 6783 (Applied Algorithms) Lecture 5

CS 6783 (Applied Algorithms) Lecture 5 CS 6783 (Applied Algorithms) Lecture 5 Antonina Kolokolova January 19, 2012 1 Minimum Spanning Trees An undirected graph G is a pair (V, E); V is a set (of vertices or nodes); E is a set of (undirected)

More information

Balanced search trees. DS 2017/2018

Balanced search trees. DS 2017/2018 Balanced search trees. DS 2017/2018 Red-black trees Symmetric binary B-tree, Rudolf Bayer, 1972. The balancing is maintained by using a coloring of the nodes. The red-black trees are binary search trees

More information

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

Advanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret Advanced Algorithms Class Notes for Monday, October 23, 2012 Min Ye, Mingfu Shao, and Bernard Moret Greedy Algorithms (continued) The best known application where the greedy algorithm is optimal is surely

More information

Copyright 2000, Kevin Wayne 1

Copyright 2000, Kevin Wayne 1 Chapter 3 - Graphs Undirected Graphs Undirected graph. G = (V, E) V = nodes. E = edges between pairs of nodes. Captures pairwise relationship between objects. Graph size parameters: n = V, m = E. Directed

More information

Optimization I : Brute force and Greedy strategy

Optimization I : Brute force and Greedy strategy Chapter 3 Optimization I : Brute force and Greedy strategy A generic definition of an optimization problem involves a set of constraints that defines a subset in some underlying space (like the Euclidean

More information

Trees Algorhyme by Radia Perlman

Trees Algorhyme by Radia Perlman Algorhyme by Radia Perlman I think that I shall never see A graph more lovely than a tree. A tree whose crucial property Is loop-free connectivity. A tree which must be sure to span. So packets can reach

More information

Module 5 Graph Algorithms

Module 5 Graph Algorithms Module 5 Graph lgorithms Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 97 E-mail: natarajan.meghanathan@jsums.edu 5. Graph Traversal lgorithms Depth First

More information

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

Data Structure Lecture#10: Binary Trees (Chapter 5) U Kang Seoul National University Data Structure Lecture#10: Binary Trees (Chapter 5) U Kang Seoul National University U Kang (2016) 1 In This Lecture The concept of binary tree, its terms, and its operations Full binary tree theorem Idea

More information

Lecture 6: Analysis of Algorithms (CS )

Lecture 6: Analysis of Algorithms (CS ) Lecture 6: Analysis of Algorithms (CS583-002) Amarda Shehu October 08, 2014 1 Outline of Today s Class 2 Traversals Querying Insertion and Deletion Sorting with BSTs 3 Red-black Trees Height of a Red-black

More information

Algorithms. AVL Tree

Algorithms. AVL Tree Algorithms AVL Tree Balanced binary tree The disadvantage of a binary search tree is that its height can be as large as N-1 This means that the time needed to perform insertion and deletion and many other

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 4 Graphs Definitions Traversals Adam Smith 9/8/10 Exercise How can you simulate an array with two unbounded stacks and a small amount of memory? (Hint: think of a

More information

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

Outline. Definition. 2 Height-Balance. 3 Searches. 4 Rotations. 5 Insertion. 6 Deletions. 7 Reference. 1 Every node is either red or black. Outline 1 Definition Computer Science 331 Red-Black rees Mike Jacobson Department of Computer Science University of Calgary Lectures #20-22 2 Height-Balance 3 Searches 4 Rotations 5 s: Main Case 6 Partial

More information

Problem Set 2 Solutions

Problem Set 2 Solutions Problem Set 2 Solutions Graph Theory 2016 EPFL Frank de Zeeuw & Claudiu Valculescu 1. Prove that the following statements about a graph G are equivalent. - G is a tree; - G is minimally connected (it is

More information

Lecture 4: September 11, 2003

Lecture 4: September 11, 2003 Algorithmic Modeling and Complexity Fall 2003 Lecturer: J. van Leeuwen Lecture 4: September 11, 2003 Scribe: B. de Boer 4.1 Overview This lecture introduced Fixed Parameter Tractable (FPT) problems. An

More information

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

An undirected graph is a tree if and only of there is a unique simple path between any 2 of its vertices. Trees Trees form the most widely used subclasses of graphs. In CS, we make extensive use of trees. Trees are useful in organizing and relating data in databases, file systems and other applications. Formal

More information

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

Depth-First Search Depth-first search (DFS) is another way to traverse the graph. Depth-First Search Depth-first search (DFS) is another way to traverse the graph. Motivating example: In a video game, you are searching for a path from a point in a maze to the exit. The maze can be modeled

More information

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

Section Summary. Introduction to Trees Rooted Trees Trees as Models Properties of Trees Chapter 11 Copyright McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education. Chapter Summary Introduction to Trees Applications

More information

Discrete mathematics

Discrete mathematics Discrete mathematics Petr Kovář petr.kovar@vsb.cz VŠB Technical University of Ostrava DiM 470-2301/02, Winter term 2018/2019 About this file This file is meant to be a guideline for the lecturer. Many

More information

Part 2: Balanced Trees

Part 2: Balanced Trees Part 2: Balanced Trees 1 AVL Trees We could dene a perfectly balanced binary search tree with N nodes to be a complete binary search tree, one in which every level except the last is completely full. A

More information

Fixed-Parameter Algorithms, IA166

Fixed-Parameter Algorithms, IA166 Fixed-Parameter Algorithms, IA166 Sebastian Ordyniak Faculty of Informatics Masaryk University Brno Spring Semester 2013 Introduction Outline 1 Introduction Algorithms on Locally Bounded Treewidth Layer

More information

On Structural Parameterizations of the Matching Cut Problem

On Structural Parameterizations of the Matching Cut Problem On Structural Parameterizations of the Matching Cut Problem N. R. Aravind, Subrahmanyam Kalyanasundaram, and Anjeneya Swami Kare Department of Computer Science and Engineering, IIT Hyderabad, Hyderabad,

More information

Lecture 20 : Trees DRAFT

Lecture 20 : Trees DRAFT CS/Math 240: Introduction to Discrete Mathematics 4/12/2011 Lecture 20 : Trees Instructor: Dieter van Melkebeek Scribe: Dalibor Zelený DRAFT Last time we discussed graphs. Today we continue this discussion,

More information

Consistency and Set Intersection

Consistency and Set Intersection Consistency and Set Intersection Yuanlin Zhang and Roland H.C. Yap National University of Singapore 3 Science Drive 2, Singapore {zhangyl,ryap}@comp.nus.edu.sg Abstract We propose a new framework to study

More information

Lecture 2 : Counting X-trees

Lecture 2 : Counting X-trees Lecture 2 : Counting X-trees MATH285K - Spring 2010 Lecturer: Sebastien Roch References: [SS03, Chapter 1,2] 1 Trees We begin by recalling basic definitions and properties regarding finite trees. DEF 2.1

More information

Algorithms. Red-Black Trees

Algorithms. Red-Black Trees Algorithms Red-Black Trees Red-Black Trees Balanced binary search trees guarantee an O(log n) running time Red-black-tree Binary search tree with an additional attribute for its nodes: color which can

More information

Distributed minimum spanning tree problem

Distributed minimum spanning tree problem Distributed minimum spanning tree problem Juho-Kustaa Kangas 24th November 2012 Abstract Given a connected weighted undirected graph, the minimum spanning tree problem asks for a spanning subtree with

More information

Garbage Collection: recycling unused memory

Garbage Collection: recycling unused memory Outline backtracking garbage collection trees binary search trees tree traversal binary search tree algorithms: add, remove, traverse binary node class 1 Backtracking finding a path through a maze is an

More information

Trees and Tree Traversal

Trees and Tree Traversal Trees and Tree Traversal Material adapted courtesy of Prof. Dave Matuszek at UPENN Definition of a tree A tree is a node with a value and zero or more children Depending on the needs of the program, the

More information

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

COL351: Analysis and Design of Algorithms (CSE, IITD, Semester-I ) Name: Entry number: Name: Entry number: There are 6 questions for a total of 75 points. 1. Consider functions f(n) = 10n2 n + 3 n and g(n) = n3 n. Answer the following: (a) ( 1 / 2 point) State true or false: f(n) is O(g(n)).

More information

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

Hamilton paths & circuits. Gray codes. Hamilton Circuits. Planar Graphs. Hamilton circuits. 10 Nov 2015 Hamilton paths & circuits Def. A path in a multigraph is a Hamilton path if it visits each vertex exactly once. Def. A circuit that is a Hamilton path is called a Hamilton circuit. Hamilton circuits Constructing

More information

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

Chapter 4 Trees. Theorem A graph G has a spanning tree if and only if G is connected. Chapter 4 Trees 4-1 Trees and Spanning Trees Trees, T: A simple, cycle-free, loop-free graph satisfies: If v and w are vertices in T, there is a unique simple path from v to w. Eg. Trees. Spanning trees:

More information

DDS Dynamic Search Trees

DDS Dynamic Search Trees DDS Dynamic Search Trees 1 Data structures l A data structure models some abstract object. It implements a number of operations on this object, which usually can be classified into l creation and deletion

More information

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

Topic 18 Binary Trees A tree may grow a thousand feet tall, but its leaves will return to its roots. -Chinese Proverb Topic 18 "A tree may grow a thousand feet tall, but its leaves will return to its roots." -Chinese Proverb Definitions A tree is an abstract data type one entry point, the root Each node is either a leaf

More information

MAT 145: PROBLEM SET 6

MAT 145: PROBLEM SET 6 MAT 145: PROBLEM SET 6 DUE TO FRIDAY MAR 8 Abstract. This problem set corresponds to the eighth week of the Combinatorics Course in the Winter Quarter 2019. It was posted online on Friday Mar 1 and is

More information

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

v V Question: How many edges are there in a graph with 10 vertices each of degree 6? ECS20 Handout Graphs and Trees March 4, 2015 (updated 3/9) Notion of a graph 1. A graph G = (V,E) consists of V, a nonempty set of vertices (or nodes) and E, a set of pairs of elements of V called edges.

More information

Foundations of Computer Science Spring Mathematical Preliminaries

Foundations of Computer Science Spring Mathematical Preliminaries Foundations of Computer Science Spring 2017 Equivalence Relation, Recursive Definition, and Mathematical Induction Mathematical Preliminaries Mohammad Ashiqur Rahman Department of Computer Science College

More information

Binary Trees

Binary Trees Binary Trees 4-7-2005 Opening Discussion What did we talk about last class? Do you have any code to show? Do you have any questions about the assignment? What is a Tree? You are all familiar with what

More information

Diversity Coloring for Distributed Storage in Mobile Networks

Diversity Coloring for Distributed Storage in Mobile Networks Diversity Coloring for Distributed Storage in Mobile Networks Anxiao (Andrew) Jiang and Jehoshua Bruck California Institute of Technology Abstract: Storing multiple copies of files is crucial for ensuring

More information

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

Λέων-Χαράλαμπος Σταματάρης Λέων-Χαράλαμπος Σταματάρης INTRODUCTION Two classical problems of information dissemination in computer networks: The broadcasting problem: Distributing a particular message from a distinguished source

More information

THE EULER TOUR TECHNIQUE: EVALUATION OF TREE FUNCTIONS

THE EULER TOUR TECHNIQUE: EVALUATION OF TREE FUNCTIONS PARALLEL AND DISTRIBUTED ALGORITHMS BY DEBDEEP MUKHOPADHYAY AND ABHISHEK SOMANI http://cse.iitkgp.ac.in/~debdeep/courses_iitkgp/palgo/index.htm THE EULER TOUR TECHNIQUE: EVALUATION OF TREE FUNCTIONS 2

More information

4 Fractional Dimension of Posets from Trees

4 Fractional Dimension of Posets from Trees 57 4 Fractional Dimension of Posets from Trees In this last chapter, we switch gears a little bit, and fractionalize the dimension of posets We start with a few simple definitions to develop the language

More information

How to Sort by Walking on a Tree

How to Sort by Walking on a Tree How to Sort by Walking on a Tree Daniel Graf ETH Zürich, Department of Computer Science grafdan@ethz.ch Abstract. Consider a graph G with n vertices. On each vertex we place a box. These n vertices and

More information

Characterizations of graph classes by forbidden configurations

Characterizations of graph classes by forbidden configurations Characterizations of graph classes by forbidden configurations Zdeněk Dvořák September 14, 2015 We consider graph classes that can be described by excluding some fixed configurations. Let us give some

More information

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

Uses for Trees About Trees Binary Trees. Trees. Seth Long. January 31, 2010 Uses for About Binary January 31, 2010 Uses for About Binary Uses for Uses for About Basic Idea Implementing Binary Example: Expression Binary Search Uses for Uses for About Binary Uses for Storage Binary

More information

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

arxiv:cs/ v1 [cs.ds] 20 Feb 2003 The Traveling Salesman Problem for Cubic Graphs David Eppstein School of Information & Computer Science University of California, Irvine Irvine, CA 92697-3425, USA eppstein@ics.uci.edu arxiv:cs/0302030v1

More information

4. Suffix Trees and Arrays

4. Suffix Trees and Arrays 4. Suffix Trees and Arrays Let T = T [0..n) be the text. For i [0..n], let T i denote the suffix T [i..n). Furthermore, for any subset C [0..n], we write T C = {T i i C}. In particular, T [0..n] is the

More information

Lecture 8: The Traveling Salesman Problem

Lecture 8: The Traveling Salesman Problem Lecture 8: The Traveling Salesman Problem Let G = (V, E) be an undirected graph. A Hamiltonian cycle of G is a cycle that visits every vertex v V exactly once. Instead of Hamiltonian cycle, we sometimes

More information

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

Drawing Problem. Possible properties Minimum number of edge crossings Small area Straight or short edges Good representation of graph structure... Graph Drawing Embedding Embedding For a given graph G = (V, E), an embedding (into R 2 ) assigns each vertex a coordinate and each edge a (not necessarily straight) line connecting the corresponding coordinates.

More information

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

1 Leaffix Scan, Rootfix Scan, Tree Size, and Depth Lecture 17 Graph Contraction I: Tree Contraction Parallel and Sequential Data Structures and Algorithms, 15-210 (Spring 2012) Lectured by Kanat Tangwongsan March 20, 2012 In this lecture, we will explore

More information

3.1 Basic Definitions and Applications

3.1 Basic Definitions and Applications Graphs hapter hapter Graphs. Basic efinitions and Applications Graph. G = (V, ) n V = nodes. n = edges between pairs of nodes. n aptures pairwise relationship between objects: Undirected graph represents

More information

Fully dynamic algorithm for recognition and modular decomposition of permutation graphs

Fully dynamic algorithm for recognition and modular decomposition of permutation graphs Fully dynamic algorithm for recognition and modular decomposition of permutation graphs Christophe Crespelle Christophe Paul CNRS - Département Informatique, LIRMM, Montpellier {crespell,paul}@lirmm.fr

More information

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

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

More information

Self-Balancing Search Trees. Chapter 11

Self-Balancing Search Trees. Chapter 11 Self-Balancing Search Trees Chapter 11 Chapter Objectives To understand the impact that balance has on the performance of binary search trees To learn about the AVL tree for storing and maintaining a binary

More information

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.

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. 2301-670 Graph theory 1.1 What is a graph? 1 st semester 2550 1 1.1. What is a graph? 1.1.2. Definition. A graph G is a triple (V(G), E(G), ψ G ) consisting of V(G) of vertices, a set E(G), disjoint from

More information

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

Constructions of hamiltonian graphs with bounded degree and diameter O(log n) Constructions of hamiltonian graphs with bounded degree and diameter O(log n) Aleksandar Ilić Faculty of Sciences and Mathematics, University of Niš, Serbia e-mail: aleksandari@gmail.com Dragan Stevanović

More information

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

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 Chapter 4 Trees 2 Introduction for large input, even access time may be prohibitive we need data structures that exhibit running times closer to O(log N) binary search tree 3 Terminology recursive definition

More information