Graph Theory. Part of Texas Counties.

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

Varying Applications (examples)

Basics of Graph Theory

Graphs. Pseudograph: multiple edges and loops allowed

Elements of Graph Theory

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

Introduction III. Graphs. Motivations I. Introduction IV

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

Graphs. Introduction To Graphs: Exercises. Definitions:

Chapter 1 Graph Theory

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.

6.2. Paths and Cycles

An Introduction to Graph Theory

Graph Theory CS/Math231 Discrete Mathematics Spring2015

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

Graphs. The ultimate data structure. graphs 1

Lecture 5: Graphs. Rajat Mittal. IIT Kanpur

Assignment 4 Solutions of graph problems

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

Fundamental Properties of Graphs

γ(ɛ) (a, b) (a, d) (d, a) (a, b) (c, d) (d, d) (e, e) (e, a) (e, e) (a) Draw a picture of G.

Ordinary Differential Equation (ODE)

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

Foundations of Discrete Mathematics

Chapter 11: Graphs and Trees. March 23, 2008

Math 776 Graph Theory Lecture Note 1 Basic concepts

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

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

Discrete mathematics II. - Graphs

Math.3336: Discrete Mathematics. Chapter 10 Graph Theory

INTRODUCTION TO GRAPH THEORY. 1. Definitions

Graph and Digraph Glossary

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

Graphs. The ultimate data structure. graphs 1

Chapter 2 Graphs. 2.1 Definition of Graphs

An Introduction to Graph Theory

How can we lay cable at minimum cost to make every telephone reachable from every other? What is the fastest route between two given cities?

CS6702 GRAPH THEORY AND APPLICATIONS 2 MARKS QUESTIONS AND ANSWERS

Math 443/543 Graph Theory Notes

Graph Theory. ICT Theory Excerpt from various sources by Robert Pergl

Graph Theory. 1 Introduction to Graphs. Martin Stynes Department of Mathematics, UCC January 26, 2011

Math 443/543 Graph Theory Notes

Chapter 3: Paths and Cycles

Figure 2.1: A bipartite graph.

2. CONNECTIVITY Connectivity

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

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

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

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.

ECS 20 Lecture 17b = Discussion D8 Fall Nov 2013 Phil Rogaway

WUCT121. Discrete Mathematics. Graphs

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

Introduction to Graph Theory

Course Introduction / Review of Fundamentals of Graph Theory

Crossing bridges. Crossing bridges Great Ideas in Theoretical Computer Science. Lecture 12: Graphs I: The Basics. Königsberg (Prussia)

Worksheet for the Final Exam - Part I. Graphs

Graph Theory Mini-course

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points

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

Number Theory and Graph Theory

CS473-Algorithms I. Lecture 13-A. Graphs. Cevdet Aykanat - Bilkent University Computer Engineering Department

Further Mathematics 2016 Module 2: NETWORKS AND DECISION MATHEMATICS Chapter 9 Undirected Graphs and Networks

Discharging and reducible configurations

Basic Combinatorics. Math 40210, Section 01 Fall Homework 4 Solutions

Math 170- Graph Theory Notes

Outline. Introduction. Representations of Graphs Graph Traversals. Applications. Definitions and Basic Terminologies

Algorithms. Graphs. Algorithms

Discrete Mathematics

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

Graphs and trees come up everywhere. We can view the internet as a graph (in many ways) Web search views web pages as a graph

BIL694-Lecture 1: Introduction to Graphs

Simple graph Complete graph K 7. Non- connected graph

Number Theory and Graph Theory

V :non-empty vertex ornode set E V V :edge set G (V, E) :directed graph on V, or digraph on V

Graph theory. Po-Shen Loh. June We begin by collecting some basic facts which can be proved via bare-hands techniques.

Module 2: NETWORKS AND DECISION MATHEMATICS

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI

Ma/CS 6a Class 8: Eulerian Cycles

Introduction to Graphs

Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 7

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

Trees Rooted Trees Spanning trees and Shortest Paths. 12. Graphs and Trees 2. Aaron Tan November 2017

Graphs: Introduction. Ali Shokoufandeh, Department of Computer Science, Drexel University

CHAPTER 10 GRAPHS AND TREES. Alessandro Artale UniBZ - artale/z

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.

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

Discrete Math For Computing II

Combinatorics Summary Sheet for Exam 1 Material 2019

Chapter 9 Graph Algorithms

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

Domination, Independence and Other Numbers Associated With the Intersection Graph of a Set of Half-planes

Assignment 1 Introduction to Graph Theory CO342

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao,David Tse Note 8

8.2 Paths and Cycles

Discrete Mathematics for CS Spring 2008 David Wagner Note 13. An Introduction to Graphs

