Discrete Structures Graphs 1 (Ch. 10) Dr. Muhammad Humayoun Assistant Professor COMSATS Institute of Computer Science, Lahore.

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

Lecture 5 Graph Theory. Graphs Graphs are the most useful model with computer science such as logical design, formal languages, communication network,
22C:19 Discrete Math Graphs Fall 2010 Sukumar Ghosh.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 – CHAPTER 4 GRAPHS 1.
Introduction to Graphs
1 Slides based on those of Kenneth H. Rosen Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus Graphs.
Discrete Mathematics and Its Applications
1 Section 8.1 Introduction to Graphs. 2 Graph A discrete structure consisting of a set of vertices and a set of edges connecting these vertices –used.
1 Section 8.2 Graph Terminology. 2 Terms related to undirected graphs Adjacent: 2 vertices u & v in an undirected graph G are adjacent (neighbors) in.
Introduction to Graphs Lecture 18: Nov 16. Seven Bridges of Königsberg Is it possible to walk with a route that crosses each bridge exactly once?
Applied Discrete Mathematics Week 12: Trees
MTH118 Sanchita Mal-Sarkar. Routing Problems The fundamental questions: Is there any proper route for the particular problem? If there are many possible.
KNURE, Software department, Ph , N.V. Bilous Faculty of computer sciences Software department, KNURE Discrete.
Graphs Rosen 8.1, 8.2. There Are Many Uses for Graphs! Networks Data organizations Scene graphs Geometric simplification Program structure and processes.
9.2 Graph Terminology and Special Types Graphs
GRAPH Learning Outcomes Students should be able to:
Graphs Chapter 10.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 9 (Part 1): Graphs  Introduction to Graphs (9.1)
Graph Theoretic Concepts. What is a graph? A set of vertices (or nodes) linked by edges Mathematically, we often write G = (V,E)  V: set of vertices,
1 Excursions in Modern Mathematics Sixth Edition Peter Tannenbaum.
1 Graphs Chapters 9.1 and 9.2 University of Maryland Chapters 9.1 and 9.2 Based on slides by Y. Peng University of Maryland.
Graph Theory 4/23/2017.
16.1 CompSci 102© Michael Frank Today’s topics GraphsGraphs –Basics & types –Properties –Connectivity –Hamilton & Euler Paths Reading: Sections Reading:
Module #19: Graph Theory: part I Rosen 5 th ed., chs. 8-9 내년 3 월 ? 교환 학생 프로그램 영어 점수 미리미리 준비하세요.
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
1 CS104 : Discrete Structures Chapter V Graph Theory.
9.1 Introduction to Graphs
Graphs.  Definition A simple graph G= (V, E) consists of vertices, V, a nonempty set of vertices, and E, a set of unordered pairs of distinct elements.
Graphs What are Graphs? General meaning in everyday math: A plot or chart of numerical data using a coordinate system. Technical meaning in discrete.
9 Graphs. A graph G = (V, E) consists of V, a nonempty set of vertices (or nodes) and E, a set of edges. Each edge has either one or two vertices associated.
September1999 CMSC 203 / 0201 Fall 2002 Week #13 – 18/20/22 November 2002 Prof. Marie desJardins.
Introduction to Graph Theory
Lecture 10: Graph-Path-Circuit
Introduction to Graphs. This Lecture In this part we will study some basic graph theory. Graph is a useful concept to model many problems in computer.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 9 (Part 1): Graphs  Introduction to Graphs (9.1)
Graphs 9.1 Graphs and Graph Models أ. زينب آل كاظم 1.
MAT 2720 Discrete Mathematics Section 8.2 Paths and Cycles
Basic properties Continuation
1 Graphs Terminology By: Sandeep Tuli Astt. Prof. CSE.
Chapter Graphs and Graph Models
LOGO.  Relations:  In these slides: Introductions to graphs Graph terminology Representing graphs and graph isomorphism Connectivity Euler and Hamilton.
Chapter 9: Graphs.
Graphs Rosen, Chapter 8. NOT ONE OF THESE! One of these!
Chap 7 Graph Def 1: Simple graph G=(V,E) V : nonempty set of vertices E : set of unordered pairs of distinct elements of V called edges Def 2: Multigraph.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
GRAPH THEORY Discrete Math Team KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS )
رياضيات متقطعة لعلوم الحاسب MATH 226. Chapter 10.
1 Graphs Chapters 10.1 and 10.2 University of Maryland Chapters 10.1 and 10.2 Based on slides by Y. Peng University of Maryland.
Chapter Chapter Summary Graphs and Graph Models Graph Terminology and Special Types of Graphs Representing Graphs and Graph Isomorphism Connectivity.
An Introduction to Graph Theory
Excursions in Modern Mathematics Sixth Edition
Chapter 9 (Part 1): Graphs
Applied Discrete Mathematics Week 13: Graphs
Graphs Rosen, Chapter 8.
Graph Graphs and graph theory can be used to model:
COT 3100, Spring 2001 Applications of Discrete Structures
Chapters 8.1 and 8.2 Based on slides by Y. Peng University of Maryland
Graphs Rosen, Chapter 8.
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 10 Graphs Slides are adopted from “Discrete.
Graphs Chapters 10.1 and 10.2 Based on slides by Y. Peng University of Maryland.
Chapter 13 (Part 1): Graphs
Rosen 5th ed., chs. 8-9 ~44 slides (more later), ~3 lectures
Chapters 8.1 and 8.2 Based on slides by Y. Peng University of Maryland
CS100: Discrete structures
Graph Theory What is a graph?.
Let us switch to a new topic:
Discrete Math II Howon Kim
Discrete Math II Howon Kim
Ch. 9: Graph Theory 9.1 Intro to Graphs.
Concepts of Computation
Presentation transcript:

