CPCS Discrete Structures 1

Similar documents
Introduction to Graphs

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.

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

Graphs. Introduction To Graphs: Exercises. Definitions:

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

Graphs. Pseudograph: multiple edges and loops allowed

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

Foundations of Discrete Mathematics

Varying Applications (examples)

Math.3336: Discrete Mathematics. Chapter 10 Graph Theory

CS200: Graphs. Prichard Ch. 14 Rosen Ch. 10. CS200 - Graphs 1

Ma/CS 6b Class 5: Graph Connectivity

The vertex set is a finite nonempty set. The edge set may be empty, but otherwise its elements are two-element subsets of the vertex set.

Discrete Structures CISC 2315 FALL Graphs & Trees

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.

Introduction III. Graphs. Motivations I. Introduction IV

Graphs. The ultimate data structure. graphs 1

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

March 20/2003 Jayakanth Srinivasan,

An Introduction to Graph Theory

CMSC 380. Graph Terminology and Representation

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

Section 10.1: Graphs and Graph Models. Introduction to Graphs Definition of a Graph Types of Graphs Examples of Graphs

Elements of Graph Theory

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

Graph Theory CS/Math231 Discrete Mathematics Spring2015

MTL 776: Graph Algorithms. B S Panda MZ 194

Number Theory and Graph Theory

Basics of Graph Theory

Math 170- Graph Theory Notes

Graph theory. Po-Shen Loh. June We begin by collecting some basic facts which can be proved via bare-hands techniques.

Ordinary Differential Equation (ODE)

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

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

Chapter 2 Graphs. 2.1 Definition of Graphs

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

Induction Review. Graphs. EECS 310: Discrete Math Lecture 5 Graph Theory, Matching. Common Graphs. a set of edges or collection of two-elt subsets

Graphs V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

Artificial Intelligence

Approximation slides 1. An optimal polynomial algorithm for the Vertex Cover and matching in Bipartite graphs

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

Paths. Path is a sequence of edges that begins at a vertex of a graph and travels from vertex to vertex along edges of the graph.

Assignment 4 Solutions of graph problems

Introduction to Graph Theory

An Introduction to Graph Theory

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

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

Math 776 Graph Theory Lecture Note 1 Basic concepts

Combinatorics Summary Sheet for Exam 1 Material 2019

λ -Harmonious Graph Colouring

Chapter 8 Topics in Graph Theory

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

Dieter Jungnickel (2008), Graphs, Networks and Algorithms, 3rd edition, which is available online via SpringerLink.

Graphs and Isomorphisms

5 Graphs

CS 441 Discrete Mathematics for CS Lecture 24. Relations IV. CS 441 Discrete mathematics for CS. Equivalence relation

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

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

Graph Theory. Part of Texas Counties.

Chapter 11: Graphs and Trees. March 23, 2008

Theorem 3.1 (Berge) A matching M in G is maximum if and only if there is no M- augmenting path.

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

Complete Cototal Domination

Domination, Independence and Other Numbers Associated With the Intersection Graph of a Set of Half-planes

Proposition 1. The edges of an even graph can be split (partitioned) into cycles, no two of which have an edge in common.

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

1 Matchings in Graphs

CSE 101, Winter Discussion Section Week 1. January 8 - January 15

Ma/CS 6b Class 4: Matchings in General Graphs

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

Graph Theory Mini-course

Trees. Arash Rafiey. 20 October, 2015

Graphs: Introduction. Ali Shokoufandeh, Department of Computer Science, Drexel University

Chapter 5 Graph Algorithms Algorithm Theory WS 2012/13 Fabian Kuhn

CHAPTER 10 Graphs. 258 Chapter 10 Graphs

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

Instructor: Paul Zeitz, University of San Francisco

Answers to specimen paper questions. Most of the answers below go into rather more detail than is really needed. Please let me know of any mistakes.

HW Graph Theory SOLUTIONS (hbovik) - Q

Let G = (V, E) be a graph. If u, v V, then u is adjacent to v if {u, v} E. We also use the notation u v to denote that u is adjacent to v.

On Balance Index Set of Double graphs and Derived graphs

Solving Linear Recurrence Relations (8.2)

Majority and Friendship Paradoxes

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.

Domination Number of Jump Graph

Chromatic Transversal Domatic Number of Graphs

11.4 Bipartite Multigraphs

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

Solution to Graded Problem Set 4

