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.

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

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,
22C:19 Discrete Math Graphs Fall 2010 Sukumar Ghosh.
Graph-02.
 期中测验时间:本周五上午 9 : 40  教师 TA 答疑时间 : 周三晚上 6 : 00—8 : 30  地点:软件楼 315 房间,  教师 TA :李弋老师  开卷考试.
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
Discrete Structures Chapter 7B Graphs Nurul Amelina Nasharuddin Multimedia Department.
Representing Graphs Wade Trappe. Lecture Overview Introduction Some Terminology –Paths Adjacency Matrix.
Discrete Structures Chapter 7A Graphs Nurul Amelina Nasharuddin Multimedia Department.
CTIS 154 Discrete Mathematics II1 8.2 Paths and Cycles Kadir A. Peker.
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.
© 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 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.
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 9 (Part 2): Graphs  Graph Terminology (9.2)
CSNB143 – Discrete Structure Topic 9 – Graph. Learning Outcomes Student should be able to identify graphs and its components. Students should know how.
1 CS104 : Discrete Structures Chapter V Graph Theory.
Based on slides by Y. Peng University of Maryland
Graphs What are Graphs? General meaning in everyday math: A plot or chart of numerical data using a coordinate system. Technical meaning in discrete.
Chapter 5 Graphs  the puzzle of the seven bridge in the Königsberg,  on the Pregel.
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.
 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.
Graphs Basic properties.
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. 期中测验时间和地点: 11 月 4 日, 上午 9:40—11 : 40 地点: 教室 2. 答疑时间和地点: 1)11 月 1 日 ( 周五 )13:00—15:00 软件楼 319 2)11 月 2 日和 3 日, 14:00—17:00 软件楼 3 楼 机房讨论室.
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.
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 14: Trees
Applied Discrete Mathematics Week 13: Graphs
Chapter 9 (Part 2): Graphs
Let us switch to a new topic:
Applied Discrete Mathematics Week 13: Graphs
Chapters 8.1 and 8.2 Based on slides by Y. Peng University of Maryland
Discrete Structures – CNS2300
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.
Based on slides by Y. Peng University of Maryland
Chapter 13 (Part 1): Graphs
Can you draw this picture without lifting up your pen/pencil?
Introduction to Graph Theory Euler and Hamilton Paths and Circuits
Chapters 8.1 and 8.2 Based on slides by Y. Peng University of Maryland
CS100: Discrete structures
Walks, Paths, and Circuits
Let us switch to a new topic:
Euler and Hamilton Paths
10.4 Connectivity Dr. Halimah Alshehri.
Definition 8: Graphs that have a number assigned to each edge or each vertex are called weighted graphs weighted digraphs.
Applied Discrete Mathematics Week 13: Graphs
Based on slides by Y. Peng University of Maryland
Presentation transcript:

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 of V called edges.

- no arrows - no loops - can't have multiple edges joining vertices A simple graph

 Definition A multigraph G=(V, E) consists of a set V of vertices, a set E of edges, and a function f from E to {{u, v} | u, v  V, u  v}. The edges e 1 and e 2 are called multiple or parallel edges if f(e 1 ) = f(e 2 ).

A multigraph  No loop is allowed. Multiple edges are allowed.

 Definition A pseudograph G = (V, E) consists of a set V of vertices, a set E of edges, and a function f from E to {{u, v} | u, v  V}. An edge is a loop if f(e) = {u, v} for some v  V.

 Definition ◦ A directed graph (V, E) consists of a set of a set of vertices V and a set of edges E that are ordered pairs of elements of V.

 Loops, ordered pairs or the same element, are allowed.  Multiple edges in the same direction between two vertices are not allowed. A directed graph

 Definition ◦ A directed multigraph G = (V, E) consists of a set V of vertices, a set E of edges, and a function f from E to {(u, v) | u, v  V}. The edges e 1 and e 2 are multiple edges if f(e 1 ) = f(e 2 ).

Loops, ordered pairs or the same element, are allowed. Multiple edges in the same direction between two vertices are allowed. A directed multigraph

 Summary TypeEdgesMultiple edges allowed? Loops allowed? Simple graph UndirectedNo Multigraph Undirected YesNo PseudographUndirectedYes Directed graph DirectedNoYes Directed multigraph DirectedYes

 There will be an edge (a, b) from team a to team b, if team a beats team b.

Adjacent: Two vertices u and v in an undirected graph G are called adjacent (or neighbours) if {u, v} is an edge of G. If e = {u, v} the edge e is called incident with 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}. 15

a b c d e e1e1 e2e2 e3e3 e4e4 e5e5 e6e6 Vertex a is adjacent to b because there is an edge e 1 that connects vertices a and b. Edge e 4 is incident with vertices a and d. Edge e 4 connect vertices a and d. Edge e 6 connect vertices e and e.

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

18  What are the degrees of the vertices in the following graph? b a c fe d g deg( a ) = deg( b ) = deg( c ) = deg( d ) = deg( e ) = deg( f ) = deg( g ) = Vertex of degree zero is called isolated

