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

Similar documents
GRAPHS, GRAPH MODELS, GRAPH TERMINOLOGY, AND SPECIAL TYPES OF GRAPHS

Basics of Graph Theory

CS 311 Discrete Math for Computer Science Dr. William C. Bulko. Graphs

CS 441 Discrete Mathematics for CS Lecture 26. Graphs. CS 441 Discrete mathematics for CS. Final exam

Adjacent: Two distinct vertices u, v are adjacent if there is an edge with ends u, v. In this case we let uv denote such an edge.

Graphs. Pseudograph: multiple edges and loops allowed

Varying Applications (examples)

Elements of Graph Theory

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

Introduction III. Graphs. Motivations I. Introduction IV

Chapter 11: Graphs and Trees. March 23, 2008

Graphs. Introduction To Graphs: Exercises. Definitions:

γ(ɛ) (a, b) (a, d) (d, a) (a, b) (c, d) (d, d) (e, e) (e, a) (e, e) (a) Draw a picture of G.

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points

Mathematics and Statistics, Part A: Graph Theory Problem Sheet 1, lectures 1-4

Graph Theory. Part of Texas Counties.

Discrete mathematics II. - Graphs

CHAPTER 2. Graphs. 1. Introduction to Graphs and Graph Isomorphism

1. a graph G = (V (G), E(G)) consists of a set V (G) of vertices, and a set E(G) of edges (edges are pairs of elements of V (G))

2. CONNECTIVITY Connectivity

UNDIRECTED GRAPH: a set of vertices and a set of undirected edges each of which is associated with a set of one or two of these vertices.

Crossing bridges. Crossing bridges Great Ideas in Theoretical Computer Science. Lecture 12: Graphs I: The Basics. Königsberg (Prussia)

Math 170- Graph Theory Notes

INTRODUCTION TO GRAPH THEORY. 1. Definitions

Graph Theory CS/Math231 Discrete Mathematics Spring2015

Discrete Mathematics (2009 Spring) Graphs (Chapter 9, 5 hours)

Planarity: dual graphs

Math.3336: Discrete Mathematics. Chapter 10 Graph Theory

Section 8.2 Graph Terminology. Undirected Graphs. Definition: Two vertices u, v in V are adjacent or neighbors if there is an edge e between u and v.

Math 776 Graph Theory Lecture Note 1 Basic concepts

Math 778S Spectral Graph Theory Handout #2: Basic graph theory

Chapter 3: Paths and Cycles

Number Theory and Graph Theory

ECS 20 Lecture 17b = Discussion D8 Fall Nov 2013 Phil Rogaway

Fundamental Properties of Graphs

Foundations of Discrete Mathematics

CS473-Algorithms I. Lecture 13-A. Graphs. Cevdet Aykanat - Bilkent University Computer Engineering Department

Math 443/543 Graph Theory Notes 5: Planar graphs and coloring

CPS 102: Discrete Mathematics. Quiz 3 Date: Wednesday November 30, Instructor: Bruce Maggs NAME: Prob # Score. Total 60

Planar Graph (7A) Young Won Lim 6/20/18

Basic Combinatorics. Math 40210, Section 01 Fall Homework 4 Solutions

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

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

Assignment 4 Solutions of graph problems

Graph and Digraph Glossary

WUCT121. Discrete Mathematics. Graphs

Discrete Wiskunde II. Lecture 6: Planar Graphs

Discrete mathematics

An Introduction to Graph Theory

Exercise set 2 Solutions

Treewidth and graph minors

Number Theory and Graph Theory

Planar graphs. Chapter 8

MATH 363 Final Wednesday, April 28. Final exam. You may use lemmas and theorems that were proven in class and on assignments unless stated otherwise.

Graph Theory. 1 Graphs and Subgraphs

Introduction to Graph Theory

GRAPH THEORY: AN INTRODUCTION

Planar Graph (7A) Young Won Lim 5/21/18

Ordinary Differential Equation (ODE)

Discrete mathematics

Graph Theory. 1 Introduction to Graphs. Martin Stynes Department of Mathematics, UCC January 26, 2011

Chapter 1 Graph Theory

Chapter 2 Graphs. 2.1 Definition of Graphs

1 Digraphs. Definition 1

5 Graphs

DS UNIT 4. Matoshri College of Engineering and Research Center Nasik Department of Computer Engineering Discrete Structutre UNIT - IV

Graphs: introduction, terminology, special graphs, representation and connectivity. Sections 8.1, 8.2, 8.3, 8.4

Algorithms. Graphs. Algorithms

Algorithms: Graphs. Amotz Bar-Noy. Spring 2012 CUNY. Amotz Bar-Noy (CUNY) Graphs Spring / 95

Graphs That Are Randomly Traceable from a Vertex

Part II. Graph Theory. Year