Discrete Structures Graphs 1 (Ch. 10) Dr. Muhammad Humayoun Assistant Professor COMSATS Institute of Computer Science, Lahore. Modified slides of Dr. M. Atif 1

Graphs What are Graphs? – A class of discrete structures useful for representing relations among objects. – Vertices (nodes) connected by edges. – Theory about graphs can be used to solve a lot of important problems 2

Perhaps the first graph you saw Can we sent all the utilities to the three houses without crossing wires? Not possible! 3

The first graph theory The first graph theory paper by Leonhard Euler In 1736: Seven bridges of Königsberg A town with 7 bridges and 4 pieces of land… 4

The Origin of Graph Theory Can we travel each bridge exactly once and return to the starting point? Not possible! 5

Definition - Graphs A graph G = (V, E) is defined by a set of vertices V, and a set of edges E consisting of ordered or unordered pairs of vertices from V. Thus a graph G = (V, E) – V = set of vertices – E = set of edges = subset of V  V – Thus |E| = O(|V| 2 ) 6

Simple Graphs A graph in which each edge connects two different vertices and where no two edges connect the same pair of vertices. 7

Example of a Simple Graph Let V be the set of states in the far southeastern U.S.: – i.e., V={FL, GA, AL, MS, LA, SC, TN, NC} Let E={{u,v}| u,v ∈ V and u adjoins v} = {{FL,GA},{FL,AL},{FL,MS}, {FL,LA}, {GA,AL}, {AL,MS}, {MS,LA}, {GA,SC}, {GA,TN}, {SC,NC}, {NC,TN}, {MS,TN}, {MS,AL}} 8

Multigraphs A multigraph: multiple edges connecting the same nodes  E.g., nodes are cities, edges are segments of major highways. 9

Pseudographs Pseudograph: Like a multigraph, but edges connecting a node to itself are allowed. 10

Directed Graphs A directed graph (V,E) consists of a set of vertices V and a set of directed edges E on V : ordered pairs of elements (u,v), u,v ∈ V. Road networks between cities are typically undirected. Street networks within cities are almost always directed because of one- way streets. Most graphs of graph- theoretic interest are undirected. 11

Directed Multigraphs A directed multigraph has directed parallel edges.  E.g., V=web pages,  E=hyperlinks. The WWW is a directed multigraph... 12

Types of Graphs: Summary Summary of the book’s definitions. Keep in mind this terminology is not fully standardized across different authors... 13

Graph Models Graphs are used in a wide variety of models We now describe some diverse graph models for some interesting applications 14

SOCIAL NETWORKS Acquaintanceship Graphs Represent whether two people know each other, that is, whether they are acquainted. Each person in a particular group of people is represented by a vertex. Undirected edge is used to connect two people when these people know each other. No multiple edges are used. Usually no loops are used. (If we want to include the notion of self- knowledge, we would include loops.) 15

Example 16

17

An influence graph A directed edge (a, b) means a can influence b. E.g. (Fred, Brian) means Fred can influence Brian. 18

