Presentation is loading. Please wait.

Presentation is loading. Please wait.

An Introduction to Graph Theory

Similar presentations


Presentation on theme: "An Introduction to Graph Theory"— Presentation transcript:

1 An Introduction to Graph Theory
Chapter 11 An Introduction to Graph Theory

2 Topic Overview 11-1 Definitions and Examples
11-2 Subgraphs, Complements, and Graph Isomorphism 11-3 Vertex Degree: Euler Trails and Circuits 11-5 Hamilton Paths and Cycles

3 Topic Overview

4 11-1. Definitions and Examples
Let G = (V, E) be a graph with vertex set V and edge set E, where V is a finite nonempty set, and E ⊆ V  V G is called directed graph if the edge in E is directed edge (arc) G is called undirected graph if there is no concern about the direction of any edge an undirected graph a directed graph

5 11-1. Definitions and Examples (Cont.)
 Simple graph: an undirected graph without loop or multiple edges  In general, if a graph G is not specified as directed or undirected, it is assumed to be simple graph.  V = {a, b, c, d, e}; E = {(a, a), (a, b), (a, d), (b, c)}  edge (a, b) is incident with vertices a, b  a is said to be adjacent to b when (a, b)  E  the edge (a, a) is called loop  the vertex e that has no incident edges is called isolated vertex multiple edges: if there are more than 1 of (a, b) degree of a vertex: number of edges connected (in-degree, out-degree)

6 11-1. Definitions and Examples (Cont.)
Let x, y be (not necessarily distinct) vertices in graph G = (V, E). An x-y walk in G is a (loop-free) finite alternating sequence x = x0, e1, x1, e2, x2, e3, …, en1, xn1, en, xn = y , where xi  V and ei  E. The length of this above walk is n, the number of edges in the walk. If x = y (and n > 1) , then x-y walk is called a closed walk; Otherwise, the walk is called open. By definition, a walk may include repeated edges or vertices.

7 11-1. Definitions and Examples (Cont.)
As shown in Figure 11.4, we have a  b  d  c  e  d  b: an a-b walk of length 6 in which the vertices d and b are repeated, as well as the edge (b, d) (= (d, b)). b  c  d  e  c  f : a b-f walk of length 5 in which the vertex c is repeated, but no edge appears more than once. {f, c}, {c, e}, {e, d}, {d, a}: In this case the given f-a walk has length 4 with no repetition of either vertices or edges.

8 11-1. Definitions and Examples (Cont.)
y Definition 11.3 a finite alternating sequence x = x0, e1, x1, e2, x2, e3, …, en1, xn1, en, xn = y walk: no restriction on edges or vertices. trail: a walk in which no edge can be repeated. b  c  d  e  c  f path: a walk in which no vertex can be repeated. f  c  e  d  a no vertex is repeated implies no edges can be repeated (Why ?) closed walk closed trail = circuit closed path = cycle

9 11-1. Definitions and Examples (Cont.)
Definition 11.3 (Cont.) Summary on names

10 11-1. Definitions and Examples (Cont.)
Theorem 11.1 Let G = (V, E) be an undirected graph, with a, b  V, a  b. If there exists a trail (in G) from a to b, then there is a path (in G) from a to b. (a trail implies a path) remove any cycle on the repeated vertices a x b

11 11-1. Definitions and Examples (Cont.)
Definition 11.4 (connected) Let G = (V, E) be an undirected graph. We call G connected if there is a path between any two distinct vertices of G. The number of connected components of G is denoted by (G). A connected graph A disconnected graph with two components Notes: 1  (G)  |V| Can you think an algorithm to decide (G) ?

12 11-1. Definitions and Examples (Cont.)
Definition 11.5 (multigraphs) there exist two vertices x,y such that there are two or more edges which are incident with them multigraph of multiplicity 2 multigraph of multiplicity 3

13 11-2. Subgraphs, Complements, and Graph Isomorphism
Two Goals What types of substructures are present in a graph? draw two graphs that appear distinct but have the same underlying structure

