Chapter 9 Graphs.

Slides:



Advertisements
Similar presentations
CSE 211 Discrete Mathematics
Advertisements

CSE 211 Discrete Mathematics
Trees Chapter 11.
Based on slides by Y. Peng University of Maryland
Analysis of Algorithms CS 477/677
Chapter 8 Topics in Graph Theory
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.
22C:19 Discrete Math Graphs Fall 2014 Sukumar Ghosh.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 – CHAPTER 4 GRAPHS 1.
Graph-02.
Chapter 10: Trees. Definition A tree is a connected undirected acyclic (with no cycle) simple graph A collection of trees is called forest.
Chapter 9 Graphs.
1 Slides based on those of Kenneth H. Rosen Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus Graphs.
1 Chapter 10 Trees. Tree Definition 1. A tree is a connected undirected graph with no simple circuits. Theorem 1. An undirected graph is a tree if and.
Last time: terminology reminder w Simple graph Vertex = node Edge Degree Weight Neighbours Complete Dual Bipartite Planar Cycle Tree Path Circuit Components.
1 Representing Graphs. 2 Adjacency Matrix Suppose we have a graph G with n nodes. The adjacency matrix is the n x n matrix A=[a ij ] with: a ij = 1 if.
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
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,
KNURE, Software department, Ph , N.V. Bilous Faculty of computer sciences Software department, KNURE Discrete.
Discrete Mathematics Lecture 9 Alexander Bukharovich New York University.
Let us switch to a new topic:
22C:19 Discrete Math Graphs Spring 2014 Sukumar Ghosh.
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,
Graph Theory Topics to be covered:
1 Elements of Graph Theory Quick review of Chapters 9.1… 9.5, 9.7 (studied in Mt1348/2008) = all basic concepts must be known New topics we will mostly.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 9 (Part 2): Graphs  Graph Terminology (9.2)
Week 11 - Wednesday.  What did we talk about last time?  Graphs  Euler paths and tours.
Tree A connected graph that contains no simple circuits is called a tree. Because a tree cannot have a simple circuit, a tree cannot contain multiple.
1 CS104 : Discrete Structures Chapter V Graph Theory.
CS 200 Algorithms and Data Structures
Based on slides by Y. Peng University of Maryland
Module #19: Graph Theory: part II Rosen 5 th ed., chs. 8-9.
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.
Data Structures & Algorithms Graphs
Agenda Review: –Planar Graphs Lecture Content:  Concepts of Trees  Spanning Trees  Binary Trees Exercise.
September1999 CMSC 203 / 0201 Fall 2002 Week #13 – 18/20/22 November 2002 Prof. Marie desJardins.
Unit – V Graph theory. Representation of Graphs Graph G (V, E,  ) V Set of vertices ESet of edges  Function that assigns vertices {v, w} to each edge.
An Introduction to Graph Theory
Graph Theory and Applications
Graphs and 2-Way Bounding Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois 1 /File:7_bridgesID.png.
Graphs 9.1 Graphs and Graph Models أ. زينب آل كاظم 1.
Graph theory and networks. Basic definitions  A graph consists of points called vertices (or nodes) and lines called edges (or arcs). Each edge joins.
And before you really hate (mathematical) relations and begin to break your (social) relations, let’s switch to a new topic: Graphs Discrete Structures.
MAT 2720 Discrete Mathematics Section 8.2 Paths and Cycles
Basic properties Continuation
Graph Theory Unit: 4.
CHAPTER 11 TREES INTRODUCTION TO TREES ► A tree is a connected undirected graph with no simple circuit. ► An undirected graph is a tree if and only.
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.
رياضيات متقطعة لعلوم الحاسب MATH 226. Chapter 10.
Section10.1: Introduction to Trees
Chapter Chapter Summary Graphs and Graph Models Graph Terminology and Special Types of Graphs Representing Graphs and Graph Isomorphism Connectivity.
Lecture 19: CONNECTIVITY Sections
Graph Graphs and graph theory can be used to model:
Graphs Hubert Chan (Chapter 9) [O1 Abstract Concepts]
Graph theory Definitions Trees, cycles, directed graphs.
Introduction to Trees Section 11.1.
Advanced Algorithms Analysis and Design
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 10 Trees Slides are adopted from “Discrete.
Graph & Trees Chapters 10-11
Trees 11.1 Introduction to Trees Dr. Halimah Alshehri.
Euler and Hamilton Paths
Applied Discrete Mathematics Week 13: Graphs
Presentation transcript:

