# CMSC 451: Graph Properties, DFS, BFS, etc.

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 CMSC 451: Graph Properties, DFS, BFS, etc. Slides By: Carl Kingsford Department of Computer Science University of Maryland, College Park Based on Chapter 3 of Algorithm Design by Kleinberg & Tardos.

2 Graphs Graphs specify pairwise relationships between objects. An undirected graph G = (V, E) is a pair of sets: V is a set of nodes, aka vertices. E is a set of two-elements subset of V. An element of E is of the form: e = {u, v} with u, v V. A graph is directed if E is a set of ordered pairs (u, v), u, v V.

3 Graph Terminology Simple: at most one edge between every pair of vertices. Complete: all possible edges are present (denoted: K n ) Degree of a vertex: number of incident edges. Self-loop: an edge {u, u} often disallowed. Path: a sequence v 1, v 2,..., v k such that {v i, v i+1 } E for i = 1..., k. Simple path: a path with no vertex repeated. Closed path: a path with v 1 = v k. This path is a cycle if it is simple. A graph is connected if there is a path between any pair of vertices. Digraph: short name for directed graph.

4 Graph Terminology, II A graph G = (V G, E G ) is a subgraph of H = (V H, E H ) if V G V H and E G E H. (Connected) Component: a maximal connected subgraph. Cut-edge (aka bridge): an edge whose removal increases the # of connected components

5 Graph Modeling Examples Graphs model many concepts naturally: 1 Social networks 2 Geographic adjacency 3 Polyhedra 4 Chemical Molecules 5 Assigning jobs to applicants 6 Food webs 7 Finite-state machines 8 Markov processes 9 Project dependencies 10 World Wide Web 11 Telephone network 12 Roads

6 Graph Modeling Examples Graphs model many concepts naturally: 1 Social networks 2 Geographic adjacency 3 Polyhedra 4 Chemical Molecules 5 Assigning jobs to applicants last week 6 Food webs 7 Finite-state machines 8 Markov processes 9 Project dependencies today 10 World Wide Web 11 Telephone network 12 Roads

7 Graph Isomorphism When are two graphs the same? Often, we care only about the structure of the graph, and not any vertex labels. Definition (Graph isomorphism) Graphs G and H are isomorphic if there is a bijection f : V G V H such that {u, v} E G {f (u), f (v)} E H. What s an algorithm to test whether two graphs are isomorphic?

8 Graph Isomorphism When are two graphs the same? Often, we care only about the structure of the graph, and not any vertex labels. Definition (Graph isomorphism) Graphs G and H are isomorphic if there is a bijection f : V G V H such that {u, v} E G {f (u), f (v)} E H. What s an algorithm to test whether two graphs are isomorphic? No one knows a really good algorithm. This problem is not known to be NP-complete (unlike Independent Set).

9 Open Problems (Already!) 1 Is there a polynomial time algorithm for Independent Set? 2 Is there a polynomial time algorithm for Graph Isomorphism?

11 Trees Trees are a special type of graph that occur often in algorithms. Definition (Tree) A graph G is a tree if it is connected and contains no cycles.

12 Trees Theorem (Characterization of Trees) The following statements are equivalent: 1 T is a tree. 2 T contains no cycles and n 1 edges. 3 T is connected and has n 1 edges. 4 T is connected and every edge is a cut-edge. 5 Any two nodes in T are connected by exactly 1 path. 6 T is acyclic, and adding any new edge creates exactly one cycle.

13 Tree Terminology A tree is rooted if it has a distinguished vertex called the root. A tree is ordered if it is a rooted tree where the children are assigned an order. In a binary tree, each node has at most 2 children. In a m-ary tree, each node has at most m children. A complete tree is a m-ary tree for which each node has m children and all leaves are at the same level. level/depth 1 level/depth 2 parent of v v level/depth 0 u leaf, and sibling of v height = 2 ancestor of v child of u descendent of u

14 Binary Search Trees A binary search tree is a binary tree where 1 a key k(u) is associated with each node u, and 2 the keys in the subtree rooted at left(u) are all k(u) 3 the keys in the subtree rooted at right(u) are al > k(u). Balanced binary search trees try to avoid long, stringy trees so that when searching we can eliminate about half the remaining elements at each step. E.g. AVL trees let us find any element in O(log n) time, and we can efficiently update them.

15 Graph Traversals

16 Breadth-First Search Breadth-first search explores the nodes of a graph in increasing distance away from some starting vertex s. It decomposes the component into layers L i such that the shortest path from s to each of nodes in L i is of length i. Breadth-First Search: 1 L 0 is the set {s}. 2 Given layers L 0, L 1,..., L j, then L j+1 is the set of nodes that are not in a previous layer and that have an edge to some node in layer L j.

17 BFS Tree Example A BFS traversal of a graph results in a breadth-first search tree: s