14 11-2. Subgraphs, Complements, and Graph Isomorphism (Cont.)
Definition (subgraph) Let G = (V, E) is a graph (directed or undirected). G1 = (V1, E1) is called a subgraph of G if   V1 ⊆ V and E1 ⊆ E, where each edge in E1 is incident with vertices in V1. Let G1 = (V1, E1) be a subgraph of G. If V1 = V, then G1 is called a spanning subgraph of G. Let G’ = (V’, E’) be a subgraph of G. If   V’ ⊆ V and E’ contains all edges (x, y), for x, y  V’, then G’ is called a induced subgraph of G.

15 11-2. Subgraphs, Complements, and Graph Isomorphism (Cont.)
spanning subgraph V1 = V Ex induced subgraph includes all edges of E in V’

16 11-2. Subgraphs, Complements, and Graph Isomorphism (Cont.)
Definition (minus operation) Let v be a vertex and e be an edge in a graph G = (V, E). The subgraph G  v of G is to remove vertex v and all edges incident to v from G. The subgraph G  e of G is to remove edge e from G. Note that its vertex set is unchanged. G  c G  e, where e = (c, d) G  {b, f}

17 11-2. Subgraphs, Complements, and Graph Isomorphism (Cont.)
Definition (complete graph and complement) Complete graph Kn is a loop-free undirected graph with n vertices and n( n1)/2 edges, where for any pair of vertices x,y, (x,y) is an edge in Kn. The complement of G = (V, E), denoted by , is Kn  E, where the vertex set of Kn equals V. Kn G

18 11-2. Subgraphs, Complements, and Graph Isomorphism (Cont.)
Theorem (one graph property) Any graph of six vertices contains a K3 or Please prove it !

19 11-2. Subgraphs, Complements, and Graph Isomorphism (Cont.)
Definition (graph isomorphism, 同構) Let G1 = (V1, E1) and G2 = (V2, E2) be two undirected graphs. A function f : V1 → V1 is called a graph isomorphism if (a) f is one-to-one and onto, and (b) for all a, b  V1, (a, b)  E1 if and only if (f(a), f(b))  E2. When such a function exists, G1 and G2 are called isomorphic graphs. a b 2 1 c w x y z 3 4 d

20 11-2. Subgraphs, Complements, and Graph Isomorphism (Cont.)
Definition (Cont.) 1 4 2 3 1 2 3 4 1 3 4 2 2 2 a b c d

21 11-2. Subgraphs, Complements, and Graph Isomorphism (Cont.)
Ex 11.8 The following two graphs are isomorphism: Sol. One can find the correspondence given by a → q c → u e → r g → x i → z b → v d → y f → w h → t j → s

22 11-2. Subgraphs, Complements, and Graph Isomorphism (Cont.)
Ex 11.9 The following two graphs are not isomorphism: Sol. In the right graph, we can find a trail circuit passing through all edges, u → w → v → y → w → z → y → x → v → u. But, in the left graph, we cannot find any trail circuit. Can you think of an algorithm for testing isomorphism ?

23 11-3. Vertex Degree: Euler Trails and Circuits
Definition (degree) Let v be a vertex of G. The degree of v, written deg(v), is the number of edges in G that are incident with v. deg(b) = deg(d) = deg(f) = deg(g) = 2, deg(c) = 4, deg(e) = 0, deg(h) = 1 deg(a) = 3 because we count a loop twice.. deg(e) = 0, e is called a isolated vertex

24 11-3. Vertex Degree: Euler Trails and Circuits (Cont.)
Theorem 11.2 For simple graph G = (V, E). Corollary 11.1 For simple graph G = (V, E), the number of vertices of odd degree must be even. Ex 11.11 A regular graph: each vertex has the same degree.  Is it possible to have a 4-regular graph with 10 edges ? 2|E| = 4|V| = 20  |V| = 5  possible : K5 Is it possible to have a 4-regular graph with 15 edges? 2|E| = 4|V| = 30  |V| = 7.5  not possible

25 11-3. Vertex Degree: Euler Trails and Circuits (Cont.)
grid and hypercube

26 11-3. Vertex Degree: Euler Trails and Circuits (Cont.)
The Seven Bridges of Königsberg: Question: Find a way to walk about the city so as to cross each bridge exactly once and then return to the starting point! Whether there exists a trail circuit ? The answer is negative! Why ? the degree of each vertex is odd. area a area b area d area c

