CS 311 Discrete Math for Computer Science Dr. William C. Bulko. Graphs

Similar documents
Graphs. Introduction To Graphs: Exercises. Definitions:

GRAPHS, GRAPH MODELS, GRAPH TERMINOLOGY, AND SPECIAL TYPES OF GRAPHS

Discrete Mathematics (2009 Spring) Graphs (Chapter 9, 5 hours)

Basics of Graph Theory

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

(5.2) 151 Math Exercises. Graph Terminology and Special Types of Graphs. Malek Zein AL-Abidin

Graph Theory. Part of Texas Counties.

Graphs. Pseudograph: multiple edges and loops allowed

DEFINITION OF GRAPH GRAPH THEORY GRAPHS ACCORDING TO THEIR VERTICES AND EDGES EXAMPLE GRAPHS ACCORDING TO THEIR VERTICES AND EDGES

Elements of Graph Theory

v V Question: How many edges are there in a graph with 10 vertices each of degree 6?

Varying Applications (examples)

Introduction III. Graphs. Motivations I. Introduction IV

CS 441 Discrete Mathematics for CS Lecture 26. Graphs. CS 441 Discrete mathematics for CS. Final exam

1. a graph G = (V (G), E(G)) consists of a set V (G) of vertices, and a set E(G) of edges (edges are pairs of elements of V (G))

UNDIRECTED GRAPH: a set of vertices and a set of undirected edges each of which is associated with a set of one or two of these vertices.

Chapter 1 Graph Theory

Introduction to Graphs

Characterizing Graphs (3) Characterizing Graphs (1) Characterizing Graphs (2) Characterizing Graphs (4)

Math.3336: Discrete Mathematics. Chapter 10 Graph Theory

DS UNIT 4. Matoshri College of Engineering and Research Center Nasik Department of Computer Engineering Discrete Structutre UNIT - IV

Key Graph Theory Theorems

Graphs. The ultimate data structure. graphs 1

Graph and Digraph Glossary

CPCS Discrete Structures 1

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. An Introduction to Graph Theory

Assignment 4 Solutions of graph problems

CS200: Graphs. Prichard Ch. 14 Rosen Ch. 10. CS200 - Graphs 1

Discrete mathematics II. - Graphs

Planar Graph (7A) Young Won Lim 6/20/18

Section 8.2 Graph Terminology. Undirected Graphs. Definition: Two vertices u, v in V are adjacent or neighbors if there is an edge e between u and v.

CHAPTER 2. Graphs. 1. Introduction to Graphs and Graph Isomorphism

Algorithms. Graphs. Algorithms

Foundations of Discrete Mathematics

Algorithms: Graphs. Amotz Bar-Noy. Spring 2012 CUNY. Amotz Bar-Noy (CUNY) Graphs Spring / 95

MATH 350 GRAPH THEORY & COMBINATORICS. Contents

Adjacent: Two distinct vertices u, v are adjacent if there is an edge with ends u, v. In this case we let uv denote such an edge.

Planar graphs. Chapter 8

CS6702 GRAPH THEORY AND APPLICATIONS 2 MARKS QUESTIONS AND ANSWERS

Introduction to Graph Theory

Graph Theory CS/Math231 Discrete Mathematics Spring2015

Majority and Friendship Paradoxes

Graphs. The ultimate data structure. graphs 1

Ma/CS 6b Class 5: Graph Connectivity

BIL694-Lecture 1: Introduction to Graphs

CMSC 380. Graph Terminology and Representation

Number Theory and Graph Theory

Fundamental Properties of Graphs

Discrete Wiskunde II. Lecture 6: Planar Graphs

Ordinary Differential Equation (ODE)

Assignments are handed in on Tuesdays in even weeks. Deadlines are:

Graph (1A) Young Won Lim 4/19/18

Lecture 3: Recap. Administrivia. Graph theory: Historical Motivation. COMP9020 Lecture 4 Session 2, 2017 Graphs and Trees

MATH 363 Final Wednesday, April 28. Final exam. You may use lemmas and theorems that were proven in class and on assignments unless stated otherwise.