MAS 341: GRAPH THEORY 2016 EXAM SOLUTIONS

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

Artificial Intelligence

DEFINITION OF GRAPH GRAPH THEORY GRAPHS ACCORDING TO THEIR VERTICES AND EDGES EXAMPLE GRAPHS ACCORDING TO THEIR VERTICES AND EDGES

Bipartite Roots of Graphs

Lecture 3: Recap. Administrivia. Graph theory: Historical Motivation. COMP9020 Lecture 4 Session 2, 2017 Graphs and Trees

Assignments are handed in on Tuesdays in even weeks. Deadlines are:

Lecture 5: Graphs. Rajat Mittal. IIT Kanpur

CPCS Discrete Structures 1

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

Symmetric Product Graphs

Math 777 Graph Theory, Spring, 2006 Lecture Note 1 Planar graphs Week 1 Weak 2

v 1 v 2 r 3 r 4 v 3 v 4 Figure A plane embedding of K 4.

March 20/2003 Jayakanth Srinivasan,

Lecture 20 : Trees DRAFT

CS6702 GRAPH THEORY AND APPLICATIONS 2 MARKS QUESTIONS AND ANSWERS

K 4 C 5. Figure 4.5: Some well known family of graphs

Definition For vertices u, v V (G), the distance from u to v, denoted d(u, v), in G is the length of a shortest u, v-path. 1

8.2 Paths and Cycles

BIL694-Lecture 1: Introduction to Graphs

CMSC 380. Graph Terminology and Representation

Characterizing Graphs (3) Characterizing Graphs (1) Characterizing Graphs (2) Characterizing Graphs (4)

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

Graph Theory Mini-course

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. An Introduction to Graph Theory

(5.2) 151 Math Exercises. Graph Terminology and Special Types of Graphs. Malek Zein AL-Abidin

Graphs: Definitions Trails, Paths, and Circuits Matrix Representations Isomorphisms. 11. Graphs and Trees 1. Aaron Tan. 30 October 3 November 2017

Lecture 6: Graph Properties

Foundations of Discrete Mathematics

