Graphs 9.1 Graphs and Graph Models أ. زينب آل كاظم 1.

Slides:



Advertisements
Similar presentations
Chapter 9 Graphs.
Advertisements

Lecture 5 Graph Theory. Graphs Graphs are the most useful model with computer science such as logical design, formal languages, communication network,
Graph-02.
1 Slides based on those of Kenneth H. Rosen Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus Graphs.
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.
Discrete Structures Chapter 7A Graphs Nurul Amelina Nasharuddin Multimedia Department.
1 Section 8.4 Connectivity. 2 Paths In an undirected graph, a path of length n from u to v, where n is a positive integer, is a sequence of edges e 1,
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:
Graphs Chapter 10.
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 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.
(CSC 102) Lecture 29 Discrete Structures. Graphs.
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)
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.
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.
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.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 9 (Part 1): Graphs  Introduction to Graphs (9.1)
Excursions in Modern Mathematics, 7e: Copyright © 2010 Pearson Education, Inc. 5 The Mathematics of Getting Around 5.1Euler Circuit Problems 5.2What.
 Quotient graph  Definition 13: Suppose G(V,E) is a graph and R is a equivalence relation on the set V. We construct the quotient graph G R in the follow.
Basic properties Continuation
Discrete Structures CISC 2315 FALL 2010 Graphs & Trees.
1 Graphs Terminology By: Sandeep Tuli Astt. Prof. CSE.
Chapter 9: Graphs.
Graphs Rosen, Chapter 8. NOT ONE OF THESE! One of these!
(CSC 102) Lecture 30 Discrete Structures. 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.
An Introduction to Graph Theory
Chapter 9 (Part 1): Graphs
Applied Discrete Mathematics Week 13: Graphs
Graphs: Definitions and Basic Properties
Chapter 9 (Part 2): Graphs
Let us switch to a new topic:
Graphs Rosen, Chapter 8.
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
Graphs Rosen, Chapter 8.
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.
Chapter 13 (Part 1): Graphs
Chapters 8.1 and 8.2 Based on slides by Y. Peng University of Maryland
CS100: Discrete structures
10.1 Graphs and Graph Models
Representing Relations
5 The Mathematics of Getting Around
Let us switch to a new topic:
Lecture 10: Graphs Graph Terminology Special Types of Graphs
10.4 Connectivity Dr. Halimah Alshehri.
Discrete Math II Howon Kim
Discrete Math II Howon Kim
Applied Discrete Mathematics Week 13: Graphs
Presentation transcript:

Graphs 9.1 Graphs and Graph Models أ. زينب آل كاظم 1

DEFINITION 1 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 with it, called its endpoints. An edge is said to connect its endpoints. A graph with an infinite vertex set is called an infinite graph. a graph with a finite vertex set is called a finite graph. Graphs and Graph Models أ. زينب آل كاظم 2

Simple graph: A graph in which each edge connects two different vertices and where no two edges connect the same pair of vertices. Multiple graph: Graphs that may have multiple edges connecting the same vertices. Loop is a closed curve whose initial and final vertices coincide. Pseudographs : Graphs that may include loops, (and possibly multiple edges connecting the same pair of vertices). a أ. زينب آل كاظم 3

Directed & Undirected Graphs Definition2 A directed graph (or digraph) ( V,E) consists of a nonempty set of vertices V and a set of directed edges (or arcs) E. Each directed edge is associated with an ordered pair of vertices. The directed edge associated with the ordered pair (u,v) is said to start at u and end at v. أ. زينب آل كاظم 4

simple directed graph a directed graph that has no loops and has no multiple directed edges. Directed multigraphs: directed graphs that may have multiple directed edges. Edge of multiplicity m When there are m directed edges, each associated to an ordered pair of vertices (u,v). Mixed graph: a graph with both directed and undirected edges. Types of Directed & Undirected Graphs أ. زينب آل كاظم 5

Homework Page أ. زينب آل كاظم 6