A good picture is worth a thousand words

context. (Similarly, we write ν for ν(g), etc. if there is no risk of confusion.) For a subset A V we write N G (A) = {v V ( w A)(v w)} (the set of

Graph Theory. Connectivity, Coloring, Matching. Arjun Suresh 1. 1 GATE Overflow

Graph theory - solutions to problem set 1

The Restrained Edge Geodetic Number of a Graph

ON A WEAKER VERSION OF SUM LABELING OF GRAPHS

How can we lay cable at minimum cost to make every telephone reachable from every other? What is the fastest route between two given cities?

Binding Number of Some Special Classes of Trees

WUCT121. Discrete Mathematics. Graphs

Modules. 6 Hamilton Graphs (4-8 lectures) Introduction Necessary conditions and sufficient conditions Exercises...

Ma/CS 6b Class 2: Matchings

Transcription:

Let us switch to a new topic: Graphs CPCS 222 - Discrete Structures 1

Introduction to Graphs 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. For each e E, e = {u, v} where u, v V. An undirected graph (not simple) may contain loops. An edge e is a loop if e = {u, u} for some u V. CPCS 222 - Discrete Structures 2

Introduction to Graphs Definition: A directed graph G = (V, E) consists of a set V of vertices and a set E of edges that are ordered pairs of elements in V. For each e E, e = (u, v) where u, v V. An edge e is a loop if e = (u, u) for some u V. A simple graph is just like a directed graph, but with no specified direction of its edges. CPCS 222 - Discrete Structures 3

Graph Models Example I: How can we represent a network of (bi-directional) railways connecting a set of cities? We should use a simple graph with an edge {a, b} indicating a direct train connection between cities a and b. Toronto Boston Lübeck Washington New York Hamburg CPCS 222 - Discrete Structures 4

Graph Models Example II: In a round-robin robin tournament, each team plays against each other team exactly once. How can we represent the results of the tournament (which team beats which other team)? We should use a directed graph with an edge (a, b) indicating that team a beats team b. Maple Leafs Bruins Penguins Lübeck Giants CPCS 222 - Discrete Structures 5

Graph Terminology Definition: Two vertices u and v in an undirected graph G are called adjacent (or neighbors) ) in G if {u, v} is an edge in G. If e = {u, v}, the edge e is called incident with the vertices u and v. The edge e is also said to connect u and v. The vertices u and v are called endpoints of the edge {u, v}. CPCS 222 - Discrete Structures 6

Graph Terminology Definition: The degree of a vertex in an undirected graph is the number of edges incident with it, except that a loop at a vertex contributes twice to the degree of that vertex. In other words, you can determine the degree of a vertex in a displayed graph by counting the lines that touch it. The degree of the vertex v is denoted by deg(v). CPCS 222 - Discrete Structures 7

Graph Terminology A vertex of degree 0 is called isolated,, since it is not adjacent to any vertex. Note: A vertex with a loop at it has at least degree 2 and, by definition, is not isolated,, even if it is not adjacent to any other vertex. A vertex of degree 1 is called pendant.. It is adjacent to exactly one other vertex. CPCS 222 - Discrete Structures 8

Graph Terminology Example: Which vertices in the following graph are isolated, which are pendant, and what is the maximum degree? What type of graph is it? b a c d f e Solution: Vertex f is isolated, and vertices a, d and j are pendant. The maximum degree is deg(g) = 5. This graph is a pseudograph (undirected, loops). g f j CPCS 222 - Discrete Structures 9 h

Graph Terminology Let us look at the same graph again and determine the number of its edges and the sum of the degrees of all its vertices: b a c d f e Result: There are 9 edges, and the sum of all degrees is 18. This is easy to explain: Each new edge increases the sum of degrees by exactly two. g i j CPCS 222 - Discrete Structures 10 h

Graph Terminology The Handshaking Theorem: Let G = (V, E) be an undirected graph with e edges. Then 2e = v V deg(v) Example: How many edges are there in a graph with 10 vertices, each of degree 6? Solution: The sum of the degrees of the vertices is 6 10 = 60. According to the Handshaking Theorem, it follows that 2e = 60, so there are 30 edges. CPCS 222 - Discrete Structures 11

