Rosen 5th ed., ch. 8.1~8.5 ~44 slides (more later), ~3 lectures

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,
22C:19 Discrete Math Graphs Fall 2010 Sukumar Ghosh.
22C:19 Discrete Math Graphs Fall 2014 Sukumar Ghosh.
Applied Discrete Mathematics Week 12: Trees
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:
GRAPH Learning Outcomes Students should be able to:
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 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 월 ? 교환 학생 프로그램 영어 점수 미리미리 준비하세요.
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)
1 CS104 : Discrete Structures Chapter V Graph Theory.
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.
Discrete Structures Graphs 1 (Ch. 10) Dr. Muhammad Humayoun Assistant Professor COMSATS Institute of Computer Science, Lahore.
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
Graph Theory Unit: 4.
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 )
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
Applied Discrete Mathematics Week 14: Trees
Graphs: Definitions and Basic Properties
Discrete Mathematics Graphs.
Chapter 9 (Part 2): Graphs
Let us switch to a new topic:
Lecture 5.2: Special Graphs and Matrix Representation
Applied Discrete Mathematics Week 13: Graphs
Special Graphs By: Sandeep Tuli Astt. Prof. CSE.
Copyright © Zeph Grunschlag,
Graphs Hubert Chan (Chapter 9) [O1 Abstract Concepts]
COT 3100, Spring 2001 Applications of Discrete Structures
Chapters 8.1 and 8.2 Based on slides by Y. Peng University of Maryland
Representing Graphs and
CS 250, Discrete Structures, Fall 2015
Graph theory Definitions Trees, cycles, directed graphs.
Agenda Lecture Content: Introduction to Graph Path and Cycle
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 10 Graphs Slides are adopted from “Discrete.
Discrete Mathematics and its Applications
Discrete Mathematics and its Applications
Graphs Chapters 10.1 and 10.2 Based on slides by Y. Peng University of Maryland.
Graphs.
Graphs.
Based on slides by Y. Peng University of Maryland
Chapter 13 (Part 1): Graphs
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
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
Graph & Trees Chapters 10-11
Discrete Mathematics and its Applications
CS100: Discrete structures
Discrete Math II Howon Kim
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
Discrete Mathematics and its Applications
Let us switch to a new topic:
Lecture 10: Graphs Graph Terminology Special Types of Graphs
Applied Discrete Mathematics Week 13: Graphs
Based on slides by Y. Peng University of Maryland
Agenda Review Lecture Content: Shortest Path Algorithm
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
Presentation transcript:

Rosen 5th ed., ch. 8.1~8.5 ~44 slides (more later), ~3 lectures Module #19: Graph Theory Rosen 5th ed., ch. 8.1~8.5 ~44 slides (more later), ~3 lectures 2019/2/19 (c)2001-2002, Michael P. Frank

What are Graphs? Not Our Meaning General meaning in everyday math: A plot or chart of numerical data using a coordinate system. Technical meaning in discrete mathematics: A particular class of discrete structures (to be defined) that is useful for representing relations and has a convenient webby-looking graphical representation. Not Our Meaning 2019/2/19 (c)2001-2002, Michael P. Frank

Applications of Graphs Potentially anything (graphs can represent relations, relations can describe the extension of any predicate). Apps. in networking, scheduling, flow optimization, circuit design, path planning. Geneology analysis, computer game-playing, program compilation, object-oriented design, … 2019/2/19 (c)2001-2002, Michael P. Frank

Visual Representation of a Simple Graph Simple Graphs Correspond to symmetric binary relations R. A simple graph G=(V,E) consists of: a set V of vertices or nodes (V corresponds to the universe of the relation R), a set E of edges / arcs / links: unordered pairs of [distinct?] elements u,v  V, such that uRv. Visual Representation of a Simple Graph 2019/2/19 (c)2001-2002, Michael P. Frank

Example of a Simple Graph Let V be the set of states in the far-southeastern U.S.: V={FL, GA, AL, MS, LA, SC, TN, NC} Let E={{u,v}|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}} NC TN MS AL SC GA LA FL 2019/2/19 (c)2001-2002, Michael P. Frank

Multigraphs Like simple graphs, but there may be more than one edge connecting two given nodes. A multigraph G=(V, E, f ) consists of a set V of vertices, a set E of edges (as primitive objects), and a function f:E{{u,v}|u,vV  uv}. E.g., nodes are cities, edges are segments of major highways. Parallel edges 2019/2/19 (c)2001-2002, Michael P. Frank