9.2 Graph Terminology and Special Types of Graphs أ. زينب آل كاظم 7

Basic Terminology DEFINITION 1 Two vertices u and v in an undirected graph G are called adjacent (or neighbors) in G if u and v are endpoints of an edge of G. If e is associated with {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 an edge associated with { u, v}. أ. زينب آل كاظم 8

The degree of a vertex DEFINITION 2 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. The degree of the vertex v is denoted by deg(v). A vertex of degree zero is called isolated. A vertex is pendant if and only if it has degree one. أ. زينب آل كاظم 9

Example 1: What are the degrees of the vertices in the graphs G and H displayed in Figure 1? Solution: In G: deg(a) = 2, deg(b) = deg(c) = deg(f ) = 4, deg(d ) = 1, deg(e) = 3, and deg(g) = O. In H: deg(a) = 4, deg(b) = deg(e) = 6, deg(c) = 1, and deg(d ) = 5. أ. زينب آل كاظم 10

A vertex of degree zero is called isolated. It follows that an isolated vertex is not adjacent to any vertex. Vertex g in graph G in Example 1 is isolated. A vertex is pendant if and only if it has degree one. Consequently, a pendant vertex is adjacent to exactly one other vertex. Vertex d in graph G in Example 1 is pendant. أ. زينب آل كاظم 11

THE HANDSHAKING THEOREM THEOREM 1 Let G = (V, E) be an undirected graph with e edges. Then 2e = ∑ vϵV deg(v). (Note that this applies even if multiple edges and loops are present.) أ. زينب آل كاظم 12

EXAMPLE 3 How many edges are there in a graph with 1 0 vertices each of degree 6? Solution: Because the sum of the degrees of the vertices is 6 · 1 0x6 = 60, it follows that 2e = 60. Therefore, e = 30. أ. زينب آل كاظم 13

THEOREM 2 An undirected graph has an even number of vertices of odd degree. أ. زينب آل كاظم 14

DEFINITION 3 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 or end vertex of (u,v). The initial vertex and terminal vertex of a loop are the same. أ. زينب آل كاظم 15

(directed graph) In-degree & Out-degree (directed graph) DEFINITION 4 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. (Note that a loop at a vertex contributes 1 to both the in- degree and the out-degree of this vertex.) أ. زينب آل كاظم 16

EXAMPLE 4 Find the in-degree and out-degree of each vertex in the graph G with directed edges shown in Figure 2. Solution: The in-degrees in G are deg - (a)=2, deg - (b)=2, deg - (c)=3, deg - (d)=2, deg - (e)=3, and deg - (f)=0. The out-degrees are deg + (a)=4, deg + (b)=1, deg + (c)=2,deg + (d)=2, deg + (e)=3, and deg + (f) =0. أ. زينب آل كاظم 17

THEOREM 3 Let G = (V,E) b e a graph with directed edges. Then: ∑ vϵV deg - (v)= ∑ vϵV deg + (v)=|E|. أ. زينب آل كاظم 18

Some Special Simple Graphs EXAMPLE 5 Complete Graphs 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. The graphs K n, for n=1,2,3,4,5,6, are displayed in Figure 3. أ. زينب آل كاظم 19

EXAMPLE 6 Cycles The cycle C 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 }, and { V n,V 1 }. The cycles C 3,C 4, C 5, and C 6 are displayed in Figure 4. أ. زينب آل كاظم 20

EXAMPLE 7 Wheels 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 new edges. The wheels W 3, W 4,W 5, and W 6 are displayed in Figure 5. أ. زينب آل كاظم 21

How many vertices & edges in each type? Type of the Simple Graph Number of VerticesNumber of Edges KnKn n CnCn nn WnWn n+12n أ. زينب آل كاظم 22

Bipartite Graphs DEFINITION 5 A simple graph G is called bipartite if its vertex set V can be partitioned into two disjoint sets V 1 and V 2 such that every edge in the graph 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 ). When this condition holds, we call the pair (V 1,V 2 ) a bipartition of the vertex set V of G. أ. زينب آل كاظم 23

