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.

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

Based on slides by Y. Peng University of Maryland
Chapter 9 Graphs.
Lecture 5 Graph Theory. Graphs Graphs are the most useful model with computer science such as logical design, formal languages, communication network,
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
Applied Discrete Mathematics Week 12: Trees
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.
SE561 Math Foundations Week 11 Graphs I
Graph Theory in CS Route Search in Online Map Services
Discrete Structures Chapter 7A Graphs Nurul Amelina Nasharuddin Multimedia Department.
Selected Topics in Data Networking Graph Representation.
Applied Discrete Mathematics Week 12: Trees
KNURE, Software department, Ph , N.V. Bilous Faculty of computer sciences Software department, KNURE Discrete.
Let us switch to a new topic:
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:
Intro to Graphs CSIT 402 Data Structures II. CSIT 402 Graph Introduction2 Graphs Graphs are composed of ›Nodes (vertices) Can be labeled ›Edges (arcs)
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,
Copyright © Cengage Learning. All rights reserved. CHAPTER 10 GRAPHS AND TREES.
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.
Lecture 10: Graphs Graph Terminology Special Types of Graphs
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 9 (Part 2): Graphs  Graph Terminology (9.2)
aka “Undirected Graphs”
9.2: Graph Terminology. Special Simple Graphs Complete GraphsK 1,… CyclesC 3,… WheelsW 3,… N-cubesQ 1,… Complete bipartiteK 2,2,…
1 CS104 : Discrete Structures Chapter V Graph Theory.
Based on slides by Y. Peng University of Maryland
9.1 Introduction to Graphs
GRAPHS THEROY. 2 –Graphs Graph basics and definitions Vertices/nodes, edges, adjacency, incidence Degree, in-degree, out-degree Subgraphs, unions, isomorphism.
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.
1/24 Introduction to Graphs. 2/24 Graph Definition Graph : consists of vertices and edges. Each edge must start and end at a vertex. Graph G = (V, E)
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.
Chapter 5 Graphs  the puzzle of the seven bridge in the Königsberg,  on the Pregel.
1 Graphs Theory UNIT IV. 2Contents  Basic terminology,  Multi graphs and weighted graphs  Paths and circuits  Shortest path in weighted graph  Hamiltonian.
Graph Theory and Applications
© 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.
And before you really hate (mathematical) relations and begin to break your (social) relations, let’s switch to a new topic: Graphs Discrete Structures.
Discrete Structures CISC 2315 FALL 2010 Graphs & Trees.
1 Graphs Terminology By: Sandeep Tuli Astt. Prof. CSE.
Chapter 9: Graphs.
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.
رياضيات متقطعة لعلوم الحاسب 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.
Chapter 9 (Part 1): Graphs
Applied Discrete Mathematics Week 13: Graphs
Chapter 9 (Part 2): Graphs
Let us switch to a new topic:
Lecture 19: CONNECTIVITY Sections
Applied Discrete Mathematics Week 13: Graphs
Special Graphs By: Sandeep Tuli Astt. Prof. CSE.
Graph Graphs and graph theory can be used to model:
Chapters 8.1 and 8.2 Based on slides by Y. Peng University of Maryland
Graph theory Definitions Trees, cycles, directed graphs.
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.
Graphs.
Chapters 8.1 and 8.2 Based on slides by Y. Peng University of Maryland
CS100: Discrete structures
Let us switch to a new topic:
Lecture 10: Graphs Graph Terminology Special Types of Graphs
Applied Discrete Mathematics Week 13: Graphs
Presentation transcript:

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

2 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.

3 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.

4 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. New York BostonWashington Lübeck Toronto Hamburg

5 Graph Models Example II: In a round-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. Penguins Bruins Lübeck Giants Maple Leafs

6 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}.

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

8 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.

9 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? a bc dih g j 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).

10 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: a bc dih g j 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.

11 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.

12 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 QED

13 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.

14 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.

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

16 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.

17 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. K1K1K1K1 K2K2K2K2 K3K3K3K3 K4K4K4K4 K5K5K5K5

18 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 }. C3C3C3C3 C4C4C4C4 C5C5C5C5 C6C6C6C6

19 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. W3W3W3W3 W4W4W4W4 W5W5W5W5 W6W6W6W6

20 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. Q1Q1Q1Q1 Q2Q2Q2Q2 Q3Q3Q3Q

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

22 Special Graphs Example I: Is C 3 bipartite? v1v1v1v1 v2v2v2v2 v3v3v3v3 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? v5v5v5v5 v1v1v1v1 v2v2v2v2 v3v3v3v3 v4v4v4v4 v6v6v6v6 v1v1v1v1 v6v6v6v6 v2v2v2v2 v5v5v5v5 v3v3v3v3 v4v4v4v4 Yes, because we can display C 6 like this:

23 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

24 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: K5K5K5K5 subgraph of K 5

25 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. G1G1G1G1 G2G2G2G2 G 1  G 2 = K 5