18 BFS Tree Example A BFS traversal of a graph results in a breadth-first search tree: s Can we say anything about the non-tree edges?

19 Property of Non-BFS-Tree Edges Theorem Choose x L i and y L j such that {x, y} is an edge in undirected graph G. Then i and j differ by at most 1. In other words, edges of G that do not appear in the tree connect nodes either in the same layer or adjacent layer. Proof. Suppose not, and that i < j 1. All the neighbors of x will be found by layer i + 1. Therefore, the layer of y is less than i + 1, so j i + 1, which contradicts i < j 1.

20 Depth-First Search s DFS keeps walking down a path until it is forced to backtrack. It backtracks until it finds a new path to go down. Think: Solving a maze. It results in a search tree, called the depth-first search tree. In general, the DFS tree will be very different than the BFS tree

21 Depth-First Search s

22 Depth-First Search s Can we say anything about the non-tree edges?

23 A property of Non-DFS-Tree Edges Theorem Let x and y be nodes in the DFS tree T G such that {x, y} is an edge in undirected graph G. Then one of x or y is an ancestor of the other in T G. Proof. Suppose, wlog, x is reached first in the DFS. All the nodes that are marked explored between first encountering x and leaving x for the last time are descendants of x in T G. When we reach x, node y must not yet have been explored. It must become explored before leaving x for the last time (otherwise, we should add {x, y} to T G ). Hence, y is a descendent of x in T G.

24 Implementing BFS & DFS BFS: When you see a new, unexplored node, put it on a queue. Will process nodes in the order you first see them. DFS: When you see a new, unexplored node, put it on a stack. Will immediately process a new node. When you have to backtrack, unexplored node closest to the top of the stack will be a child of the last node you visited where you had a choice.

25 General Tree Growing We can think of BFS and DFS (and several other algorithms) as special cases of tree growing: Let T be the current tree T, and Maintain a list of frontier edges: the set of edges of G that have one endpoint in T and one endpoint not in T : v Repeatedly choose a frontier edge (somehow) and add it to T.

26 Tree Growing TreeGrowing(graph G, vertex v, func nextedge): T = (v, ) S = set of edges incident to v While S is not empty: e = nextedge(g, S) T = T + e // add edge e to T S = updatefrontier(g, S, e) return T The function nextedge(g, S) returns a frontier edge from S. updatefrontier(g, S, e) returns the new frontier after we add edge e to T.

27 Tree Growing These algorithms are all special cases of Tree Growing, with different versions of nextedge: 1 Depth-first search 2 Breadth-first search 3 Prim s minimum spanning tree algorithm 4 Dijkstra s shortest path

28 BFS & DFS as Tree Growing What s nextedge for DFS? What s nextedge for BFS?

29 BFS & DFS as Tree Growing What s nextedge for DFS? Select a frontier edge whose tree endpoint was discovered most recently. Why? We can use a stack to implement DFS. What s nextedge for BFS?

30 BFS & DFS as Tree Growing What s nextedge for DFS? Select a frontier edge whose tree endpoint was discovered most recently. Why? We can use a stack to implement DFS. What s nextedge for BFS? Select a frontier edge whose tree endpoint was discovered earliest. Why? We can use a queue to implement BFS.

31 An Application of BFS

32 Testing Bipartiteness Problem Determine if a graph G is bipartite. Bipartite graphs can t contain odd cycles:

33 Bipartite Testing How can we test if G is bipartite?

34 Bipartite Testing How can we test if G is bipartite? Do a BFS starting from some node s. Color even levels blue and odd levels red. Check each edge to see if any edge has both endpoints the same color.

35 Proof of Correctness for Bipartite Testing One of two cases happen: 1 There is no edge of G between two nodes of the same layer. In this case, every edge just connects two nodes in adjacent layers. But adjacent layers are oppositely colored, so G must be bipartite. 2 There is an edge of G joining two nodes x and y of the same layer L j. Let z L i be the least common ancestor of x and y in the BFS tree T. z x y z is a cycle of length 2(j i) + 1, which is odd, so G is not bipartite.

36 An Application of DFS

37 DAGs A directed, acyclic graph (DAG) is a graph that contains no directed cycles. (After leaving any node u you can never get back to u by following edges along the arrows.) DAGs are very useful in modeling project dependencies: Task i has to be done before task j and k which have to be done before m. g j e h i m k f

38 Topological Sort Given a DAG D representing dependencies, how do you order the jobs so that when a job is started, all its dependencies are done? Topological Sort Given a DAG D = (V, E), find a mapping f from V to {1,..., V }), so that for every edge (u, v) E, f (u) < f (v).

39 Topological Sort, II Theorem Every DAG contains a vertex with no incoming edges.