19 Theorem: Suppose the vertices of graph G are v 1, v 2, …, v n, where n is a non-negative integer, then the total degree of G =deg(v 1 ) + deg(v 2 ) + …. + deg(v n ) = 2 (the number of edges of G).

 Total number of edges: 4  Total degree: = 8.  Handshaking theorem: 2 x 4 = 8.

21  How many edges are there in a graph with seven vertices each of degree four? The sum of the degrees of the vertices is 4x7 = e = 28 e = 14.

 Three methods 1.Adjacency lists 2.Adjacency matrices 3.Incidence matrices

 Adjacency lists b a c d e A simple graph UNABLE TO REPRESENT MULTIPLE-EDGES.

A directed graph

 Adjacency matrices Suppose that G=(V, E) is a simple graph where |V|=n. Suppose that the vertices of G are listed arbitrary as v 1,v 2,..., v n. The adjacency matrix A of G is a n×n zero-one matrix with 1 as its (i, j)th entry when v i and v j are adjacent, and 0 as its entry when they are not adjacent.

a b c d G Adjacency matrix for G

 Representing multigraph or pseudograph

a b c d e abcdeabcde Adjacency Matrix

 Incidence Matrices  Let G=(V, E) be an undirected graph. Suppose that v 1, v 2,..., v n are the vertices and e 1, e 2,..., e m are the edges G. The incidence matrix of G is a nx m matrix M=[m ij ], where

Incidence Matrix

 Definition  Let n be a nonnegative integer and G a directed multigraph. 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 f(e 1 )=(x 0, x 1 ), f(e 2 )=(x 1, x 2 ), f(e n )=(x n-1, x n ), where x 0 =u and x n =v.

 Definition  When there are non 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 simple if it does not contain the same edge more than once.

a, d, c, f, e is a simple path of length 4 since {a, d}, {d, c}, {c, f}, and {f, e} are all edges and no repeated edge. b, c, f, e, b is a circuit of length 4 since this path begins and ends at b. The path a, b, e, d, a, b is of length 5, is not simple since it contains the edge {a, b} twice. Is a, d, e, a, b a simple path?

Paths from v 0 to v 7 1. v 0 v 1 v 2 v 5 v 7 2. v 0 v 1 v 4 v 5 v 4 v 5 v 7 3. v 0 v 3 v 4 v 6 v 7 Which path(s) is (are) simple?

 Definition  An undirected graph is called connected if there is a path between every pair of distinct vertices of the graph. G is connected, whereas H is not.

 Theorem  There is a simple path between every pair of distinct vertices of a connected undirected graph.

 Definition A directed graph is strongly connected if there is a path from a to b and from b to a whenever a and b are vertices in the graph.  Definition A directed graph is weakly connected if there is a path between any two vertices in the underlying undirected graph.

G is strongly connected because there is a path between any two vertices in this directed graph. The graph H is not strongly connected. There is no directed path from a to b in this graph. H is weakly connected since there is a path between any two vertices in the underlying undirected graph of H.

 Questions  Can we travel along the edges of graph starting at a vertex and returning to it by traversing each edge of the graph exactly once?  Can we travel along the edges of a graph starting at a vertex and returning to it while visiting each vertex of the graph exactly once?

 Definition  An Euler circuit in a graph G is a simple circuit containing every edge of G.  An Euler path in G is a simple path containing every edge in G. Note: Both in Euler path and Euler circuit, each edge cannot be repeated more than once. If a graph has Euler circuit then it must has Euler path, the opposite could be false.

 Example

Theorem 1 A connected multigraph has an Euler circuit if and only if each of its vertices has even degree. Theorem 2 A connected multigraph has an Euler path but not an Euler circuit if and only if it has exactly two vertices of odd degree.

For graph G1, the degree for each vertex in this graph is even, hence this graph contain Euler circuit. For graph G2, the degree for vertex e, a are odd, so there is no Euler circuit. G1 G2

G1 contains exactly two vertices of odd degree, b and d. Hence it has an Euler path that must have b and d as its end points. E.g.: b, c, d, a, b, d. G2 also contains exactly two vertices of odd degree, d and b. One of the Euler path is b, a, g, b, c, g, f, c, f, e, d.

 Definition A path x 0, x 1,..., x n-1, x n in the graph G = (V, E) is called a Hamilton path if V={x 0, x 1,..., x n-1, x n } and x i  x j for 0  i  j  n  A circuit x 0, x 1,..., x n-1, x n, x 0 (with n > 1) in a graph G = (V,E) is called a Hamilton circuit ◦ if x 0, x 1,..., x n-1 Hamilton path.

Graph G1 has a Hamilton circuit: a, b, c, d, e, a. There is no Hamilton circuit in G2 because edge (a, b) will be always use twice. E.g.: d, c, b, a, b, d. G2 has Hamilton path, a, b, c, d.

A graph with a vertex of degree 1 cannot have a Hamilton circuit. If each vertex in a graph is adjacent to every other vertex there is always a Hamilton circuit.