27 11-3. Vertex Degree: Euler Trails and Circuits (Cont.)
Definition (Euler circuit) Euler circuit: a trail circuit that traverses every edge of the graph exactly once. Euler trail: a open trail that traverses every edge of the graph exactly once.  The seven-bridge problem is then settled as testing whether the given graph contains a Euler circuit !

28 11-3. Vertex Degree: Euler Trails and Circuits (Cont.)
Theorem 11.3 (Euler circuit theorem) Let G be an undirected graph or multigraph. Then, G has an Euler circuit iff G is connected and every vertex in G has even degree. 7-bridge problem All degrees of vertices are odd. Hence, no Euler circuit exists.

29 11-3. Vertex Degree: Euler Trails and Circuits (Cont.)
Theorem 11.3 (Cont.) Proof. (:) if G has a Euler circuit, then G is connected and every vertex in G has even degree. (:) if G is connected and every vertex in G has even degree, then G has a Euler circuit. By induction on the number e of edges: obvious start vertex s other vertex v s e = 1 or 2 e = n : Euler circuit exists e = n+1 or n+2 : find any circuit containing s Can you think of an algorithm to construct an Euler circuit? y x deg(s) is even consider the added edges (loop or not) x = y ?

30 11-3. Vertex Degree: Euler Trails and Circuits (Cont.)
Corollary 11.2 Let G be an undirected graph or multigraph. Then, G has an Euler trail iff G is connected and has exactly two vertices of odd degree. Theorem 11.4 (directed Euler circuit theorem) Let G be a directed graph or multigraph. Then, G has a directed Euler circuit iff G is connected and in-deg(v) = out-deg(v) for all v in G. one in, one out

31 11-5. Hamilton Paths and Cycles
Definition (Hamilton) A graph G has a Hamilton cycle (resp. path) if there is a cycle (resp. path) in G that contains every vertex in V. Note Unlike Euler circuit, there is no known necessary and sufficient condition for a graph to be Hamiltonian. An NP-complete problem.

32 11-5. Hamilton Paths and Cycles (Cont.)
Ex 11.27 The following graph has a Hamilton path, but no Hamilton cycle A graph has a Hamilton cycle, then it has a Hamilton path

33 11-5. Hamilton Paths and Cycles (Cont.)
Ex 11.28 Test whether the following graph has a Hamilton path ! start labeling from vertex e After labeling, there are 4x's and 6y's. Since x and y must interleave in a Hamilton path (or cycle), the graph has no Hamilton path or cycle.  The above labeling method works only for bipartite graphs.  The Hamilton problems are still NP-complete when restricted on bipartite graphs.

34 11-5. Hamilton Paths and Cycles (Cont.)
Theorem 11.7 Let Kn∗ be a complete directed graph— that is, Kn∗ has n vertices and for each distinct pair x, y of vertices, exactly one of the edges (x, y) or (y, x) is in Kn∗. Such a graph (called a tournament) always contains a (directed) Hamilton path. Proof. Let m  2 with pm a path containing the m − 1 edges (v1, v2), (v2, v3), …, (vm−1, vm). If m = n, we’re finished. If not, let v be a vertex that doesn’t appear in pm. if (v, v1)E, then v  pm is extended; otherwise, (v1 ,v)E and consider the relation between v and v2. And repeat the process, we can obtain a larger path containing pm and v.

35 11-5. Hamilton Paths and Cycles (Cont.)
Ex (tournament) In a round-robin tournament each player plays every other player exactly once. We want to somehow rank the players according to the results of the tournament. Remark.  not always possible to have a ranking where a player in a certain position has beaten all of the opponents in later positions.  However, by Theorem 11.7, it is possible to list the players such that each has beaten the next player on the list. a b c

36 11-5. Hamilton Paths and Cycles (Cont.)
Theorem 11.8 Let G = (V, E) be a loop-free graph with |V | = n  2. If deg(x) + deg(y)  n − 1 for x, y  V, x  y, then G has a Hamilton path. Proof. We first prove G is connected. Assume by contradiction that G is not connected. Let C1 and C2 be two connected components in G and x and y be in C1 and C2 , respectively. Then, deg(x) + deg(y)  (n11) + (n21) = n1 + n2  2 < n1 + n2 1  n  1. A contradiction occurs. Hence, G is connected. x y |C1| = n1 |C2| = n2