40 Topological Sort, II Theorem Every DAG contains a vertex with no incoming edges. Proof. Suppose not. Then keep following edges backward and in fewer than n + 1 steps you ll reach a node you ve already visited. This is a directed cycle, contradicting that the graph is a DAG.

41 Topological Sort, II Theorem Every DAG contains a vertex with no incoming edges. Proof. Suppose not. Then keep following edges backward and in fewer than n + 1 steps you ll reach a node you ve already visited. This is a directed cycle, contradicting that the graph is a DAG. How can we turn this into an algorithm?

42 Topological Sort Algorithm Topological sort: 1 Let i = 1 2 Find a node u with no incoming edges, and let f (u) = i 3 Delete u from the graph 4 Increment i Implementation: Maintain Income[w] = number of incoming edges for node w a list S of nodes that currently have no incoming edges. When we delete a node u, we decrement Income[w] for all neighbors w of u. If Income[w] becomes 0, we add w to S.

43 Discovery and Finishing Times DFS can be used to associate 2 numbers with each node of a graph G: discovery time: d[u] = the time at which u is first visited finishing time: f [u] = the time at which all u and all its neighbors have been visited. Clearly d[u] f [u]. d[v] f[v] v v d[u] u f[u] u

44 Non-DFS-Trees Edges of a DAG Let (u, v) be an edge of a DAG D. What can we say about the relationship between f [u] and f [v]?

45 Non-DFS-Trees Edges of a DAG Let (u, v) be an edge of a DAG D. What can we say about the relationship between f [u] and f [v]? Back edge tree edge forward edge Right-Left Edge Left-Right Edge Back edges and Left-Right edges cannot occur = f [v] < f [u] if (u, v) D.

46 Topological Sort Via Finishing Times Topological Sort Via Finishing Times: Every edge (u, v) in a DAG has f [v] < f [u]. If we list nodes from largest f [u] to smallest f [u] then every edge goes from left to right. Exactly a topological sort. So: as each node is finished, add it to the front of a linked list.

### 1 Digraphs. Definition 1

1 Digraphs Definition 1 Adigraphordirected graphgisatriplecomprisedofavertex set V(G), edge set E(G), and a function assigning each edge an ordered pair of vertices (tail, head); these vertices together

### Social Media Mining. Graph Essentials

Graph Essentials Graph Basics Measures Graph and Essentials Metrics 2 2 Nodes and Edges A network is a graph nodes, actors, or vertices (plural of vertex) Connections, edges or ties Edge Node Measures

### Chapter 4. Trees. 4.1 Basics

Chapter 4 Trees 4.1 Basics A tree is a connected graph with no cycles. A forest is a collection of trees. A vertex of degree one, particularly in a tree, is called a leaf. Trees arise in a variety of applications.

### COT5405 Analysis of Algorithms Homework 3 Solutions

COT0 Analysis of Algorithms Homework 3 Solutions. Prove or give a counter example: (a) In the textbook, we have two routines for graph traversal - DFS(G) and BFS(G,s) - where G is a graph and s is any

### GRAPH THEORY LECTURE 4: TREES

GRAPH THEORY LECTURE 4: TREES Abstract. 3.1 presents some standard characterizations and properties of trees. 3.2 presents several different types of trees. 3.7 develops a counting method based on a bijection

### Graph Theory. Introduction. Distance in Graphs. Trees. Isabela Drămnesc UVT. Computer Science Department, West University of Timişoara, Romania

Graph Theory Introduction. Distance in Graphs. Trees Isabela Drămnesc UVT Computer Science Department, West University of Timişoara, Romania November 2016 Isabela Drămnesc UVT Graph Theory and Combinatorics

### 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

### Solutions to Exercises 8

Discrete Mathematics Lent 2009 MA210 Solutions to Exercises 8 (1) Suppose that G is a graph in which every vertex has degree at least k, where k 1, and in which every cycle contains at least 4 vertices.

### 3.6 DAGs and Topological Ordering. v 1 v 2 v 3 v 4 v 5 v 6 v 7

3.6 DAGs and Topological Ordering v 1 v 2 v 3 v 4 v 5 v 6 v 7 Directed Acyclic Graphs Def. A DAG is a directed graph that contains no directed cycles. Ex. Precedence constraints: edge (v i, v j ) means

### 2.3 Scheduling jobs on identical parallel machines

2.3 Scheduling jobs on identical parallel machines There are jobs to be processed, and there are identical machines (running in parallel) to which each job may be assigned Each job = 1,,, must be processed

### Homework 15 Solutions

PROBLEM ONE (Trees) Homework 15 Solutions 1. Recall the definition of a tree: a tree is a connected, undirected graph which has no cycles. Which of the following definitions are equivalent to this definition

### GRAPH THEORY and APPLICATIONS. Trees