Graph Terminology Theorem: An undirected graph has an even number of vertices of odd degree. Proof: Let V1 and V2 be the set of vertices of even and odd degrees, respectively (Thus V1 V2 =,, and V1 V2 = V). Then by Handshaking theorem 2 E = v V deg(v) = v V1 deg(v) + v V2 deg(v) Since both 2 E and v V1 deg(v) are even, v V2 deg(v) must be even. Since deg(v) if odd for all v V2, V2 must be even. QED CPCS 222 - Discrete Structures 12

Graph Terminology Definition: When (u, v) is an edge of the graph G with directed edges, u is said to be adjacent to v, and v is said to be adjacent from u. The vertex u is called the initial vertex of (u, v), and v is called the terminal vertex of (u, v). The initial vertex and terminal vertex of a loop are the same. CPCS 222 - Discrete Structures 13

Graph Terminology Definition: In a graph with directed edges, the in- degree of a vertex v, denoted by deg - (v),, is the number of edges with v as their terminal vertex. The out-degree of v, denoted by deg + (v),, is the number of edges with v as their initial vertex. Question: How does adding a loop to a vertex change the in-degree and out-degree of that vertex? Answer: It increases both the in-degree and the out-degree by one. CPCS 222 - Discrete Structures 14

Graph Terminology Example: What are the in-degrees and out- degrees of the vertices a, b, c, d in this graph: deg - (a) = 1 deg + (a) = 2 a b deg - (b) = 4 deg + (b) = 2 deg - (d) = 2 deg + (d) = 1 d c deg - (c) = 0 deg + (c) = 2 CPCS 222 - Discrete Structures 15

Graph Terminology Theorem: Let G = (V, E) be a graph with directed edges. Then: v V deg - (v) = v V deg + (v) = E This is easy to see, because every new edge increases both the sum of in-degrees and the sum of out-degrees by one. CPCS 222 - Discrete Structures 16

Special Graphs Definition: The complete graph on n vertices, denoted by K n, is the simple graph that contains exactly one edge between each pair of distinct vertices. K 1 K 2 K 3 K 4 K 5 CPCS 222 - Discrete Structures 17

Special Graphs Definition: The 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 }. C 3 C 4 C 5 C 6 CPCS 222 - Discrete Structures 18

Special Graphs Definition: We obtain the wheel W n when we add an additional vertex to the cycle C n, for n 3, and connect this new vertex to each of the n vertices in C n by adding new edges. W 3 W 4 W 5 W 6 CPCS 222 - Discrete Structures 19

Special Graphs Definition: The n-cube, denoted by Q n, is the graph that 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 in exactly one bit position. 0 1 10 11 00 01 100 110 101 000 001 111 010 011 Q 1 Q 2 Q 3 CPCS 222 - Discrete Structures 20

Special Graphs Definition: A simple graph 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 in the graph connects a vertex in V 1 with a vertex in V 2 (so that no edge in G connects either two vertices in V 1 or two vertices in V 2 ). For example, consider a graph that represents each person in a village by a vertex and each marriage by an edge. This graph is bipartite,, because each edge connects a vertex in the subset of males with a vertex in the subset of females (if we think of traditional marriages). CPCS 222 - Discrete Structures 21

Special Graphs Example I: Is C 3 bipartite? v 1 v 2 v 3 No, because there is no way to partition the vertices into two sets so that there are no edges with both endpoints in the same set. Example II: Is C 6 bipartite? v 1 v 6 v 2 v 5 v 3 v 4 Yes, because we can display C 6 like this: v 1 v 6 v 5 v 2 v 3 v 4 CPCS 222 - Discrete Structures 22

Special Graphs Definition: The complete bipartite graph K m,n is the graph that has its vertex set partitioned into two subsets of m and n vertices, respectively. Two vertices are connected if and only if they are in different subsets. K 3,2 K 3,4 CPCS 222 - Discrete Structures 23

Operations on Graphs Definition: A subgraph of a graph G = (V, E) is a graph H = (W, F) where W V and F E. Note: Of course, H is a valid graph, so we cannot remove any endpoints of remaining edges when creating H. Example: K 5 subgraph of K 5 CPCS 222 - Discrete Structures 24

Operations on Graphs Definition: The union of two simple graphs G 1 = (V 1, E 1 ) and G 2 = (V 2, E 2 ) is the simple graph with vertex set V 1 V 2 and edge set E 1 E 2. The union of G 1 and G 2 is denoted by G 1 G 2. G 1 G 2 G 1 G 2 = K 5 CPCS 222 - Discrete Structures 25