Pseudographs Like a multigraph, but edges connecting a node to itself are allowed. A pseudograph G=(V, E, f ) where f:E{{u,v}|u,vV}. Edge eE is a loop if f(e)={u,u}={u}. E.g., nodes are campsites in a state park, edges are hiking trails through the woods. 2019/2/19 (c)2001-2002, Michael P. Frank

Directed Graphs Correspond to arbitrary binary relations R, which need not be symmetric. A directed graph (V,E) consists of a set of vertices V and a binary relation E on V. E.g.: V = people, E={(x,y) | x loves y} 2019/2/19 (c)2001-2002, Michael P. Frank

Directed Multigraphs Like directed graphs, but there may be more than one arc from a node to another. A directed multigraph G=(V, E, f ) consists of a set V of vertices, a set E of edges, and a function f:EVV. E.g., V=web pages, E=hyperlinks. The WWW is a directed multigraph... 2019/2/19 (c)2001-2002, Michael P. Frank

Types of Graphs: Summary Summary of the book’s definitions. Keep in mind this terminology is not fully standardized... 2019/2/19 (c)2001-2002, Michael P. Frank

§8.2: Graph Terminology Adjacent, connects, endpoints, degree, initial, terminal, in-degree, out-degree, complete, cycles, wheels, n-cubes, bipartite, subgraph, union. 2019/2/19 (c)2001-2002, Michael P. Frank

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. 2019/2/19 (c)2001-2002, Michael P. Frank

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. (Except that any self-loops are counted twice.) A vertex with degree 0 is isolated. A vertex of degree 1 is pendant. 2019/2/19 (c)2001-2002, Michael P. Frank

Handshaking Theorem Let G be an undirected (simple, multi-, or pseudo-) graph with vertex set V and edge set E. Then Corollary: Any undirected graph has an even number of vertices of odd degree. 2019/2/19 (c)2001-2002, Michael P. Frank

Directed Adjacency Let G be a directed (possibly multi-) graph, and let e be an edge of G that is (or maps to) (u,v). Then we say: u is adjacent to v, v is adjacent from u e comes from u, e goes to v. e connects u to v, e goes from u to v the initial vertex of e is u the terminal vertex of e is v 2019/2/19 (c)2001-2002, Michael P. Frank

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. 2019/2/19 (c)2001-2002, Michael P. Frank

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. 2019/2/19 (c)2001-2002, Michael P. Frank

Special Graph Structures Special cases of undirected graph structures: Complete graphs Kn Cycles Cn Wheels Wn n-Cubes Qn Bipartite graphs Complete bipartite graphs Km,n 2019/2/19 (c)2001-2002, Michael P. Frank

Complete Graphs For any nN, a complete graph on n vertices, Kn, is a simple graph with n nodes in which every node is adjacent to every other node: u,vV: uv{u,v}E. K1 K4 K2 K3 K5 K6 Note that Kn has edges. 2019/2/19 (c)2001-2002, Michael P. Frank

How many edges are there in Cn? Cycles For any n3, a cycle on n vertices, Cn, is a simple graph where V={v1,v2,… ,vn} and E={{v1,v2},{v2,v3},…,{vn1,vn},{vn,v1}}. C3 C4 C5 C6 C8 C7 How many edges are there in Cn? 2019/2/19 (c)2001-2002, Michael P. Frank

How many edges are there in Wn? Wheels For any n3, a wheel Wn, is a simple graph obtained by taking the cycle Cn and adding one extra vertex vhub and n extra edges {{vhub,v1}, {vhub,v2},…,{vhub,vn}}. W3 W4 W5 W6 W8 W7 How many edges are there in Wn? 2019/2/19 (c)2001-2002, Michael P. Frank

Number of vertices: 2n. Number of edges:Exercise to try! n-cubes (hypercubes) For any nN, the hypercube Qn is a simple graph consisting of two copies of Qn-1 connected together at corresponding nodes. Q0 has 1 node. Q0 Q1 Q2 Q4 Q3 Number of vertices: 2n. Number of edges:Exercise to try! 2019/2/19 (c)2001-2002, Michael P. Frank