Chapter 6 GRAPH COLORING

Chapter 3: Paths and Cycles

4. (a) Draw the Petersen graph. (b) Use Kuratowski s teorem to prove that the Petersen graph is non-planar.

Brief History. Graph Theory. What is a graph? Types of graphs Directed graph: a graph that has edges with specific directions

Math 776 Graph Theory Lecture Note 1 Basic concepts

Chapter 2 Graphs. 2.1 Definition of Graphs

Graph Overview (1A) Young Won Lim 5/9/18

Graph Theory S 1 I 2 I 1 S 2 I 1 I 2

GRAPH THEORY and APPLICATIONS. Planar Graphs

Planar Graph (7A) Young Won Lim 5/21/18

Part II. Graph Theory. Year

INTRODUCTION TO GRAPH THEORY. 1. Definitions

Assignment 1 Introduction to Graph Theory CO342

Discrete Math For Computing II

Combinatorics Summary Sheet for Exam 1 Material 2019

Discrete Structures CISC 2315 FALL Graphs & Trees

Worksheet for the Final Exam - Part I. Graphs

Varying Applications (examples)

Math 778S Spectral Graph Theory Handout #2: Basic graph theory

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI

Math 443/543 Graph Theory Notes

Planarity: dual graphs

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI

WUCT121. Discrete Mathematics. Graphs

CSC Intro to Intelligent Robotics, Spring Graphs

List of Theorems. Mat 416, Introduction to Graph Theory. Theorem 1 The numbers R(p, q) exist and for p, q 2,

An Introduction to Graph Theory

Math 170- Graph Theory Notes

2. CONNECTIVITY Connectivity

A good picture is worth a thousand words

Inf 496/596 Topics in Informatics: Analysis of Social Network Data

Chapter 11: Graphs and Trees. March 23, 2008

Simple graph Complete graph K 7. Non- connected graph

Discrete mathematics

Section 10.1: Graphs and Graph Models. Introduction to Graphs Definition of a Graph Types of Graphs Examples of Graphs

Artificial Intelligence

Lecture Notes on Graph Theory

Math Summer 2012

Computer Science 280 Fall 2002 Homework 10 Solutions

Math 443/543 Graph Theory Notes

CS 2336 Discrete Mathematics

Graphs (MTAT , 6 EAP) Lectures: Mon 14-16, hall 404 Exercises: Wed 14-16, hall 402

Discharging and reducible configurations

Chapter 9 Graph Algorithms

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 7

Transcription:

CS 311 Discrete Math for Computer Science Dr. William C. Bulko Graphs 2014

Definitions Definition: A graph G = (V,E) consists of a nonempty set V of vertices (or nodes) and a set E of edges. Each edge has either one or two vertices associated with it, called its endpoints. An edge is said to connect its endpoints. Definition: A directed graph or digraph G = (V,E) consists of a nonempty set V of vertices (or nodes) together with a set E of directed edges (or arcs). Each 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. The vertex u is called the initial vertex of the edge (a,b) and vertex v is the terminal vertex of this edge. Definition: Graphs where the endpoints of an edge are not ordered are said to be undirected graphs.

Types of graphs Definition: In a simple graph, each edge connects two different vertices, and no two edges connect the same pair of vertices. Definition: Multigraphs may have multiple edges connecting the same two vertices. When m different edges connect the vertices u and v, we say that (u,v) is an edge of multiplicity m. Definition: A pseudograph may include loops, as well as multiple edges connecting the same pair of vertices.

Definitions Definition: Two vertices in an undirected graph G are called adjacent or neighbors in G if there is an edge e between u and v. Such an edge e is called incident with the vertices u and v. Definition: The set of all neighbors of a vertex v of G = (V,E), denoted by N(v), is called the neighborhood of v. If A V, we denote by N(A) the set of all vertices in G that are adjacent to at least one vertex in A. Definition: The degree of a vertex in an undirected graph is the number of edges that are incident with it, except that a loop of a vertex contributes two to the degree of that vertex. The degree of the vertex v is denoted by deg(v). The maximum degree of all of the vertices in a graph is designated by max-deg(g).