EXAMPLE 11 Are the graphs G and H displayed in Figure 8 bipartite? Solution: Graph G is bipartite because its vertex set is the union of two disjoint sets, {a,b,d} and {c, e, j, g}, and each edge connects a vertex in one of these subsets to a vertex in the other subset. (Note that for G to be bipartite it is not necessary that every vertex in {a,b,d} be adjacent to every vertex in {c,e,j, g}. For instance, b and g are not adjacent.) Graph H is not bipartite because its vertex set cannot be partitioned into two subsets so that edges do not connect two vertices from the same subset. verify this by (consider the vertices a, b, and j.) أ. زينب آل كاظم 24

Homework Page (a,b,c) 37(a,b,d,e,f). أ. زينب آل كاظم 25

9.4 Connectivity أ. زينب آل كاظم 26

Paths Informally, a 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. Definition 1 Let n be a nonnegative integer and G an undirected graph. A path of length n from u to v in G is a sequence of n edges e 1,..., e n of G such that e 1 is associated with {x 0, x 1 }, e 2 is associated with {X 1, X 2 }, and so on, with e n associated with {x n-1, x n }, where X 0 = u and X n =v. When the graph is simple, we denote this path by its vertex sequence X 0,X 1,…, Xn (because listing these vertices uniquely determines the path). The path is a circuit if it begins and ends at the same vertex, that is, if u = v, and has length greater than zero. The path or circuit is said to pass through the vertices X 1, X 2,..., X n-l or traverse the edges e 1, e 2,..., e n. A path or circuit is simple if it does not contain the same edge more than once. أ. زينب آل كاظم 27

Remark: in some books, the term walk is used instead of path, where a walk is defined to be an alternating sequence of vertices and edges of a graph, V 0, e 1,V 1, e 2,…, V n-1, e n, V n, where V i-1 and V i are the endpoints of e i for i=1,2,…,n. When this terminology is used, closed walk is used instead of circuit to indicate a walk that begins and ends at the same vertex, and trail is used to denote a walk that has no repeated edge (replacing the term simple path). When this terminology is used, the terminology path is often used for a trail with no repeated vertices. أ. زينب آل كاظم 28

EXAMPLE 1 In the simple graph shown in Figure 1, a,d,c,f,e is a simple path of length 4, because {a,d}, {d,c }, {c,f}, and {f,e} are all edges. However, d,e,c,a is not a path, because {e,c} is not an edge. Note that b, c, f, e, b is a circuit of length 4 because {b, c}, {c,f}, {f, e}, and {e, b} are edges, and this path begins and ends at b. The path a, b, e, d, a, b, which is of length 5, is not simple because it contains the edge {a,b} twice. أ. زينب آل كاظم 29

DEFINITION 2 Let n be a nonnegative integer and G a directed graph. A path of length n from u to v in G is a sequence of edges e 1,e 2,..,e n of G such that e 1 is associated with (x 0,x 1 ), e 2 is associated with (x 1, x 2 ), and so on, with e n associated with (x n-1,x n ), where x 0 = u and x n = v. When there are no multiple edges in the directed graph, this path is denoted by its vertex sequence x 0, x 1, x 2, …, x n. A path of length greater than zero that begins and ends at the same vertex is called a circuit or cycle. A path or circuit is called simple if it does not contain the same edge more than once. أ. زينب آل كاظم 30

Connectedness In Undirected Graphs DEFINITION 3 An undirected graph is called connected if there is a path between every pair of distinct vertices of the graph. أ. زينب آل كاظم 31

EXAMPLE 5 The graph G 1 in Figure 2 is connected, because for every pair of distinct vertices there is a path between them. However, the graph G 2 in Figure 2 is not connected. For instance, there is no path in G 2 between vertices a and d. أ. زينب آل كاظم 32

Homework Page 629 1(a,b,c,d) 3 أ. زينب آل كاظم 33