Understand graph terminology Implement graphs using

Graphs and Isomorphisms

Artificial Intelligence

EECS 203 Lecture 20. More Graphs

Module 11. Directed Graphs. Contents

Transcription:

Graph Theory Part of Texas Counties. We would like to visit each of the above counties, crossing each county only once, starting from Harris county. Is this possible? This problem can be modeled as a graph. We can represent each county as a vertex or dot and connect the counties that are adjacent with edges. Ha e2 Ch e6 Je e11 e1 e3 e5 e7 e10 e12 Or Mt e4 Li e9 Ha e13 Ja e14 Ne

A graph model of the counties shown in the picture above. If we start at vertex Ha, travel along edge e2 to vertex Ch, travel along edge e6 to Je, and so on and eventually arrive to vertex Or, is called a path. Our problem can then be re-phrased as follows: Is there a path from vertex Ha to vertex Ha that traverses every vertex exactly once? Definition: Graph A graph (or undirected graph) G consists of a set V of vertices (or nodes) and a set E of edges (or arcs) such that each edge e belongs to E is associated with an unordered pair of vertices. If the edge is unique then we note e = (v, w) If G is a graph with a set of vertices V and a set of edges E, we write: G= (V, E). The set V and E are assumed to be finite and V is assumed to be nonempty. Incidence: An edge e in a graph that is associated with the pair of vertices v and w is said to be incident on v and w. v and w are said to be incident on e and adjacent vertices. Directed Graph: A directed graph or digraph G consists of a set V of vertices (or nodes) and a set E of edges (or arcs) such that each edge e is associated with an ordered pair of vertices. If there is a unique edge e associated with the ordered pair (v,w), we can write e = (v, w) Unless specified otherwise, the sets E and V are assumed to be finite and V is assumed to be nonempty.

In directed graphs, two distinct edges can be associated with the same pair of vertices. Such edges are called parallel edges. An edge incident on a single vertex is called a loop. A graph that has neither loops nor parallel edges, is called a simple graph. Weighted Graphs: Frequently in manufacturing, it is necessary to bore many holes in sheets of metal. Components can then be bolted to these sheets. A drill, controlled by a computer is used to drill the holes. To save time and money, the drill press should be moved as quickly as possible. We model the situation as a graph. The vertices of the graph are the holes to be drilled. Every pair is connected by an edge. We write in each edge the time to move the drill press between the corresponding holes.. a 8 6.b 2.c 9 4 12 3 5 d. 4 6. e

A graph with numbers on the edges is called a weighted graph. If edge e is labeled k. The weight of edge (c,e) is 5. In a weighted graph, the length of a path is the sum of the weights of the edges in a path. Suppose that in this problem, the path is required to begin at vertex a and end at vertex e. We can find the minimum-length path by listing all possible paths from a to e that pass through every vertex exactly one time and choose the shortest one. Path a, b, c, d, e a, b, d, c, e a, c, b, d, e a, c, d, b, e a, d, b, c, e a, d, c, b, e Length 21 28 24 26 27 22 We see that the path that visits the vertices a, b, c, d, e, in this order has the minimum length. Listing all paths from vertex v to vertex w, as we did, is time consuming. Unfortunately, no one knows a method that is much more practical for arbitrary graphs. This problem is a version of the traveling salesperson problem. However there are several efficient algorithms for finding a path in a graph that has a root and children, a tree.

Similarity Graphs: Suppose that we want to design a program that finds students who cheat in their programming assignments by copying somebody s else program. We want to group like program into classes based on certain properties of the program. Suppose we select: 1. The number of lines in the program 2. The number of return statements in the program 3. The number of function calls in the program. Program # of program # return statements #function calls lines 1 66 20 1 2 41 10 2 3 68 5 8 4 90 34 5 5 75 12 14 A similarity graph G is constructed as follows. The vertices correspond to programs. A vertex is denoted (p1, p2, p3), where pi is the value of the property i. We define a dissimilarity function s as follows. For each pair of vertices v= (p1, p2, p3) and w=(q1, q2, q3), we set s(v, w)= p1-q1 + p2- q2 + p3- q3 If v and w are two vertices corresponding to two programs, s(v, w) is a measure of how dissimilar the programs are. A large value s(v, w) indicates dissimilarity, while a small value indicates similarity.

For a fixed number S, we insert an edge between v and w if s(v, w) < S. We say that v and w are in the same class if v =w or there is a path from v to w..v1.v2.v3.v4.v5 In this example, if S = 25, the programs are grouped in three classes: {1, 3, 5}, {2}, {4}. Definition: A complete graph on n vertices, denoted Kn, is the simple graph with n vertices in which there is an edge between every pair of distinct vertices. Definition: A graph G =(V, E) is bipartite if there exists subsets V1 and V2 (either possibly empty) of V such that V1 V2 =, V1 V2 = V, and each edge in E is incident on one vertex in V1 and one vertex in V2. v1..v4 v2..v5 v3. The graph above is bipartite since if we let V1={v1, v2, v3} and V2 ={ v4, v5}