Handshaking Theorem Theorem (the Handshaking Theorem): If G = (V,E) is an undirected graph, then

Directed graphs Definition: In a directed graph, the in-degree of a vertex v, denoted deg - (v), is the number of edges which terminate at v. The out-degree of v, denoted 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 the vertex.

Directed graphs Definition: The in-degree of a vertex v, denoted deg - (v), is the number of edges which terminate at v. The out-degree of v, denoted 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 the vertex. Theorem: Let G = (V,E) be a graph with directed edges. Then:

Complete graphs Definition: A complete graph on n vertices, denoted by Kn, is the simple graph that contains exactly one edge between each pair of distinct vertices.

Complete graphs Definition: A complete graph on n vertices, denoted by Kn, is the simple graph that contains exactly one edge between each pair of distinct vertices. Theorem: The number of edges in Kn is n(n-1)/2.

Cycles Definition: A cycle Cn for n >= 3 consists of n vertices v1, v2, v3,, vn, and edges (v1,v2), (v2,v3),, (vn-1, vn), (vn, v1).

n-dimensional Hypercubes Definition: An n-dimensional hypercube, or n-cube, Qn, is a graph with 2 n vertices representing all bit strings of length n, where there is an edge between two vertices that differ in exactly one bit position.

Bipartite Graphs Definition: A simple graph G is bipartite if V can be partitioned into two nonempty disjoint subsets V1 and V2 such that every edge connects a vertex in V1 and a vertex in V2. In other words, there are no edges which connect two vertices in V1 or in V2. Theorem: A simple graph is bipartite if and only if it is possible to assign one of two colors to each vertex of the graph so that no two adjacent vertices are assigned the same color.

Bipartite Graphs Definition: A complete bipartite graph Km,n is a graph that has its vertex set partitioned into two subsets V1 of size m and V2 of size n such that there is an edge from every vertex in V1 to every vertex in V2.

Subgraphs Definition: A subgraph of a graph G = (V,E) is a graph (W,F), where W V and F E. A subgraph H of G is a proper subgraph of G if H G. Definition: Let G = (V,E) be a simple graph. The subgraph induced by W V is the graph (W,F), where the edge set F contains an edge in E if and only if both endpoints are in W.

Union of Graphs Definition: The union of two simple graphs G1 = (V1, E1) and G2 = (V2, E2) is the simple graph with vertex set V1 V2 and edge set E1 E2. The union of G1 and G2 is denoted by G1 G2.

Adjacency Matrices Definition: Suppose that G = (V,E) is a simple graph where V = n. Arbitrarily list the vertices of G as v1, v2,, vn. The adjacency matrix AG of G, with respect to the listing of vertices, is the n X n zero-one matrix with 1 as its (i,j)th entry when vi and vj are adjacent, and 0 as its (i,j)th entry when they are not adjacent. In other words, the adjacency matrix AG = [aij] = 1 if (vi,vj) is an edge of G, 0 otherwise.

Isomers Butane (C4H10) Isobutane (C4H10)

Isomorphic Graphs Definition: The simple graphs G1 = (V1,E1) and G2 = (V2,E2) are isomorphic if there exists a one-to-one and onto function f from V1 to V2 with the property that a and b are adjacent in G1 if and only if f(a) and f(b) are adjacent in G2, for all a and b in V1. Such a function f is called an isomorphism. Two simple graphs that are not isomorphic are called nonisomorphic. In other words, when two simple graphs are isomorphic, there is a one-to-one correspondence between vertices of the two graphs that preserves the adjacency relationship.

Paths in Undirected Graphs Definition: 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 e1, e2,..., en of G for which there exists a sequence x0 = u, x1, x2,..., xn = v of vertices such that ei has, for i = 1..n, the endpoints xi-1 and xi. u x0 e1 e2 x2 e5 x5 x1 e3 x4 e6 e4 n = 6 x3 x6 v