Collaboration Graphs Academic Non-Academic 19

COMMUNICATIONNETWORKS Call Graphs 20

Call Graphs (2) Call graphs that model actual calling activities can be huge. For example, one call graph studied at AT&T, modeling calls during 20 days, has about 290 million vertices and 4 billion edges 21

SOFTWARE DESIGN APPLICATIONS A Precedence Graph 22

TOURNAMENTS Round Robin Tournaments A tournament where every team plays every other team exactly once. Such tournaments can be modeled using directed graphs where each team is represented by a vertex. Note that (a, b) is an edge if team ‘a’ beats team ‘b’. This graph is a simple directed graph, containing no loops or multiple directed edges. 23

24 Team 1 is undefeated in this tournament, and Team 3 is winless.

A Single-Elimination Tournament 25

Question Can you find a subject to which graph theory has not been applied? 26

10.2 Graph Terminology 27

Graph Terminology Adjacency: Let G be an undirected graph with edge set E. Let e ∈ E be (or map to) the pair {u,v}. Then we say: u, v are adjacent / neighbors / connected. Edge e is incident with vertices u and v. Edge e connects u and v. Vertices u and v are endpoints of edge e. 28

Neighborhood of a Vertex Let G be an undirected graph, v ∈ V a vertex. The neighborhood of v, N(v), is the set of all neighbors. N(a) = {b, c} N(b) = {a, c} N(c) = {a, b, d} N(d) = {d} N(e) = {} 29

Degree of a Vertex Let G be an undirected graph, v ∈ V a vertex. The degree of v, deg(v), is its number of incident edges. (Note: self-loops are counted twice.) deg(a) = 3 deg(b) = = 5 deg(c) = 5 deg(d) = = 5 deg(e) = 0 (isolated vertex) Pendent vertex = with deg. 1 30

EXAMPLE What are the degrees and what are the neighborhoods of the vertices in the graph: 31

EXAMPLE The degrees: – deg(a) = 4, deg(b) = deg(e) = 6, deg(c) = 1, and deg(d ) = 5. The neighborhoods – N(a) = {b, d, e}, N(b) = {a, b, c, d, e}, N(c) = {b}, N(d) = {a, b, e}, and N(e) = {a, b, d}. 32

The Handshaking Theorem Let G be an undirected graph * with vertex set V and edge set E. Then The sum of all the vertex degrees is an even number. 33 * (simple, multi, or pseudo)

Example deg(a)=3, deg(b)=5, deg(c)=5, deg(d)=5, deg(e)=0 34

Example How many edges are there in a graph with 10 vertices each of degree six? deg(a) = deg(b) = deg(c) = … = deg(j) = 6 35 deg(a) + deg(b) + deg(c) + … + deg(j) = 2|E| 10*6 = 2|E| |E| = 60/2 = 30

The handshaking lemma It is called the handshaking lemma because: – It tells us that if several people shake hands, then the total number of hands shaken must be even – It is precisely because just two hands are involved in each handshake. Examples on board. – 2 vertices (deg(a)+deg(b)=2|E|) 1+1 = 2*|E| – 3 vertices (deg(a)+deg(b)+deg(c)=2|E|) 2+2+2=2*|E| = 2*|E| – 4 vertices (deg(a)+deg(b)+deg(c)+deg(d)=2|E|) / /

Handshaking Theorem (Corollary) Corollary: Any undirected graph has an even number of vertices of odd degree. In any undirected graph the number of vertices of odd degree is even. Examples on board. 1+1 = = = = 12 2+( ) = 6 37

Directed Graphs 38

Directed Degree Let G be a directed graph, v a vertex of G. The in-degree of v, deg - (v), is the number of edges going to v. The out-degree of v, deg + (v), is the number of edges coming from v. The degree of v, deg(v):≡deg - (v)+deg + (v), is the sum of v’s in-degree and out-degree. 39

Directed Degree Determine in/out-degree of each node deg + (a)= 4 deg - (a)= 2 deg + (b)= 1deg - (b)= 2 deg + (c)= 2deg - (c)= 3 deg + (d)= 2deg - (d)= 2 deg + (e)= 3deg - (e)= 3 deg + (f)= 0deg - (f)= 0 40

Directed Handshaking Theorem Let G be a directed (possibly multi-) graph with vertex set V and edge set E. Then: Note that the degree of a node is unchanged by whether we consider its edges to be directed or undirected. 41

END 42