each edge is incident one vertex in V1 and one vertex in V2. The complete bipartite graph on m and n vertices denoted Km,n is the simple graph whose vertex set is partitioned into sets V1 with m vertices and V2 with n vertices in which the edge set consists of all edges of the form (v1, v2) with v1 in V1 and v2 in V2. Paths and Cycles Definition: Let v 0 and v n be vertices in a graph. A path from v 0 to v n of length n is an alternating sequence of n+1 vertices and n edges beginning with vertex v 0 and ending with vertex v n, (v 0, e 1, v 1, e 2, v 2,, v n-1, e n, v n ), in which edge e i is incident on vertices v i-1 and v i for i=1,,n A connected graph is graph in which we can go from any vertex to any other vertex on a path. A directed graph G is strongly connected if given any vertices v and w in G, there exists a path from v to w. Subgraphs: Let G =(V, E) be a graph. We call (V, E ) a subgraph of G if V V and E E For every edge e E, if e is incident on v and w, then v and w V Let G be a graph and let v be a vertex in G. The subgraph G of G consisting of all edges and vertices in G that are contained in some path beginning at v is called a component of G containing v.

Let v and w be vertices in a graph G. -A simple path from v to w is a path from v to w with no repeated vertices. -A cycle (or circuit) is a path of nonzero length from v to v with no repeated edges. -A simple cycle is a cycle from v to v, in which there are no repeated vertices, except for v. See graph 8.2.1 and find a simple path? a cycle, a simple cycle, a subgraph. Königsberg Bridge Problem: The first paper in graph theory was Leonhard Euler s in 1736. The paper presented a general theory that included a solution to what is called Königsberg bridge problem. v w y x A graph model of the bridges of Königsberg

A problem consists of starting from any location, walk over each bridge exactly once; then return to the starting location. This amounts to finding a cycle in the graph that includes all of the edges and all the vertices. A cycle in a graph G that includes all of the edges and all of the vertices is called an Euler cycle. There is no Euler cycle in the Königsberg problem Suppose that there is a simple cycle going from v to v, it means that there is a path from vertex v to vertex v that traverse every edge exactly once. Suppose that there is a simple cycle going from v to v and consider the vertex y. Each time we arrive a y, we must leave y using a different edge. Furthermore every edge that touches y must be used. Thus the edges at y occur in pairs. It follows that an even number of edges much touch y. Since three edges touch y, we have a contradiction. Therefore there is no path in G that traverses every edge exactly once. Degree of a vertex: The degree of a vertex v, δ(v), is the number of edges incident on v. By definition, each loop on v contributes 2 to the degree of v. The Hand Shaking Theorem: Let G= (V, E) be an undirected graph with e edges. Then 2e = deg( v) v V How many edges are there in a graph with 10 vertices each of degree of 6? Solution : e= 30

Theorem 1: If a graph G has a Euler cycle, then G is connected and every vertex has an even degree. Proof: Suppose that G has an Euler cycle. We argued that every vertex in G has even degree. If v and w are vertices in G, the portion of the Euler cycle that takes us from v to w serves as a path from v to w. Therefore G is connected. Theorem 2: If G is a connected graph and every vertex has even degree, then G has an Euler cycle. Proof is by induction. Theorem 3: If a graph G contains a cycle from v to v, G contains a simple cycle from v to v. Necessary and Sufficient Conditions for Euler cycle (Theorem): A connected graph with at least two vertices has an Euler circuit if each of its vertices has an even degree. Algorithm for Constructing Euler Circuits: procedure Euler(G: connected graph with all vertices of even degree) circuit:= a circuit in G beginning at an arbitrary chosen vertex with edges successively added to form a path that returns to this vertex

Hamiltonian Cycle Definition: A cycle in a graph G that contains each vertex in G exactly once, except for the starting and ending vertex that appears twice, is a Hamiltonian cycle. a..b f..d.c.g.e The above graph has a Hamiltonian cycle (a, b, c, d, e, f, g, a), however it does not have an Euler cycle. Theorem: If G is a simple graph with n vertices with n 3 such that the degree of every vertex is at least n/2, then G has a Hamiltonian cycle. Theorem: If G is a simple graph with n vertices with n 3 such that: deg(u) + deg(v) n for every pair of non-adjacent vertices u and v, then G has a Hamiltonian cycle. Shortest-Path Problems: Many problems can be modeled using graphs with weights assigned to their edges.