Transcription:

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. Eachedgehaseitheroneortwoverticesassociatedwithit,calleditsendpoints. Theedgee = {u,v} is called incident with the vertices u and v. Two vertices u and v in G are called adjacent (or neighbors) if {u,v} is an edge of G. The degree of a vertex v, denoted deg(v), is the number of edges incident with it. A graph in which each edge connects two different vertices and where no two edges connect the same pair of vertices is called simple graph. Graphs that may have multiple edges connecting the same vertices are called multigraphs. 2. Theorem: Let G = (V,E) be a graph with e edges. Then 2e = deg(v). v V Question: How many edges are there in a graph with 10 vertices each of degree 6? 3. A subgraph of a graph G = (V,E) is a graph G = (V,E ) where V V and E E. 4. The union of two simple graphs G 1 = (V 1,E 1 ) and G 2 = (V 2,E 2 ), denoted as G 1 G 2, is the simple graph with vertex set V 1 V 2 and edges E 1 E 2. 5. Graph representations By a picture Using an adjacency list. Using an adjacency matrix: Suppose that a simple graph G = (V,E) with n vertices {v 1,v 2,...,v n }. The adjacency matrix A = (a ij ) is the n n zero-one matrix, and the element a ij is defined as { 1 if {vi,v a ij = j } is an edge of G, 0 otherwise. Usinganincidencematrix: SupposethatasimplegraphG = (V,E)withnvertices{v 1,v 2,...,v n } and m edges e 1,e 2,...,e m. The incidence matrix is the n m B = (b ij ), where { 1 when edge ej is incident with v b ij = i, 0 otherwise. 6. Graph isomorphism Two simple graphs G 1 = (V 1,E 1 ) and G 2 = (V 2,E 2 ) are isomorphic if there is an one-to-one and onto function f from V 1 to V 2 with the property that a and b in G 1 are adjacent if and only if f(a) and f(b) are adjacent in G 2 for all a and b in V 1. Such a function f is called an isomorphism. In other words, when two simple graphs are isomorphic, there is one-to-one correspondence between vertices of the two graphs that preserves the adjacency relationship. 1

Theorem: Simple graphs G 1 and G 2 are isomorphic if and only if for some orderings of their vertices, their adjacency matrices are equal. There is no efficient algorithm known to decide whether two simple graphs are isomorphic. There are n! possible one-to-one correspondences. Most computer scientists believe that no such algorithm exists. To show that two simple graphs are not isomorphic, we can show that they do not share an invariant property that isomorphic simple graphs must both have, such as the same number of vertices, edges, and degrees. Connectivity 7. A path of length n from v 0 to v n in a graph is an alternating sequence of n + 1 vertices and n edges beginning with v 0 and ending with v n : where the edge e i is incident with v i 1 and v i. (v 0,e 1,v 1,e 2,v 2,...,v n 1,e n,v n ), When the graph is simple, we denote this path by its vertex sequence v 0,v 1,v 2,...,v n 1,v n. 8. The path is a circuit (or cycle) if it begins and ends at the same vertex. A path or circuit is simple if it does not contain the same edge more than once. 9. A graph is called connected if there is a path between every pair of distinct vertices of the graph. 10. Counting paths between vertices Theorem: let G be a graph with adjacency matrix A with respect to the ordering v 1,v 2,...,v n. The number of different paths of length k from v i to v j equals to the (i,j) entry of A k. Proof: The theorem will be proved using mathematical induction. Let G be a graph with adjacency matrix A. The number of paths from v i and v j of length 1 is the (i,j)th entry of A, because this entry is the number of edges from v i to v j. Assume that the (i,j)th entry of A k is the number of different paths of length k from v i to v j. (This is the induction hypothesis.) Because A k+1 = A k A, the (i,j)th entry of A k+1 equals b i1 a 1j +b i2 a 2j + +b in a n,j, where b ik is the (i,k)th entry of A k. By the induction hypothesis, b ik is the number of paths of length k from v i to v k. A path of length k+1 from v i to v j is made up of a path of length k from v i to some intermediate vertex v k, plus an edge from v k to v j. By the product rule for counting, the number of such paths is the product of the number of paths of the length k from v i to v k, namely b ik, and the number of edges from v k to v j, namely a kj. When these products are added for all possible intermediate vertices, the desired results follows by the sum rule for counting. 11. Eulerian path: An Eulerian path (circuit) in G is a path (circuit) containing every edge of G exactly once. 2

Theorem:a connected graph has an Euler circuit if and only if each of its vertices has even degree. Proof. : Suppose G has an Eulerian circule T. For any vertex v of G, T enters and leaves v the same number of times without repeating any edge. Hence v has even degree. : We use the proof by construction. Suppose that each vertex of G has even degree. Let us construct an Eulerian circuit. We begin a path T 1 at any edge e. We extend T 1 by adding one edge after the other. If T 1 is not closed at any step, say T 1 begins at u and ends at v u, then only an odd number of the edges incident on v appear in T 1. Hence we can extend T 1 by another edge incident on v. Thus we can continue to extend T 1 until T 1 returns to its initial vertex u, i.e., until T 1 is closed. If T 1 includes all the edges of G, then T 1 is our Euler circuit. If T 1 does not include all the edges of G. Consider the graph H obtained by deleting all edges of T 1 from G. H may not be connected, but each vertex of H has even degree since T 1 contains an even number of the edges incident on any vertex. Since G is connected, there is an edge e of H which has an endpoint u in T 1. We construct a path T 2 in H beginning at u and using e. Since all vertices in H have even degree, we can continue to extend T 2 in H until T 2 returns to u. We can clearly put T 1 and T 2 together to form a larger closed path in G. We can continue this process until all edges of G are used, and obtained an Eulerian circuit, and so G is Eulerian. Theorem: A connected graph has an Euler path but not an Euler cycle if and only if it has exactly two vertices of odd degree. 12. Hamiltonian path A Hamiltonian path (circuit) in G is a path (circuit) that containing every vertex of G exactly once. Example: Around-the-world puzzle (traveling salesperson problem): is there a simple circuit contains every vertex exactly once? Amazing fact: there are no known reasonable algorithms to decide if a graph is Hamiltonian. Most computer scientists believe that no such algorithm exists. Although it is clear that only connected graphs can be Hamiltonian, there is no simple criterion to tell us whether or not a graph is Hamiltonian as there is for Eulerian graphs. We have the following sufficient condition, called Dirac s theorem (1952). Theorem: If G be a simple graph with n vertices and n 3 such that the degree of every vertex in G is at least n/2, then G has a Hamilton circuit. Special types of graphs 13. Complete graph K n : a simple graph that contains exactly one edge between each pair of distinct vertices. Examples: K 1, K 2, K 3, K 4, K 5 14. Cycle C n, n 3: consists of n vertices v 1,v 2,...,v n and edges {v 1,v 2 }, {v 2,v 3 },..., {v n 1,v n }, {v n,v 1 }. Examples: C 3, C 4, and C 5 15. Wheel W n, n 3: add an additional vertex to the cycle C n and connect this new vertex to each of the n vertices in C n by new edges. 3

Examples: W 3, W 4, and W 5 16. n-cube Q n : has vertices representing the 2 n bit strings of length n. Two vertices are adjacent if and only if the bit strings that they represent differ one bit position. Examples: Q 1, Q 2, and Q 3 17. Bipartite graph: a simple graph G is called bipartite if its vertex set V can be partitioned into two disjoint nonempty sets V 1 and V 2 such that every edge connects a vertex in V 1 and a vertex in V 2 (so that no edge in G connects either two vertices in V 1 or two vertices in V 2 ). Complete bipartite graph K m,n : each vertex of V 1 is connected to each vertex of V 2. Examples: K 2,3 and K 3,3. Theorem: A simple graph is bipartite if and only if it is possible to assign one of two different colors to each vertex of the graph so that no two adjacent vertices are assigned the same color. Planar graphs 18. A graph is called planar if it can be drawn in the plane without any edges crossing. Such a drawing is called a planar representation of graph. Questions: (a) Is K 4 planar? (b) Is Q 3 planar? (c) Is K 3,3 planar? 19. A pictural representation of a planar graph splits the plane into regions (faces), including an unbounded region. Euler s formula: let G be a connected planar graph with e edges and v vertices. Let r be the number of regions in a planar representation of G. Then v e+r = 2. Proof. Suppose G consists of a single vertex v. Then v = 1, e = 0 and r = 1. Hence v e+r = 1 0+1 = 2. Otherwise G can be built up from a single vertex by the following two constructions: (a) Add a new vertex w, and connect it to an existing vertex u by an edge e which does not cross any existing edge. (b) Connect two existing vertices w and v by an edge e which does not cross any existing edge. Neither operations changes the value of v e+r. Hence G has the same value of v e+r as G consisting of a single vertex, that is, v e+r = 2. Thus the theorem is proved. 20. A graph G = (V,E) is k-colorable if we can paint the vertices using colors {1,2,...,k} such that no adjacent vertices have the same color. 21. Theorem. Every planar graph is 4-coloable. 22. If a graph is planar, so will be any graph obtained by removing an edge {u,v} and adding a new vertex {w} together with edges {u,w} and {w,v}. Such an operation called elementary subdivision. Two graphs G 1 and G 2 are called homeomporhic if they can be obtained from the same or isomorphic graph by a sequence of elementary subdivisions. 4

23. Kuratowaski s Theorem. A graph is nonplanar if and only if it contains a subgraph homeomorphic to K 3,3 or K 5. Trees 24. A tree is a connected graph with no cycles. 25. A rooted tree is a tree in which a particular vertex is designated as the root. The terminology for trees has botanical and genealogical origins parent, child, sibilings, ancestors and descendants. 26. Lemma 1. If G is a finite cycle-free graph with at least one edge, then G has at least two vertices of degree 1. Lemma 2. A connected graph G with n vertices must have at least n 1 edges. 27. Theorem. Let G be a graph with n 1 vertices. Then the followings are equivalent: (a) G is a tree. (b) G is a cycle-free (acyclic) and has n 1 edges (c) G is connected and has n 1 edges. Proof: by induction on n. The theorem is certainly true for the graph with only one vertex and hence no edges. That is the theorem holds for n = 1. We now assume that n > 1 and that the theorem holds for graphs with less than n vertices. (a) implies (b): Suppose G is a tree. Then G is cycle-free, so we only need to show that G has n 1 edges. By Lemma 1, G has a vertex of degree 1. Delete this vertex and its edge, we obtain a tree T wich has n 1 vertices. By the hypothesis, T has n 2 edges. Then G has n 1 edges. (b) implies (c): Suppose G is a cycle-free (acyclic) and has n 1 edges. We show that G is connected. Suppose T is disconnected and has k components T 1,...,T k, where are trees since each is connected and cycle-free. Say T i has n i vertices. Note that n i < n. Hence the theorem holds for T i, so T i has n i 1 edges. Thus and n = n 1 +n 2 + +n k n 1 = (n 1 1)+(n 2 1)+ +(n k 1) = n k. Hence k = 1. But this contradicts the assumption that G is disconnected and has k > 1 components. Hence G is connected. (c) implies (a): Suppose G is connected and has n 1 edges. We need to show that G is cyclc-free. Suppose a cycle containing an edge e. Delete e we obtain the graph H = G e which is also connected. But H has n vertices and n 2 edge, and this contradicts Lemma 2. Thus G is cycle-free and hence a tree. 28. An rooted tree is called an m-ary tree if every internal vertex has no more than m children. The tree is called a full m-ary tree if every internal vertex has exactly m children. An m-ary tree with m = 2 is called a binary tree. 29. A binary search tree T is a binary tree in which data are associated with vertices. Furthermore, the data are assigned so that for each vertex v in T, each data items in the left of v is less than the data item in v, and each item in the right subtree of v is greater than the data item in v. 5

Construct a binary search tree T. Example: form a binary search tree for the words mathematics, physics, geography, zoology, meterology, psychology, and chemistry (using alphabetical order). Locating data in a binary search tree T. Complexity of the worst-case searching: if T has n vertices, then locating or adding a data item requires no more than log n comparisons. Example: If n = 1,000,000, then logn = 21. 6