GRAPH THEORY and APPLICATIONS Trees Properties Tree: a connected graph with no cycle (acyclic) Forest: a graph with no cycle Paths are trees. Star: A tree consisting of one vertex adjacent to all the others.

### Chapter 2 Paths and Searching

Chapter 2 Paths and Searching Section 2.1 Distance Almost every day you face a problem: You must leave your home and go to school. If you are like me, you are usually a little late, so you want to take

### Long questions answer Advanced Mathematics for Computer Application If P= , find BT. 19. If B = 1 0, find 2B and -3B.

Unit-1: Matrix Algebra Short questions answer 1. What is Matrix? 2. Define the following terms : a) Elements matrix b) Row matrix c) Column matrix d) Diagonal matrix e) Scalar matrix f) Unit matrix OR

### Graphs and Network Flows IE411 Lecture 1

Graphs and Network Flows IE411 Lecture 1 Dr. Ted Ralphs IE411 Lecture 1 1 References for Today s Lecture Required reading Sections 17.1, 19.1 References AMO Chapter 1 and Section 2.1 and 2.2 IE411 Lecture

### 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

### Graph. Consider a graph, G in Fig Then the vertex V and edge E can be represented as:

Graph A graph G consist of 1. Set of vertices V (called nodes), (V = {v1, v2, v3, v4...}) and 2. Set of edges E (i.e., E {e1, e2, e3...cm} A graph can be represents as G = (V, E), where V is a finite and

### CSE 373 Analysis of Algorithms Date: Nov. 1, Solution to HW3. Total Points: 100

CSE 373 Analysis of Algorithms Date: Nov. 1, 2016 Steven Skiena Problem 1 5-4 [5] Solution to HW3 Total Points: 100 Let T be the BFS-tree of the graph G. For any e in G and e T, we have to show that e

### Graph Theory Problems and Solutions

raph Theory Problems and Solutions Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles November, 005 Problems. Prove that the sum of the degrees of the vertices of any finite graph is

### Graph Theory Notes. Vadim Lozin. Institute of Mathematics University of Warwick

Graph Theory Notes Vadim Lozin Institute of Mathematics University of Warwick 1 Introduction A graph G = (V, E) consists of two sets V and E. The elements of V are called the vertices and the elements

### IE 680 Special Topics in Production Systems: Networks, Routing and Logistics*

IE 680 Special Topics in Production Systems: Networks, Routing and Logistics* Rakesh Nagi Department of Industrial Engineering University at Buffalo (SUNY) *Lecture notes from Network Flows by Ahuja, Magnanti

### Analysis of Algorithms, I

Analysis of Algorithms, I CSOR W4231.002 Eleni Drinea Computer Science Department Columbia University Thursday, February 26, 2015 Outline 1 Recap 2 Representing graphs 3 Breadth-first search (BFS) 4 Applications

### Discrete Mathematics & Mathematical Reasoning Chapter 10: Graphs

Discrete Mathematics & Mathematical Reasoning Chapter 10: Graphs Kousha Etessami U. of Edinburgh, UK Kousha Etessami (U. of Edinburgh, UK) Discrete Mathematics (Chapter 6) 1 / 13 Overview Graphs and Graph

### PART II Algorithms for Message- Passing Systems. Section 7 Introduction Model Basic Graph Algorithms

PART II Algorithms for Message- Passing Systems Section 7 Introduction Model Basic Graph Algorithms 1 Formal Model for Message-Passing Systems There are n processes in the system: p 0,.., p n-1 Each process

### Minimum Spanning Trees

Minimum Spanning Trees Algorithms and 18.304 Presentation Outline 1 Graph Terminology Minimum Spanning Trees 2 3 Outline Graph Terminology Minimum Spanning Trees 1 Graph Terminology Minimum Spanning Trees

### The origins of graph theory are humble, even frivolous. Biggs, E. K. Lloyd, and R. J. Wilson)

Chapter 11 Graph Theory The origins of graph theory are humble, even frivolous. Biggs, E. K. Lloyd, and R. J. Wilson) (N. Let us start with a formal definition of what is a graph. Definition 72. A graph

### Sample Problems in Discrete Mathematics

Sample Problems in Discrete Mathematics This handout lists some sample problems that you should be able to solve as a pre-requisite to Computer Algorithms Try to solve all of them You should also read

### (a) (b) (c) Figure 1 : Graphs, multigraphs and digraphs. If the vertices of the leftmost figure are labelled {1, 2, 3, 4} in clockwise order from

4 Graph Theory Throughout these notes, a graph G is a pair (V, E) where V is a set and E is a set of unordered pairs of elements of V. The elements of V are called vertices and the elements of E are called

### Homework MA 725 Spring, 2012 C. Huneke SELECTED ANSWERS

Homework MA 725 Spring, 2012 C. Huneke SELECTED ANSWERS 1.1.25 Prove that the Petersen graph has no cycle of length 7. Solution: There are 10 vertices in the Petersen graph G. Assume there is a cycle C

### CSE 20: Discrete Mathematics for Computer Science. Prof. Miles Jones. Today s Topics: Graphs. The Internet graph

Today s Topics: CSE 0: Discrete Mathematics for Computer Science Prof. Miles Jones. Graphs. Some theorems on graphs. Eulerian graphs Graphs! Model relations between pairs of objects The Internet graph!

### 2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]

Code No: R05220502 Set No. 1 1. (a) Describe the performance analysis in detail. (b) Show that f 1 (n)+f 2 (n) = 0(max(g 1 (n), g 2 (n)) where f 1 (n) = 0(g 1 (n)) and f 2 (n) = 0(g 2 (n)). [8+8] 2. (a)

### Chapter 4: Trees. 2. Theorem: Let T be a graph with n vertices. Then the following statements are equivalent:

9 Properties of Trees. Definitions: Chapter 4: Trees forest - a graph that contains no cycles tree - a connected forest. Theorem: Let T be a graph with n vertices. Then the following statements are equivalent:

### Exam study sheet for CS2711. List of topics

Exam study sheet for CS2711 Here is the list of topics you need to know for the final exam. For each data structure listed below, make sure you can do the following: 1. Give an example of this data structure

### Trees. Definition: A tree is a connected undirected graph with no simple circuits. Example: Which of these graphs are trees?

Section 11.1 Trees Definition: A tree is a connected undirected graph with no simple circuits. Example: Which of these graphs are trees? Solution: G 1 and G 2 are trees both are connected and have no simple

### Data Structures in Java. Session 16 Instructor: Bert Huang

Data Structures in Java Session 16 Instructor: Bert Huang http://www.cs.columbia.edu/~bert/courses/3134 Announcements Homework 4 due next class Remaining grades: hw4, hw5, hw6 25% Final exam 30% Midterm

### Graph Theory. Directed and undirected graphs make useful mental models for many situations. These objects are loosely defined as follows:

Graph Theory Directed and undirected graphs make useful mental models for many situations. These objects are loosely defined as follows: Definition An undirected graph is a (finite) set of nodes, some

### Chapter 6 Planarity. Section 6.1 Euler s Formula

Chapter 6 Planarity Section 6.1 Euler s Formula In Chapter 1 we introduced the puzzle of the three houses and the three utilities. The problem was to determine if we could connect each of the three utilities

### Chapter There are non-isomorphic rooted trees with four vertices. Ans: 4.

Use the following to answer questions 1-26: In the questions below fill in the blanks. Chapter 10 1. If T is a tree with 999 vertices, then T has edges. 998. 2. There are non-isomorphic trees with four

### 3. Markov property. Markov property for MRFs. Hammersley-Clifford theorem. Markov property for Bayesian networks. I-map, P-map, and chordal graphs

Markov property 3-3. Markov property Markov property for MRFs Hammersley-Clifford theorem Markov property for ayesian networks I-map, P-map, and chordal graphs Markov Chain X Y Z X = Z Y µ(x, Y, Z) = f(x,

### Balanced Binary Search Tree

AVL Trees / Slide 1 Balanced Binary Search Tree Worst case height of binary search tree: N-1 Insertion, deletion can be O(N) in the worst case We want a tree with small height Height of a binary tree with

### Trees and Fundamental Circuits

Trees and Fundamental Circuits Tree A connected graph without any circuits. o must have at least one vertex. o definition implies that it must be a simple graph. o only finite trees are being considered

### Combinatorics: The Fine Art of Counting

Combinatorics: The Fine Art of Counting Week 9 Lecture Notes Graph Theory For completeness I have included the definitions from last week s lecture which we will be using in today s lecture along with

### Approximation Algorithms

Approximation Algorithms or: How I Learned to Stop Worrying and Deal with NP-Completeness Ong Jit Sheng, Jonathan (A0073924B) March, 2012 Overview Key Results (I) General techniques: Greedy algorithms

### Planar Graph and Trees

Dr. Nahid Sultana December 16, 2012 Tree Spanning Trees Minimum Spanning Trees Maps and Regions Eulers Formula Nonplanar graph Dual Maps and the Four Color Theorem Tree Spanning Trees Minimum Spanning

### Every tree is 3-equitable

Discrete Mathematics 220 (2000) 283 289 www.elsevier.com/locate/disc Note Every tree is 3-equitable David E. Speyer a, Zsuzsanna Szaniszlo b; a Harvard University, USA b Department of Mathematical Sciences,

### ITEC2620 Introduction to Data Structures

ITEC2620 Introduction to Data Structures Lecture 8b Search Trees Traversals Typical covered as graph traversals in data structures courses I ve never seen a graph traversal in practice! AI background Tree

### Graph definition Degree, in, out degree, oriented graph. Complete, regular, bipartite graph. Graph representation, connectivity, adjacency.

Mária Markošová Graph definition Degree, in, out degree, oriented graph. Complete, regular, bipartite graph. Graph representation, connectivity, adjacency. Isomorphism of graphs. Paths, cycles, trials.

### Forests and Trees: A forest is a graph with no cycles, a tree is a connected forest.

2 Trees What is a tree? Forests and Trees: A forest is a graph with no cycles, a tree is a connected forest. Theorem 2.1 If G is a forest, then comp(g) = V (G) E(G). Proof: We proceed by induction on E(G).

### Definition. A graph is a collection of vertices, and edges between them. They are often represented by a drawing:

1. GRAPHS AND COLORINGS Definition. A graph is a collection of vertices, and edges between them. They are often represented by a drawing: 3 vertices 3 edges 4 vertices 4 edges 4 vertices 6 edges A graph

### Planarity Planarity

Planarity 8.1 71 Planarity Up until now, graphs have been completely abstract. In Topological Graph Theory, it matters how the graphs are drawn. Do the edges cross? Are there knots in the graph structure?

### COLORED GRAPHS AND THEIR PROPERTIES

COLORED GRAPHS AND THEIR PROPERTIES BEN STEVENS 1. Introduction This paper is concerned with the upper bound on the chromatic number for graphs of maximum vertex degree under three different sets of coloring

### Basic Notions on Graphs. Planar Graphs and Vertex Colourings. Joe Ryan. Presented by

Basic Notions on Graphs Planar Graphs and Vertex Colourings Presented by Joe Ryan School of Electrical Engineering and Computer Science University of Newcastle, Australia Planar graphs Graphs may be drawn

### Outline 2.1 Graph Isomorphism 2.2 Automorphisms and Symmetry 2.3 Subgraphs, part 1

GRAPH THEORY LECTURE STRUCTURE AND REPRESENTATION PART A Abstract. Chapter focuses on the question of when two graphs are to be regarded as the same, on symmetries, and on subgraphs.. discusses the concept

### 12 Abstract Data Types

12 Abstract Data Types 12.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Define the concept of an abstract data type (ADT).

### Scheduling. Open shop, job shop, flow shop scheduling. Related problems. Open shop, job shop, flow shop scheduling

Scheduling Basic scheduling problems: open shop, job shop, flow job The disjunctive graph representation Algorithms for solving the job shop problem Computational complexity of the job shop problem Open

### A. V. Gerbessiotis CS Spring 2014 PS 3 Mar 24, 2014 No points

A. V. Gerbessiotis CS 610-102 Spring 2014 PS 3 Mar 24, 2014 No points Problem 1. Suppose that we insert n keys into a hash table of size m using open addressing and uniform hashing. Let p(n, m) be the

### Data Structures and Algorithms Written Examination

Data Structures and Algorithms Written Examination 22 February 2013 FIRST NAME STUDENT NUMBER LAST NAME SIGNATURE Instructions for students: Write First Name, Last Name, Student Number and Signature where

### 1 Basic Definitions and Concepts in Graph Theory

CME 305: Discrete Mathematics and Algorithms 1 Basic Definitions and Concepts in Graph Theory A graph G(V, E) is a set V of vertices and a set E of edges. In an undirected graph, an edge is an unordered

### Lecture Notes on Spanning Trees

Lecture Notes on Spanning Trees 15-122: Principles of Imperative Computation Frank Pfenning Lecture 26 April 26, 2011 1 Introduction In this lecture we introduce graphs. Graphs provide a uniform model

### A tree can be defined in a variety of ways as is shown in the following theorem: 2. There exists a unique path between every two vertices of G.

7 Basic Properties 24 TREES 7 Basic Properties Definition 7.1: A connected graph G is called a tree if the removal of any of its edges makes G disconnected. A tree can be defined in a variety of ways as

V. Adamchik 1 Graph Theory Victor Adamchik Fall of 2005 Plan 1. Basic Vocabulary 2. Regular graph 3. Connectivity 4. Representing Graphs Introduction A.Aho and J.Ulman acknowledge that Fundamentally, computer

### 1 Definitions. Supplementary Material for: Digraphs. Concept graphs

Supplementary Material for: van Rooij, I., Evans, P., Müller, M., Gedge, J. & Wareham, T. (2008). Identifying Sources of Intractability in Cognitive Models: An Illustration using Analogical Structure Mapping.

### DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

Professor Kindred Math 04 Graph Theory Homework 7 Solutions April 3, 03 Introduction to Graph Theory, West Section 5. 0, variation of 5, 39 Section 5. 9 Section 5.3 3, 8, 3 Section 7. Problems you should

### CMPSCI611: Approximating MAX-CUT Lecture 20

CMPSCI611: Approximating MAX-CUT Lecture 20 For the next two lectures we ll be seeing examples of approximation algorithms for interesting NP-hard problems. Today we consider MAX-CUT, which we proved to

### Fall 2015 Midterm 1 24/09/15 Time Limit: 80 Minutes

Math 340 Fall 2015 Midterm 1 24/09/15 Time Limit: 80 Minutes Name (Print): This exam contains 6 pages (including this cover page) and 5 problems. Enter all requested information on the top of this page,

### Full and Complete Binary Trees

Full and Complete Binary Trees Binary Tree Theorems 1 Here are two important types of binary trees. Note that the definitions, while similar, are logically independent. Definition: a binary tree T is full

### Lecture 4: The Chromatic Number

Introduction to Graph Theory Instructor: Padraic Bartlett Lecture 4: The Chromatic Number Week 1 Mathcamp 2011 In our discussion of bipartite graphs, we mentioned that one way to classify bipartite graphs

### Math 443/543 Graph Theory Notes 4: Connector Problems

Math 443/543 Graph Theory Notes 4: Connector Problems David Glickenstein September 19, 2012 1 Trees and the Minimal Connector Problem Here is the problem: Suppose we have a collection of cities which we

### Home Page. Data Structures. Title Page. Page 1 of 24. Go Back. Full Screen. Close. Quit

Data Structures Page 1 of 24 A.1. Arrays (Vectors) n-element vector start address + ielementsize 0 +1 +2 +3 +4... +n-1 start address continuous memory block static, if size is known at compile time dynamic,

### The relationship of a trees to a graph is very important in solving many problems in Maths and Computer Science

Trees Mathematically speaking trees are a special class of a graph. The relationship of a trees to a graph is very important in solving many problems in Maths and Computer Science However, in computer

### Multi-Way Search Trees (B Trees)

Multi-Way Search Trees (B Trees) Multiway Search Trees An m-way search tree is a tree in which, for some integer m called the order of the tree, each node has at most m children. If n

### Two General Methods to Reduce Delay and Change of Enumeration Algorithms

ISSN 1346-5597 NII Technical Report Two General Methods to Reduce Delay and Change of Enumeration Algorithms Takeaki Uno NII-2003-004E Apr.2003 Two General Methods to Reduce Delay and Change of Enumeration

### COURSE: B.TECH-ECE. IV Sem. Data structure Using C. b) Deletion of element in an array

COURSE: B.TECH-ECE. IV Sem Data structure Using C 1. Determine the formula to find the address location of an element in three dimensions array, suppose each element takes four bytes of space & elements

### Lesson 3. Algebraic graph theory. Sergio Barbarossa. Rome - February 2010

Lesson 3 Algebraic graph theory Sergio Barbarossa Basic notions Definition: A directed graph (or digraph) composed by a set of vertices and a set of edges We adopt the convention that the information flows

### Graph Algorithms. Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar

Graph Algorithms Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar To accompany the text Introduction to Parallel Computing, Addison Wesley, 3. Topic Overview Definitions and Representation Minimum

### CSL851: Algorithmic Graph Theory Semester I Lecture 1: July 24

CSL851: Algorithmic Graph Theory Semester I 2013-2014 Lecture 1: July 24 Lecturer: Naveen Garg Scribes: Suyash Roongta Note: LaTeX template courtesy of UC Berkeley EECS dept. Disclaimer: These notes have

### International Journal of Software and Web Sciences (IJSWS) www.iasir.net

International Association of Scientific Innovation and Research (IASIR) (An Association Unifying the Sciences, Engineering, and Applied Research) ISSN (Print): 2279-0063 ISSN (Online): 2279-0071 International

### Binary Search Trees. Data in each node. Larger than the data in its left child Smaller than the data in its right child

Binary Search Trees Data in each node Larger than the data in its left child Smaller than the data in its right child FIGURE 11-6 Arbitrary binary tree FIGURE 11-7 Binary search tree Data Structures Using

### On Graph Powers for Leaf-Labeled Trees

Journal of Algorithms 42, 69 108 (2002) doi:10.1006/jagm.2001.1195, available online at http://www.idealibrary.com on On Graph Powers for Leaf-Labeled Trees Naomi Nishimura 1 and Prabhakar Ragde 2 Department

### 10. Graph Matrices Incidence Matrix

10 Graph Matrices Since a graph is completely determined by specifying either its adjacency structure or its incidence structure, these specifications provide far more efficient ways of representing a

### Jade Yu Cheng ICS 311 Homework 10 Oct 7, 2008

Jade Yu Cheng ICS 311 Homework 10 Oct 7, 2008 Question for lecture 13 Problem 23-3 on p. 577 Bottleneck spanning tree A bottleneck spanning tree of an undirected graph is a spanning tree of whose largest

### State Spaces Graph Search Searching. Graph Search. CPSC 322 Search 2. Textbook 3.4. Graph Search CPSC 322 Search 2, Slide 1

Graph Search CPSC 322 Search 2 Textbook 3.4 Graph Search CPSC 322 Search 2, Slide 1 Lecture Overview 1 State Spaces 2 Graph Search 3 Searching Graph Search CPSC 322 Search 2, Slide 2 State Spaces Idea:

### Handout #Ch7 San Skulrattanakulchai Gustavus Adolphus College Dec 6, 2010. Chapter 7: Digraphs

MCS-236: Graph Theory Handout #Ch7 San Skulrattanakulchai Gustavus Adolphus College Dec 6, 2010 Chapter 7: Digraphs Strong Digraphs Definitions. A digraph is an ordered pair (V, E), where V is the set

### CS268: Geometric Algorithms Handout #5 Design and Analysis Original Handout #15 Stanford University Tuesday, 25 February 1992

CS268: Geometric Algorithms Handout #5 Design and Analysis Original Handout #15 Stanford University Tuesday, 25 February 1992 Original Lecture #6: 28 January 1991 Topics: Triangulating Simple Polygons

### Algorithm Design and Analysis Homework #6 Due: 1pm, Monday, January 9, === Homework submission instructions ===

Algorithm Design and Analysis Homework #6 Due: 1pm, Monday, January 9, 2012 === Homework submission instructions === Submit the answers for writing problems (including your programming report) through

### Trees and structural induction

Trees and structural induction Margaret M. Fleck 25 October 2010 These notes cover trees, tree induction, and structural induction. (Sections 10.1, 4.3 of Rosen.) 1 Why trees? Computer scientists are obsessed

### Definition. E.g. : Attempting to represent a transport link data with a tree structure:

The ADT Graph Recall the ADT binary tree: a tree structure used mainly to represent 1 to 2 relations, i.e. each item has at most two immediate successors. Limitations of tree structures: an item in a tree

### The edge slide graph of the n-dimensional cube

The edge slide graph of the n-dimensional cube Howida AL Fran Institute of Fundamental Sciences Massey University, Manawatu 8th Australia New Zealand Mathematics Convention December 2014 Howida AL Fran

### Computational Geometry

Motivation 1 Motivation Polygons and visibility Visibility in polygons Triangulation Proof of the Art gallery theorem Two points in a simple polygon can see each other if their connecting line segment

### In our lecture about Binary Search Trees (BST) we have seen that the operations of searching for and inserting an element in a BST can be of the

In our lecture about Binary Search Trees (BST) we have seen that the operations of searching for and inserting an element in a BST can be of the order O(log n) (in the best case) and of the order O(n)

### 1. Sorting (assuming sorting into ascending order) a) BUBBLE SORT

DECISION 1 Revision Notes 1. Sorting (assuming sorting into ascending order) a) BUBBLE SORT Make sure you show comparisons clearly and label each pass First Pass 8 4 3 6 1 4 8 3 6 1 4 3 8 6 1 4 3 6 8 1

### Trees & Binary Search Trees

CMSC 132: Object-Oriented Programming II Trees & Binary Search Trees Department of Computer Science University of Maryland, College Park Trees Trees are hierarchical data structures One-to-many relationship

### 1 Representing Graphs With Arrays

Lecture 0 Shortest Weighted Paths I Parallel and Sequential Data Structures and Algorithms, 5-20 (Spring 202) Lectured by Margaret Reid-Miller 6 February 202 Today: - Representing Graphs with Arrays -

### CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) 3 4 4 7 5 9 6 16 7 8 8 4 9 8 10 4 Total 92.

Name: Email ID: CSE 326, Data Structures Section: Sample Final Exam Instructions: The exam is closed book, closed notes. Unless otherwise stated, N denotes the number of elements in the data structure

### Graph Algorithms using Map-Reduce

Graph Algorithms using Map-Reduce Graphs are ubiquitous in modern society. Some examples: The hyperlink structure of the web 1/7 Graph Algorithms using Map-Reduce Graphs are ubiquitous in modern society.

### Any two nodes which are connected by an edge in a graph are called adjacent node.

. iscuss following. Graph graph G consist of a non empty set V called the set of nodes (points, vertices) of the graph, a set which is the set of edges and a mapping from the set of edges to a set of pairs

### Part 2: Community Detection

Chapter 8: Graph Data Part 2: Community Detection Based on Leskovec, Rajaraman, Ullman 2014: Mining of Massive Datasets Big Data Management and Analytics Outline Community Detection - Social networks -

### Quiz 2 Solutions. Solution: False. Need stable sort.

Introduction to Algorithms April 13, 2011 Massachusetts Institute of Technology 6.006 Spring 2011 Professors Erik Demaine, Piotr Indyk, and Manolis Kellis Quiz 2 Solutions Problem 1. True or false [24