n-cubes (hypercubes) For any nN, the hypercube Qn can be defined recursively as follows: Q0={{v0},} (one node and no edges) For any nN, if Qn=(V,E), where V={v1,…,va} and E={e1,…,eb}, then Qn+1=(V{v1´,…,va´}, E{e1´,…,eb´}{{v1,v1´},{v2,v2´},…, {va,va´}}) where v1´,…,va´ are new vertices, and where if ei={vj,vk} then ei´={vj´,vk´}. 2019/2/19 (c)2001-2002, Michael P. Frank

Bipartite Graphs A simple graph G=(V, E) is called bipartite if V can be partitioned into V1 and V2 such that every edge connects a vertex in V1 and a vertex in V2. 2019/2/19 (c)2001-2002, Michael P. Frank

Some Applications LAN(Local Area Network) Star (Hub, Dumb Switch) Ring(Token Ring) Hybrid(?) Interconnection Networks for Parallel Computation Linear array, need number of hops sometimes Mesh HyperCube 2019/2/19 (c)2001-2002, Michael P. Frank

Subgraphs A subgraph of a graph G=(V,E) is a graph H=(W,F) where WV and FE. G H 2019/2/19 (c)2001-2002, Michael P. Frank

Graph Unions The union G1G2 of two simple graphs G1=(V1, E1) and G2=(V2,E2) is the simple graph (V1V2, E1E2). 2019/2/19 (c)2001-2002, Michael P. Frank

§8.3: Graph Representations & Isomorphism Adjacency lists. Adjacency matrices. Incidence matrices. Graph isomorphism: Two graphs are isomorphic iff they are identical except for their node names. 2019/2/19 (c)2001-2002, Michael P. Frank

Adjacency Lists A table with 1 row per vertex, listing its adjacent vertices. b a d c e f 2019/2/19 (c)2001-2002, Michael P. Frank

Directed Adjacency Lists 1 row per node, listing the terminal nodes of each edge incident from that node. 2019/2/19 (c)2001-2002, Michael P. Frank

Adjacency Matrices Matrix A=[aij], where aij is 1 if {vi, vj} is an edge of G, 0 otherwise. 2019/2/19 (c)2001-2002, Michael P. Frank

Graph Isomorphism Formal definition: Simple graphs G1=(V1, E1) and G2=(V2, E2) are isomorphic if there is a bijection f:V1V2 such that a,bV1, a and b are adjacent in G1 iff f(a) and f(b) are adjacent in G2. f is the “renaming” function that makes the two graphs identical. Definition can easily be extended to other types of graphs. 2019/2/19 (c)2001-2002, Michael P. Frank

Determine Isomorphism It is often difficult! Need O(n!) . However, G1=(V1, E1) to be isomorphic to G2=(V2, E2): |V1|=|V2|, |E1|=|E2|. i.e. they must be invariant. 2019/2/19 (c)2001-2002, Michael P. Frank

Isomorphism Example If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. d b a b a d c e e c f f 2019/2/19 (c)2001-2002, Michael P. Frank

Are These Isomorphic? If isomorphic, label the 2nd graph to show the isomorphism, else identify difference. * Same # of vertices a b * Same # of edges * Different # of verts of degree 2! (1 vs 3) d e c 2019/2/19 (c)2001-2002, Michael P. Frank

§8.4: Connectivity In an undirected graph, a path of length n from u to v is a sequence of adjacent edges going from vertex u to vertex v. A path is a circuit if u=v and n>0. A path traverses the vertices along it. A path is simple if it contains no edge more than once. 2019/2/19 (c)2001-2002, Michael P. Frank

Paths in Directed Graphs Same as in undirected graphs, but the path must go in the direction of the arrows. 2019/2/19 (c)2001-2002, Michael P. Frank

Connectedness An undirected graph is connected iff there is a path between every pair of distinct vertices in the graph. Theorem1: There is a simple path between any pair of vertices in a connected undirected graph. Connected components: disjoint connected subgraphs. The removal of a cut vertex or cut edge separates 1 connected component into 2 if removed. 2019/2/19 (c)2001-2002, Michael P. Frank

Directed Connectedness A directed graph is strongly connected iff there is a directed path from a to b and from b to a for any two vertices a and b. It is weakly connected if and only if the underlying undirected graph (i.e., with edge directions removed) is connected. Any strongly connected graph is weakly connected. 2019/2/19 (c)2001-2002, Michael P. Frank

Paths & Isomorphism Note that connectedness, and the existence of a circuit or simple circuit of length k are graph invariants with respect to isomorphism. 2019/2/19 (c)2001-2002, Michael P. Frank