Paths in Undirected Graphs (cont.) Definition: A path is a circuit if it begins and ends in the same vertex; that is, if u = v, and has length greater than zero. Definition: A path or circuit is said to pass through the vertices x1 xn-1, or traverse the edges e1 en. Definition: A path or circuit is simple if it does not contain the same edge more than once.

Paths in Directed Graphs Definition: 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 e1, e2,..., en of G such that e1 is associated with (x0,x1), e2 is associated with (x1,x2), and so on, with en associated with (xn-1, xn), where x0 = u and xn = v. When there are no multiple edges in the directed graph, this path is denoted by its vertex sequence x0, x1, x2,..., xn. Definition: A path of length greater than zero that begins and ends in the same vertex is called a circuit or cycle. Definition: A path or circuit is called simple if it does not contain the same edge more than once.

Connectedness in Undirected Graphs Definition: An undirected graph is called connected if there is a path between every pair of distinct vertices of the graph. An undirected graph that is not connected is called disconnected. We say that we disconnect a graph when we remove vertices or edges, or both, to produce a disconnected subgraph. Theorem: There is a simple path between every pair of distinct vertices of a connected undirected graph.

Connected Components Definition: A connected component of a graph G is a connected subgraph of G that is not a proper subgraph of another connected subgraph of G. A graph G that is not connected has two or more connected components that are disjoint and have G as their union. In other words, the connected components make up a partition of G.

Cut Vertices and Edges For a graph G, if the removal of a vertex and all of its incident edges produces a subgraph consisting of more connected components, then the vertex is called a cut vertex. For a graph G, if the removal of an edge produces a subgraph consisting of more connected components, then the edge is called a cut edge. A graph may have zero, one, or many cut vertices and/or cut edges. A graph with no cut vertices is called a nonseparable graph.

Vertex Cuts and Edge Cuts Definition: For a connected graph G = (V,E), V V is a vertex cut if G - V is disconnected. In other words, if a set of vertices taken out together causes the disconnect. Definition: For a connected graph G = (V,E), E E is an edge cut if G - E is disconnected. In other words, if a set of edges taken out together causes the disconnect. Theorem: Every graph except a complete graph has a vertex cut.

Vertex and Edge Connectivity Definition: The vertex connectivity of a noncomplete graph G, denoted by κ(g), is the minimum number of vertices in a vertex cut of G. The vertex connectivity of a complete graph G is defined to be n-1, where n = V ; in other words, κ(kn) = n-1. In general, the vertex connectivity κ(g) of a graph is the minimum number of vertices that can be removed from G to either disconnect G or produce a graph with a single vertex. Definition: The edge connectivity of a graph G, denoted by λ(g), is the minimum number of edges in an edge cut of G. If G consists of a single vertex, we define the edge connectivity of G to be 0.

Strong and Weak Connectivity Definition: A directed graph is strongly connected if, for every pair of vertices a and b in the graph, there is a path from a to b and from b to a. A directed graph is weakly connected if there is a path between every two vertices in the underlying undirected graph.

Number of Paths of Length r Theorem: Let G be a graph with adjacency matrix A with respect to the ordering v1, v2,..., vn of the vertices of the graph (with directed or undirected edges, with multiple edges and loops allowed). The number of different paths of length r from vi to vj, where r is a positive integer, equals the (i,j)th entry of A r.

The Bridges of Königsberg

The Bridges of Königsberg

The Bridges of Königsberg

Euler Circuits and Paths Definition: In a graph G, an Euler circuit is a simple circuit containing every edge of G. An Euler path in G is a simple path containing every edge of G. Theorem: A connected multigraph with at least two vertices has an Euler circuit if and only if each of its vertices has even degree. Theorem: A connected multigraph has an Euler path but not an Euler circuit if and only if it has exactly two vertices of odd degree.

Hamilton Circuits and Paths Definition: In a graph G, a Hamilton circuit is a simple circuit that passes through every vertex exactly once. A Hamilton path is a simple path that passes through every vertex exactly once. Some observations about Hamilton circuits: A graph with a vertex of degree 1 cannot have a Hamilton circuit, because in a Hamilton circuit, each vertex must be incident with two edges in the circuit. If a vertex in the graph has degree two, then both edges that are incident with this vertex must be part of any Hamilton circuit.

