Graphs CSE235 Graphs Introduction Types Classes Slides by Christopher M. Bourke Representations Instructor: Berthe Y. Choueiry Isomorphism Connectivity Euler & Hamiltonian Spring 2006 Computer Science & Engineering 235 Introduction to Discrete Mathematics Sections 8.1-8.5 of Rosen 1 / 56 cse235@cse.unl.edu
Introduction I Graphs CSE235 Introduction Graph theory was introduced in the 18th century by Leonhard Types Euler via the K¨ onigsberg bridge problem . Classes Representations In K¨ onigsberg (old Prussia), a river ran through town that Isomorphism created an island and then split off into two parts. Connectivity Seven bridges were built so that people could easily get around. Euler & Hamiltonian Euler wondered, is it possible to walk around K¨ onigsberg, crossing every bridge exactly once? 2 / 56
Introduction II Graphs CSE235 Introduction Types Classes Representations Isomorphism Connectivity Euler & Hamiltonian 3 / 56
Introduction III To solve this problem, we need to model it mathematically. Graphs Specifically, we can define a graph whose vertices are the land CSE235 areas and whose edges are the bridges. Introduction Types Classes Representations Isomorphism v 1 Connectivity Euler & b 4 b 0 b 1 Hamiltonian v 2 v 4 b 5 b 2 b 3 v 3 b 6 4 / 56
Introduction IV Graphs The question now becomes, does there exist a path in the CSE235 following graph such that every edge is traversed exactly once? Introduction Types v 1 Classes Representations b 4 b 0 b 1 Isomorphism Connectivity b 5 v 2 v 4 Euler & Hamiltonian b 6 b 2 b 3 v 3 5 / 56
Definitions I Graphs CSE235 Definition Introduction A simple graph G = ( V, E ) is a 2-tuple with Types Classes V = { v 1 , v 2 , . . . , v n } – a finite set of vertices. Representations E = V × V = { e 1 , e 2 , . . . , e m } – an unordered set of Isomorphism edges where each e i = ( v, v ′ ) is an unordered pair of Connectivity vertices, v, v ′ ∈ V . Euler & Hamiltonian Since V and E are sets, it makes sense to consider their cardinality. As is standard, | V | = n denotes the number of vertices in G and | E | = m denotes the number of edges in G . 6 / 56
Definitions II Graphs CSE235 A multigraph is a graph in which the edge set E is a multiset. Multiple distinct (or parallel ) edges can exist Introduction Types between vertices. Classes A pseudograph is a graph in which the edge set E can Representations have edges of the form ( v, v ) called loops Isomorphism A directed graph is one in which E contains ordered pairs. Connectivity The orientation of an edge ( v, v ′ ) is said to be “from v to Euler & Hamiltonian v ′ ”. A directed multigraph is a multigraph whose edges set consists of ordered pairs. 7 / 56
Definitions III Graphs CSE235 If we look at a graph as a relation then, among other things, Introduction Types Undirected graphs are symmetric . Classes Non-pseudographs are irreflexive . Representations Isomorphism Multigraphs have nonnegative integer entries in their Connectivity matrix; this corresponds to degrees of relatedness. Euler & Hamiltonian Other types of graphs can include labeled graphs (each edge has a uniquely identified label or weight), colored graphs (edges are colored) etc. 8 / 56
Terminology Adjacency Graphs CSE235 For now, we will concern ourselves with simple, undirected Introduction graphs. We now look at some more terminology. Types Classes Definition Representations Two vertices u, v in an undirected graph G = ( V, E ) are called Isomorphism adjacent (or neighbors ) if e = ( u, v ) ∈ E . Connectivity We say that e is incident with or incident on the vertices u and Euler & Hamiltonian v . Edge e is said to connect u and v . u and v are also called the endpoints of e . 9 / 56
Terminology Degree Graphs CSE235 Definition Introduction Types The degree of a vertex in an undirected graph G = ( V, E ) is Classes the number of edges incident with it. Representations The degree of a vertex v ∈ V is denoted Isomorphism Connectivity deg( v ) Euler & Hamiltonian In a multigraph, a loop contributes to the degree twice. A vertex of degree 0 is called isolated . 10 / 56
Terminology Handshake Theorem Graphs CSE235 Theorem Introduction Let G = ( V, E ) be an undirected graph. Then Types Classes � 2 | E | = deg( v ) Representations v ∈ V Isomorphism Connectivity The handshake lemma applies even in multi and pseudographs. Euler & Hamiltonian proof By definition, each e = ( v, v ′ ) will contribute 1 to the degree of each vertex, deg( v ) , deg( v ′ ) . If e = ( v, v ) is a loop then it contributes 2 to deg( v ) . Therefore, the total degree over all vertices will be twice the number of edges. 11 / 56
Terminology Handshake Lemma Graphs CSE235 Introduction Types Classes Corollary Representations An undirected graph has an even number of vertices of odd Isomorphism degree. Connectivity Euler & Hamiltonian 12 / 56
Terminology - Directed Graphs I Graphs CSE235 In a directed graph (digraph), G = ( V, E ) , we have analogous Introduction definitions. Types Classes Let e = ( u, v ) ∈ E . Representations Isomorphism u is adjacent to or incident on v . Connectivity v is adjacent from or incident from u . Euler & Hamiltonian u is the initial vertex . v is the terminal vertex . For a loop, these are the same. 13 / 56
Terminology - Directed Graphs II Graphs CSE235 We make a distinction between incoming and outgoing edges Introduction with respect to degree. Types Let v ∈ V . Classes Representations The in-degree of v is the number of edges incident on v Isomorphism Connectivity deg − ( v ) Euler & Hamiltonian The out-degree of v is the number of edges incident from v . deg + ( v ) 14 / 56
Terminology - Directed Graphs III Graphs CSE235 Every edge e = ( u, v ) contributes 1 to the out-degree of u and Introduction 1 to the in-degree of v . Thus, the sum over all vertices is the Types same. Classes Representations Theorem Isomorphism Let G = ( V, E ) be a directed graph. Then Connectivity Euler & Hamiltonian � � deg + ( v ) = | E | deg − ( v ) = v ∈ V v ∈ V 15 / 56
More Terminology I Graphs CSE235 A path in a graph is a sequence of vertices, Introduction Types v 1 v 2 · · · v k Classes Representations such that ( v i , v i +1 ) ∈ E for all i = 1 , . . . , k − 1 . Isomorphism Connectivity We can denote such a path by p : v 1 � v k . Euler & Hamiltonian The length of p is the number of edges in the path, | p | = k − 1 16 / 56
More Terminology II Graphs CSE235 A cycle in a graph is a path that begins and ends at the same Introduction vertex. Types v 1 v 2 · · · v k v 1 Classes Representations Cycles are also called circuits . Isomorphism Connectivity We define paths and cycles for directed graphs analogously. Euler & Hamiltonian A path or cycle is called simple if no vertex is traversed more than once. From now on we will only consider simple paths and cycles. 17 / 56
Classes Of Graphs Graphs CSE235 Complete Graphs – Denoted K n are simple graphs with n Introduction vertices where every possible edge is present. Types Classes Cycle Graphs – Denoted C n are simply cycles on n Bipartite Graphs vertices. Representations Wheels – Denoted W n are cycle graphs (on n vertices) Isomorphism with an additional vertex connected to all other vertices. Connectivity Euler & n -cubes – Denoted Q n are graphs with 2 n vertices Hamiltonian corresponding to each bit string of length n . Edges connect vertices whose bit strings differ by a single bit. Grid Graphs – finite graphs on the N × N grid. 18 / 56
Bipartite Graphs Graphs CSE235 Introduction Types Definition Classes A graph is called bipartite if its vertex set V can be partitioned Bipartite Graphs Representations into two disjoint subsets L, R such that no pair of vertices in L Isomorphism (or R ) is connected. Connectivity Euler & Hamiltonian We often use G = ( L, R, E ) to denote a bipartite graph. 19 / 56
Bipartite Graphs Graphs CSE235 Introduction Theorem Types A graph is bipartite if and only if it contains no odd-length Classes Bipartite Graphs cycles. Representations Isomorphism Another way to look at this theorem is as follows. A graph G Connectivity can be colored (here, we color vertices) by at most 2 colors Euler & Hamiltonian such that no two adjacent vertices have the same color if and only if G is bipartite. 20 / 56
Bipartite Graphs Graphs CSE235 Introduction Types A bipartite graph is complete if every u ∈ L is connected to Classes every v ∈ R . We denote a complete bipartite graph as Bipartite Graphs Representations K n 1 ,n 2 Isomorphism Connectivity which means that | L | = n 1 and | R | = n 2 . Euler & Hamiltonian Examples? 21 / 56
Decomposing & Composing Graphs I Graphs CSE235 Introduction We can (partially) decompose graphs by considering subgraphs . Types Definition Classes Bipartite Graphs A subgraph of a graph G = ( V, E ) is a graph H = ( V ′ , E ′ ) Representations where Isomorphism V ′ ⊆ V and Connectivity Euler & E ′ ⊆ E . Hamiltonian Subgraphs are simply part(s) of the original graph. 22 / 56
Recommend
More recommend