Counting Paths w Adjacency Matrices Let A be the adjacency matrix of graph G. The number of paths of length k from vi to vj is equal to (Ak)i,j. (The notation (M)i,j denotes mi,j where [mi,j] = M.) 2019/2/19 (c)2001-2002, Michael P. Frank

§8.5: Euler & Hamilton Paths 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 of G. A Hamilton circuit is a circuit that traverses each vertex in G exactly once. A Hamilton path is a path that traverses each vertex in G exactly once. 2019/2/19 (c)2001-2002, Michael P. Frank

Some Useful Theorems A connected multigraph has an Euler circuit iff each vertex has even degree. A connected multigraph has an Euler path (but not an Euler circuit) iff it has exactly 2 vertices of odd degree. If (but not only if) G is connected, simple, has n3 vertices, and v deg(v)n/2, then G has a Hamilton circuit. 2019/2/19 (c)2001-2002, Michael P. Frank

§ 8.6:Shortest-Path Problem A weighted graph can be used to model an airline system or a computer network. 2 problems to be discussed: shortest-path problem and traveling salesman problem. Algorithm 1 (Dijstra’s Algorithm) finds the length of a shortest path between two vertices in a connected simple undirected weighted graph. 2019/2/19 (c)2001-2002, Michael P. Frank

Dijkstra’s Algorithm G has vertices v0,v1,…vn and weights w(vi,vj) Procedure Dijkstra(G: weighted connected simple graph) for i:=1 to n L(vi):=∞ ; L(v0)=0 ; S:=Φ; While Begin u:= a vertex not in S with L(u) minimal; S:=S∪{u}; for all vertices v not in S if L(u)+w(u,v)<L(v) then L(v):=L(u)+w(u,v) end G has vertices v0,v1,…vn and weights w(vi,vj) S: set of selected vertices on shortest path 2019/2/19 (c)2001-2002, Michael P. Frank

§ 8.6:Shortest-Path Problem The traveling salesman problem asks for the circuit of minimum total weight in a weighted, complete, undirected graph that visits each vertex exactly once and returns to its starting point. It’s a NP-complete problem Many approximation algorithm are devised. 2019/2/19 (c)2001-2002, Michael P. Frank

§ 8.7:Planar Graph A graph is called planar if it can be drawn in the plane without any edges crossing. K4,Q3 are planar while K3,3 is not planar. Euler’s formula: Let G be a connected planar graph with e edges and v vertices. Let r be the number of regions in a planar representation of G. r=e-v+2. 2019/2/19 (c)2001-2002, Michael P. Frank

Proof of Euler’s Formula (1) Basis: Since e1=1, v1=2, r1=1, r1=e1-v1+2 is true. Inductive Step: Assume rn=en-vn+2 is true. Let {an+1,bn+1} be the edge that is added to Gn to obtain Gn+1. Case I: Both an+1 and bn+1 are already in Gn .(pp.607Fig10(a)) an+1 and bn+1 must be on the boundary of a common region R, or else it would be impossible to add the edges {an+1,bn+1} . The addition of this new edge splits R into 2 regions. Consequently, rn+1= rn+1, en+1= en+1, vn+1= vn . Thus, rn+1=en+1-vn+1+2. 2019/2/19 (c)2001-2002, Michael P. Frank

Proof of Euler’s Formula (2) Case II: an+1 is in Gn and bn+1 is not. (Fig10(b)) The addition of {an+1,bn+1} does not produce new regions, since bn+1 must be in a region that has an+1 on its boundary. Consequently, rn+1= rn, en+1= en+1, vn+1= vn+1 . Thus, rn+1=en+1-vn+1+2. Case III: an+1 and bn+1 are not in Gn . Impossible. (Because Gn+1 must be connected.) 2019/2/19 (c)2001-2002, Michael P. Frank

Other Theorems Corollary 1 If G is a connected planar simple graph with e edges and v vertices where v  3, then e  3v-6. Corollary 2 If G is a connected planar simple graph then G has a vertex of degree not exceeding five. Proof: 2019/2/19 (c)2001-2002, Michael P. Frank

Other Theorems Corollary 3 If a connected planar simple graph has e edges and v vertices with v3 and no circuits of length three, then e  2v-4. 2019/2/19 (c)2001-2002, Michael P. Frank

Kuratowski’s Theorem Theorem 2 A graph is nonplanar if and only if it contains a subgraph homomorphic to K3,3 or K5. 2019/2/19 (c)2001-2002, Michael P. Frank