Shortest-Path Problems: Airline Example (mileage) Mileage

Shortest-Path Problems: Airline Example (flight times) Flight Times

Shortest-Path Problems: Airline Example (fares) Fares

Weighted Graphs Definition: A graph that has a number assigned to each edge is called a weighted graph. The length of a path in a weighted graph is defined as the sum of the weights of the edges of the graph (instead of just the number of edges).

Greedy Algorithms Definition: A greedy algorithm is any algorithm that attempts to solve an optimization problem by making the locally optimal choice at each step, with the hope of finding a global optimum. In other words, it s simply an algorithm that makes what seems to be the best choice at each step. Greedy algorithms are usually fairly simple to implement, but they are NOT guaranteed to find the best answer.

Greedy Algorithms: Maze Example

Dijkstra's Algorithm label the start vertex with L(start) = 0 label all other vertices with cost L(vertex) = mark all vertices "not visited" set all vertices' path history to () while end vertex has not been marked "visited": find u, the vertex with the cheapest path mark u visited for each v, a neighbor of u: if weight(u,v) + L(u) < L(v): L(v) = weight(u,v) + L(u) set v's history to u's path history + u Theorem: Dijkstra's Algorithm finds the length of a shorter path between two vertices in a connected simple undirected weighted graph.

The Traveling Salesman Problem

The Traveling Salesman Problem (cont.)

Water, Gas, and Electricity

Water, Gas, and Electricity

Circuit Board

Planar Graphs Definition: A graph is called planar if it can be drawn in the plane without any edges crossing, where a crossing of edges is the intersection of the lines or arcs representing them at a point other than their common endpoint. Such a drawing is called a planar representation of the graph.

Euler's Formula Theorem (Euler s Formula): Let G be a connected planar simple graph with e edges and v vertices. Let r be the number of regions in a planar representation of G. Then r = e - v + 2.

Corollaries of Euler's Formula Definition: The degree of a region is the number of edges on the boundary of the region. 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. Corollary 3: If G is a connected planar simple graph with e edges and v vertices, where v 3, and has no circuits of length 3, then e 2v - 4.

Kuratowski's Theorem Definition: An elementary subdivision is an operation on a graph in which an edge {u,v} is removed, a new vertex w is added, and the edges {u,w} and {w,v} are added.

Kuratowski's Theorem Definition: An elementary subdivision is an operation on a graph in which an edge {u,v} is removed, a new vertex w is added, and the edges {u,w} and {w,v} are added. Definition: Two graphs are said to be homeomorphic if they can be obtained from the same graph by a sequence of elementary subdivisions.

Kuratowski's Theorem Definition: An elementary subdivision is an operation on a graph in which an edge {u,v} is removed, a new vertex w is added, and the edges {u,w} and {w,v} are added. Definition: Two graphs are said to be homeomorphic if they can be obtained from the same graph by a sequence of elementary subdivisions. Kuratowski s Theorem: A graph is nonplanar if and only if it contains a subgraph homeomorphic to K3,3 or K5.

Graph Coloring Definition: A coloring of a graph G is an assignment that assigns a color to each vertex in G such that no two adjacent vertices are assigned the same color. Definition: A graph G is said to be k-colorable if and only if G can be colored using k or fewer colors. The smallest value of k for the graph G is called the chromatic number of G and is denoted by χ(g).

Graph Coloring: Theorems Theorem: Any coloring of a graph with n vertices uses at most n colors. Theorem: Any coloring of a complete graph Kn uses at least n colors. Corollary: The chromatic number of a complete graph χ(kn) is n. Theorem: Any planar graph G can be colored using max-deg(g) + 1 colors. Theorem: The chromatic number of a planar graph is no greater than 6.

The Four-Color Theorem The Four-Color Theorem: The chromatic number of a planar graph is no greater than 4.