Problems involving distances can be modeled by assigning distances between cities to the edges. Graphs that have a number assigned to each edge are called weighted graphs. Weighted graphs are used to model computer networks. Communication cost, response time or distance between computers can all be studied using weighted graphs. Determining a path of least length between two vertices in a network is one problem that arises often. A shortest-path Algorithm: There are several different algorithms that find a shortest path between two vertices in a weighted graph. The most famous one is an algorithm discovered by Dijkstra in 1959. Procedure Dijkstra( G: weighted connected simple graph with all weights positive) {G has vertices a= v0, v1,.vn and weights w(vi, vj) where w(vi, vj) = if {vi, vj} is not an edge in G} for i:=1 to n L(vi):= L(a):=0 S:= {the labels are now initialized so that the label of a is 0 and all other labels are, and S is the empty set} while z S 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) {this adds a vertex to S with minimal label and updates the labels of vertices not in S} end { L(z)= length of shortest path from a to z}

Theorem: Dijkstra s algorithm finds the length of a shortest path between two vertices in a connected simple undirected weighted graph. Computational Complexity of Dijkstra Algorithm: We count the number of additions and comparisons. The algorithm uses no more than n-1 iterations for a graph of n vertices. Number of operations for each iteration: We can identify the vertex not in S with the smallest label using no more than n-1 comparisons. Then 2 operations consisting of an addition and a comparison. It follows that we have 2(n-1) operations in each iteration. Since we have (n-1) iterations, using no more than 2(n-1) operations we have that the algorithm is O(n 2 ). Theorem 2: Dijkstra s algorithm uses O(n 2 ) operations (additions and comparisons) to find the length of a shortest path between two vertices in a connected simple undirected weighted graph with n vertices. The traveling salesperson problem is related to the problem of finding a Hamiltonian cycle in a graph. Representing Graphs in Programs: There are many useful ways to represent graphs. One way is to represent a graph without multiple edges is to list all the edges of this graph. Adjacency Matrices: To simplify computation, graphs can be represented using matrices. Suppose that G =(V, E) is a simple graph where V =n. Suppose that the vertices of G are listed arbitrarily as v1, v2, vn.

The adjacency matrix A (or Ag) of G, with respect to this 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 it (i,j)th entry when they are not adjacent. In other words, if its adjacency matrix is A= [aij], then a ij a = 1 0 if { v, v i otherwise j } is b an edge of G d We use zero-one matrices to represent directed graphs Isomorphism in Graphs Definition: The simple graphs G1= (V1, E1) and G2= (V2, E2) are isomorphic if there is 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. 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. Show that the graphs G=(V, E) and H (W, F) are isomorphic

Graph Invariant: A property preserved by isomorphism is called a graph invariant. Some properties that are preserved by isomorphism is the number of vertices and the number of edges. -Isomorphic simple graphs must have the same number of vertices. -Isomorphic simple graphs must have the same number of edges The degrees of the vertices in isomorphic simple graphs must be the same. That is, a vertex v of degree d in G must correspond to a vertex f(v) with degree d in H, because a vertex w in G is adjacent to v if an only if f(v) and f(w) are adjacent. To show that a function f from the vertex set of a graph G to the vertex set of a graph H is an isomorphism, we need to show that f preserves the presence and absence of edges. Adjacency Matrices and Isomorphic graphs: The function f is an isomorphism if the adjacency matrix of G is the same as the adjacency matrix of H, when rows and columns are labeled to correspond to the image under f of the vertices in G that are the labels of these rows and columns in the adjacency matrix of G Planar Graphs: Three cities C1, C2, C3 are to be directly connected by expressways to each of 3 other cities, C4, C5, C6. Can this road system be designed so that the expressways do not cross? C1. C2. C3. C4. C5. C6.

The system above has its roads crossing. Definition: A graph is planar if it can be drawn without its edges crossing. The problem of planarity occurs in city planning, printed circuits design and others. If a connected, planar graph is drawn in the plane, the plane ius devided into regions called faces. A face is characterized by the cycle that forms its boundaries. D 1..2 6..5 A B.4.3 A is bounded by the cycle(5,4,6,1,5) The outer face D is considered to be bounded by the cycle (1, 2, 3, 4, 6, 1) The graph above has f = 4 faces and e= 8 edges and v = 6 vertices. f, e and v satisfy the equation : f= e -v+2 In 1752, Euler proved that this equation holds for any connected planar graph. Show that K3, 3, is not planar? Proof by contradiction: C

-Suppose K3, 3 is planar. Since every cycle has at least 4 edges, each face is bounded by at least 4 edges. In a planar graph, each edge belongs to at most 2 bounding cycles, therefore 2e >= 4f