Chapter 9 Graphs

Sec. 9.2: Terminology Let G=(V, E) be an undirected graph & e={u,v} be an edge, then u and v are adjacent e is incident to u and v u and v are connected u and v are endpoints of e

Definition Degree of a vertex v in an undirected graph G is denoted by deg(v) and is defined to be the number of edges incident to it where a loop contributes twice to the degree.

Definition If deg(v) =0 then v is called isolated If deg(v)=1 then v is called pendant

The Hand Shaking Theorem Let G be an undirected graph (simple, multi, or pseudo) with e edges. Then The sum of all degrees = 2 e  deg(v) = 2 e v Notice that 2e is even number

Theorem Any undirected graph has an even number of vertices of odd degree Because the sum of all vertices of even degrees is even The sum of all degrees is even

Definition Let G be a directed graph & e=(u,v) be an edge, then u is adjacent to v v is adjacent from u u is initial vertex of e v is terminal (end) vertex of e

Definition In-deg(v) = deg-(v) = # of edges with v as terminal vertex Out-deg(v) = deg+(v) = # of edges with v as initial vertex

Theorem Let G be a directed graph, then The sum of all in-degrees = the sum of all out-degrees = total number of edges

Special graphs Complete graph on n vertices Kn: is a simple graph with all of the C(n,2) edges Cycle Cn , n  3 Wheel Wn , n  3 n-Cubes Qn , n  1

Special Graphs Graph Vertices Edges Degree Kn n C(n,2) n-1 Cn 2 Wn n+1 3 and n Qn n2n-1

Bipartite Graph A simple graph G=(V,E) is a bipartite if V= V1  V2 and V1  V2 =  such that no edge in E connects two vertices V1 in or two vertices in V2 , Note that Cn is bipartite iff n is even

Complete Bipartite Graph Km,n is a complete bipartite iff |V1 |=m and |V2|=n and every vertex in V1 is connected to every vertex in V2 and vice versa.

Sec 9.3: Graphs Representations

Sec 8.3: Graphs Representations There are two ways to represent graphs Adjacency Lists: each vertex has a linked list that contains vertices adjacent to it. Adjacency Matrix: which is defined as follows

aij = 1, if {vi, vj} E, and 0 otherwise. Adjacency Matrix For any simple graph G, we have an adjacency matrix AG =[ aij ], where aij = 1, if {vi, vj} E, and 0 otherwise. Notice that AG is symmetric if G is simple and for directed graphs it may not be. AG is called sparse if it has few 1s.

Adjacency Matrix For multigraphs or pseudographs AG can be represented by aij = k, if there are k edges between vi and vj.

Isomorphism

{a,b}  E then {f(a), f(b)}  E. Isomorphism Two graphs G1 & G2 are isomorphic iff there is a bijective function f :V1 V2 such that whenever {a,b}  E then {f(a), f(b)}  E. This means that G1 can be redrawn to get G2 with the same number of vertices, edges and degrees. See examples in textbook.

Isomorphism There are some graphical properties that are invariant (preserved) under isomorphism, e.g. # of vertices # of edges Degrees Cycles Euler cycles Hamilton cycles

Definitions A subgraph of G =(V, E) is a graph H=(U,F) such that U  V and F  E. A graph is called regular iff every vertex has the same degree. A graph is called n-regular iff every vertex has deg=n.

Sec. 9.4: Connectivity