37 11-5. Hamilton Paths and Cycles (Cont.)
Theorem 11.8 (Cont.) Proof. (Cont.) Now we build a Hamilton path for G. Assume pm, m  2, is path v1  v2  …  vm of m1 edges. There are the following cases: Case 1: either (v, v1) or (v, vm) is in E. Then, either v  pm or pmv is a path in G. Case 2: v1, v2, …, vm construct a cycle. Assume the cycle is as follows: Now consider a vertex v not in the cycle. Since G is connected, there is a path from v to a first vertex vr in the cycle. Then, we can re-construct a path containing v.

38 11-5. Hamilton Paths and Cycles (Cont.)
Theorem 11.8 (Cont.) Proof. (Cont.)

39 11-5. Hamilton Paths and Cycles (Cont.)
Corollary 11.4 Let G = (V, E) be a loop-free graph with n ( 2) vertices. If deg(v)  (n−1)/2 for v  V, then G has a Hamilton path.

40 11-5. Hamilton Paths and Cycles (Cont.)
Theorem 11.9 Let G = (V, E) be a loop-free undirected graph with |V | = n  3. If deg(x) + deg(y)  n for  nonadjacent vertices x, y  V, x  y, then G has a Hamilton cycle. Proof. We prove the theorem by contradiction. Assume that G has no Hamilton cycle. We add edges to G until we arrive at a subgraph H of Kn, where H has no Hamilton cycle, but, for any edge e (of Kn) not in H, H + e does have a Hamilton cycle.

41 11-5. Hamilton Paths and Cycles (Cont.)
Theorem 11.9 (Cont.) Proof. (Cont.) Since H  Kn, there exist vertices a, b  V, where (a, b) is not an edge of H but H + (a, b) has a Hamilton cycle C. Let us list the vertices of H (and G) on cycle C as follows: If (b, vi) is in H, then (a, vi1) is not in H; i.e., (b, vi)  E(H) or (a, vi1)  E(H) . Otherwise, we have a Hamilton cycle of H as follows: Consequently, degH(a)+degH(b) < n. By definition of H, we get that degH(v)  degG(v) for v  V. Thus, degG(a)+degG(b) = deg(a)+deg(b) < n. A contradiction occurs. Therefore, G has a Hamilton cycle.

42 11-5. Hamilton Paths and Cycles (Cont.)
Corollary 11.5 Let G = (V, E) be a loop-free undirected graph with |V | = n  3. If deg(v)  n/2 for v  V, then G has a Hamilton cycle.

43 11-5. Hamilton Paths and Cycles (Cont.)
Corollary 11.6 Let G = (V, E) be a loop-free undirected graph with |V | = n  3. If |E|  C(n 1, 2) + 2, then G has a Hamilton cycle. Proof. Let a, b  V with (a, b)  E. We claim that deg(a) + deg(b)  n. Then, by Theorem 11.9 G has a Hamilton cycle. We next prove the above claim. Remove all edges connected to either a or b, and then a,b. Let H = (V’, E’) denote the resulting subgraph. Then, |E| = |E’| + deg(a) + deg(b) because (a, b)  E. Since |V’| = n − 2, H is a subgraph of the complete graph Kn−2, so |E’|  C(n − 2, 2). Consequently, C( n−1, 2) + 2  |E| = |E’| + deg(a) + deg(b)  C(n − 2, 2) + deg(a) + deg(b). Then, deg(a) + deg(b)  n.

44 11-5. Hamilton Paths and Cycles (Cont.)
TSP A related problem: the traveling salesman problem Given a weighted graph with weights on edges, the TSP problem is to find a Hamilton cycle of the shortest total distance if it does exist. Ex. a  b  e  c  d  a with total cost= =12. a 3 e 1 2 b 3 4 3 d 5 4 2 c

45 Exercise (練習,不用交) Content: End of Chapter 11

46 End of this Course !


Download ppt "An Introduction to Graph Theory"

Similar presentations


Ads by Google