Definitons A path is sequence of edges {a,b}, {b,c}, {c,d}, {d,e}, ... The length of a path e1, e2, e3, e4, .. en is the number of edges in the path =n. A path is a circuit (cycle) when it begins and ends with the same vertex and n>0. The path is said to passes through the vertices a, b, c, .. Or traverses the edges e1, e2, e3, e4, .. en

Definition A path is simple if it doesn’t contain the same edge more than once. An undirected graph is connected iff there is a simple path between any two vertices. A directed graph is strongly connected iff there is a 2-way path between any two vertices. A directed graph is weakly connected iff there is a path between any two vertices inits underlying undirected graph.

Definition A cut vertex in a connected graph is a vertex whose removal produces unconnected graph A cut edge (bridge) in a connected graph is an edge whose removal produces unconnected graph

Definitions The connected components in any graph are the maximum connected subgraphs The strongly connected components in any directed graph are the maximum strongly connected subgraphs

Sec. 9.5: Euler and Hamilton Paths and Circuits

Definitions Euler path in a graph G is a simple path containing every edge in G. Start from a vertex & walk on every edge exactly once but you don’t have to return back to the same vertex Euler circuit in a graph G is a simple circuit containing every edge in G. Start from a vertex & walk on every edge exactly once and return back to the same vertex.

Theorem A connected multigraph has an Euler circuit iff every vertex has an even degree. A connected multigraph has an Euler path but not an Euler circuit iff there exists exactly two vertices of odd degrees and the others are even degrees.

Definition A Hamilton path in G is a path that visits every vertex exactly once A Hamilton circuit in G is a circuit that visits every vertex exactly once Note that every Kn has Hamilton Circuit because it has Cn

Remark Some graphs could have Euler path but no circuits and same for Hamiltonian.

Sec 9.7: Planar graphs

Definition A graph is called planar if it can be drawn in the plane without any edge crossing. Any planar graph split the plane into regions. E.g., K4 and Q3 are planar

Euler Formula Let G be any connected simple planar graph. Then the number of regions r = |E| - |V| +2

Sec. 9.8: Graph Coloring

Problem Color a map of regions with common borders such that no two neighbor regions have the same color. Maps can be modeled by a graph called the dual graph where Vertices represent regions Edges represent common borders

Definition A coloring of a simple graph is an assignment of colors of vertices of G such that adjacent vertices are colored with different colors. The chromatic number of a graph G is the least number of colors needed to color the graph correctly.

The 4 colors Theorem The chromatic number of a planar graph  4. Recall that a graph is called planar if it can be drawn in the plane without any edge crossing.

Examples (Kn) = n (Cn) = 2 if n is even and 3 otherwise (Wn) = 3 if n is even and 4 otherwise

Chapter 10: Trees

Definition A tree is a connected undirected acyclic (with no cycle) simple graph A collection of trees is called forest.

Theorem An undirected graph is a tree iff there is a unique simple path between any two vertices.

Definition A rooted tree is a tree in which one vertex is specified as the root & every edge is drawn away from the root

Definition root parent vertex children

Definition Root: a vertex with no parent Leaf: a vertex with no children Internal node: vertex with children Descendants: all children and children of children Ancestors: parent and parents of parents Siblings: vertices with the same parent

Definition An m-ary tree is a rooted tree where the number of children of any internal vertex  m A full m-ary tree is an m-ary tree where the number of children of any internal vertex = m if m=2, we call it binary tree

Definition In an ordered rooted tree the children are ordered. For example, in an ordered binary tree, a vertex may have left child and right child

Properties Number of edges in a tree of size n = n-1 Any full m-ary tree with i internal vertices has m i + 1 vertices

Properties A full m-ary tree with n vertices has i =(n-1)/m internal and l = ((m-1)n+1)/m leaves i internal has n=mi+1 vertices and l= (m-1)i+1 leaves l leaves has n=(ml -1)/(m-1) vertices and i =(l-1)/(m-1) internal