5.3.2 Hamilton paths.

Slides:



Advertisements
Similar presentations
 Theorem 5.9: Let G be a simple graph with n vertices, where n>2. G has a Hamilton circuit if for any two vertices u and v of G that are not adjacent,
Advertisements

Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing.
 期中测验时间:本周五上午 9 : 40  教师 TA 答疑时间 : 周三晚上 6 : 00—8 : 30  地点:软件楼 315 房间,  教师 TA :李弋老师  开卷考试.
Graph Traversals Visit vertices of a graph G to determine some property: Is G connected? Is there a path from vertex a to vertex b? Does G have a cycle?
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 CHAPTER 4 - PART 2 GRAPHS 1.
 Graph Graph  Types of Graphs Types of Graphs  Data Structures to Store Graphs Data Structures to Store Graphs  Graph Definitions Graph Definitions.
1 Representing Graphs. 2 Adjacency Matrix Suppose we have a graph G with n nodes. The adjacency matrix is the n x n matrix A=[a ij ] with: a ij = 1 if.
Vertex Cut Vertex Cut: A separating set or vertex cut of a graph G is a set S  V(G) such that G-S has more than one component. a b c d e f g h i.
Applied Discrete Mathematics Week 12: Trees
Vertex Cut Vertex Cut: A separating set or vertex cut of a graph G is a set SV(G) such that S has more than one component. Connectivity of G ((G)): The.
CTIS 154 Discrete Mathematics II1 8.2 Paths and Cycles Kadir A. Peker.
Tirgul 13 Today we’ll solve two questions from last year’s exams.
Vertex Cut Vertex Cut: A separating set or vertex cut of a graph G is a set SV(G) such that G-S has more than one component. d f b e a g c i h.
K-Coloring k-coloring: A k-coloring of a graph G is a labeling f: V(G)  S, where |S|=k. The labels are colors; the vertices of one color form a color.
TECH Computer Science Graph Optimization Problems and Greedy Algorithms Greedy Algorithms  // Make the best choice now! Optimization Problems  Minimizing.
KNURE, Software department, Ph , N.V. Bilous Faculty of computer sciences Software department, KNURE The distance.
Copyright © Cengage Learning. All rights reserved.
A Shortest Path Algorithm. Motivation Given a connected, positive weighted graph Find the length of a shortest path from vertex a to vertex z.
5.4 Shortest-path problem  Let G=(V,E,w) be a weighted connected simple graph, w is a function from edges set E to position real numbers set. We denoted.
Graph Theory Topics to be covered:
Trees and Distance. 2.1 Basic properties Acyclic : a graph with no cycle Forest : acyclic graph Tree : connected acyclic graph Leaf : a vertex of degree.
CSNB143 – Discrete Structure Topic 9 – Graph. Learning Outcomes Student should be able to identify graphs and its components. Students should know how.
1 CS104 : Discrete Structures Chapter V Graph Theory.
 Rooted tree and binary tree  Theorem 5.19: A full binary tree with t leaves contains i=t-1 internal vertices.
5.5.2 M inimum spanning trees  Definition 24: A minimum spanning tree in a connected weighted graph is a spanning tree that has the smallest possible.
5.5.3 Rooted tree and binary tree  Definition 25: A directed graph is a directed tree if the graph is a tree in the underlying undirected graph.  Definition.
V Spanning Trees Spanning Trees v Minimum Spanning Trees Minimum Spanning Trees v Kruskal’s Algorithm v Example Example v Planar Graphs Planar Graphs v.
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.
5.5.2 M inimum spanning trees  Definition 24: A minimum spanning tree in a connected weighted graph is a spanning tree that has the smallest possible.
Chapter 5 Graphs  the puzzle of the seven bridge in the Königsberg,  on the Pregel.
Chap. 11 Graph Theory and Applications 1. Directed Graph 2.
MAT 2720 Discrete Mathematics Section 8.2 Paths and Cycles
 Quotient graph  Definition 13: Suppose G(V,E) is a graph and R is a equivalence relation on the set V. We construct the quotient graph G R in the follow.
Graph Theory Unit: 4.
Length of a Path The weight (length) of a path is the sum of the weights of its edges. adcbe Path p: Edge weights: w(a, b) = 7, w(b, c) = 2, w(c,
Chapter 11 - Graph CSNB 143 Discrete Mathematical Structures.
Chapter 9: Graphs.
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
Graphs Definition: a graph is an abstract representation of a set of objects where some pairs of the objects are connected by links. The interconnected.
 Hamilton paths.  Definition 20: A Hamilton paths is a path that contains each vertex exactly once. A Hamilton circuit is a circuit that contains.
1. 期中测验时间和地点: 11 月 4 日, 上午 9:40—11 : 40 地点: 教室 2. 答疑时间和地点: 1)11 月 1 日 ( 周五 )13:00—15:00 软件楼 319 2)11 月 2 日和 3 日, 14:00—17:00 软件楼 3 楼 机房讨论室.
1 Lecture 5 (part 2) Graphs II (a) Circuits; (b) Representation Reading: Epp Chp 11.2, 11.3
5.6 Prefix codes and optimal tree Definition 31: Codes with this property which the bit string for a letter never occurs as the first part of the bit string.
GRAPH THEORY Discrete Math Team KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS )
Fundamental Graph Theory (Lecture 1) Lectured by Hung-Lin Fu 傅 恆 霖 Department of Applied Mathematics National Chiao Tung University.
Trees.
An Introduction to Graph Theory
CSNB 143 Discrete Mathematical Structures
Elementary Graph Algorithms
Applied Discrete Mathematics Week 13: Graphs
Grade 11 AP Mathematics Graph Theory
Graph theory Definitions Trees, cycles, directed graphs.
Agenda Lecture Content: Introduction to Graph Path and Cycle
12. Graphs and Trees 2 Summary
Advanced Algorithms Analysis and Design
Basic Graph Algorithms
CS 583 Analysis of Algorithms
G-v, or G-{v} When we remove a vertex v from a graph, we must remove all edges incident with the vertex v. When a edge is removed from a graph, without.
Discrete Math II Howon Kim
Connectivity Section 10.4.
Representing Graphs Wade Trappe.
Theorem 5.13: For vT‘, l’(v)= min{l(v), l(vk)+w(vk, v)}
Discrete Mathematics Lecture 13_14: Graph Theory and Tree
Evaluation of the Course (Modified)
Chapter 5 Graphs the puzzle of the seven bridge in the Königsberg,
N(S) ={vV|uS,{u,v}E(G)}
Definition 8: Graphs that have a number assigned to each edge or each vertex are called weighted graphs weighted digraphs.
Parallel Graph Algorithms
Graph Theory: Cuts and Connectivity
GRAPHS.
Presentation transcript:

5.3.2 Hamilton paths

Definition 20: A Hamilton paths is a path that contains each vertex exactly once. A Hamilton circuit is a circuit that contains each vertex exactly once except for the first vertex, which is also the last.

Theorem 5.8: Suppose G(V,E) that has a Hamilton circuit, then for each nonempty proper subset S of V(G), the result which (G-S)≤|S| holds, where G-S is the subgraph of G by omitting all vertices of S from V(G). (G-S)=1,|S|=2 The graph G has not any Hamilton circuit, if there is a nonempty purely subgraph S of G so that (G-S)>|S|.

Omit {b,h,i} from V, (G-S)=4>3=|S|,The graph has not any Hamilton circuit

If (G-S)≤|S| for each nonempty proper subset S of G, then G has a Hamilton circuit or has not any Hamilton circuit. For example: Petersen graph

Proof: Let C be a Hamilton circuit of G(V,E) Proof: Let C be a Hamilton circuit of G(V,E). Then (C-S)≤|S| for each nonempty proper subset S of V Why? Let us apply induction on the number of elements of S. |S|=1, The result holds Suppose that result holds for |S|=k. Let |S|=k+1 Let S=S'∪{v},then |S'|=k By the inductive hypothesis, (C-S')≤|S'| V(C-S)=V(G-S) Thus C-S is a spanning subgraph of G-S Therefore (G-S)≤(C-S)≤|S|

Theorem 5. 9: Let G be a simple graph with n vertices, where n>2 Theorem 5.9: Let G be a simple graph with n vertices, where n>2. G has a Hamilton circuit if for any two vertices u and v of G that are not adjacent, d(u)+d(v)≥n. n=8,d(u)=d(v)=3, u and v are not adjacent, d(u)+d(v)=6<8, But there is a Hamilton circuit in the graph. Note:1)if G has a Hamilton circuit , then G has a Hamilton path Hamilton circuit :v1,v2,v3,…vn,v1 Hamilton path:v1,v2,v3,…vn, 2)If G has a Hamilton path, then G has a Hamilton circuit or has not any Hamilton circuit

Corollary 1: Let G be a simple graph with n vertices, n>2 Corollary 1: Let G be a simple graph with n vertices, n>2. G has a Hamilton circuit if each vertex has degree greater than or equal to n/2. Proof: If any two vertices of G are adjacent ,then G has a Hamilton circuit v1,v2,v3,…vn,v1。 If G has two vertices u and v that are not adjacent, then d(u)+d(v)≥n. By the theorem 5.9, G has a Hamilton circuit. Kn has a Hamilton circuit where n≥3

Theorem 5. 10: Let the number of edges of G be m Theorem 5.10: Let the number of edges of G be m. Then G has a Hamilton circuit if m≥(n2-3n+6)/2,where n is the number of vertices of G. Proof: If any two vertices of G are adjacent ,then G has a Hamilton circuit v1,v2,v3,…vn,v1. Suppose that u and v are any two vertices of G that are not adjacent. Let H be the graph produced by eliminating u and v from G. Thus H has n-2 vertices and m-d(u)-d(v) edges.

Theorem 5. 11:Let G be a simple graph with n vertices, n>2 Theorem 5. 11:Let G be a simple graph with n vertices, n>2. G has a Hamilton path if for any two vertices u and v of G that are not adjacent, d(u)+d(v)n-1.

5.4 Shortest-path problem Let G=(V,E,w) be a weighted connected simple graph, w is a function from edges set E to position real numbers set. We denoted the weighted of edge {i,j} by w(i,j), and w(i,j)=+ when {i,j}E Definition 21: Let the length of a path p in a weighted graph G =(V,E,w) be the sum of the weights of the edges of this path. We denoted by w(p). The distance between two vertices u and v is the length of a shortest path between u and v, we denoted by d(u,v).

Dijkstra’s algorithm (E.W.Dijkstra) Let G=(V,E,w) and |V|=n where w>0. Suppose that S is a nonempty subset of V and v1S. Let T=V-S. Example: Suppose that (u,v',v'',v''',v) is a shortest path between u and v. Then (u,v',v'',v''') is a shortest path between u and v'''.

Let vT. l(v) be the length of a shortest path from v1 to v containing only vertices in S.

l(e)=? a,b,e 6; a,b,c,e 4, l(e)=4?。 Example:S={a,b}, T={c,d,e,z} l(c): ac:a,c 4 a,b,c 3, l(c)=3。 l(e)=? a,b,e 6; a,b,c,e 4, l(e)=4?。 Note:l(v) is the length of a shortest path from v1 to v containing only vertices in S. l(e)=6, l(d)=8 l(z)=。

l(c)=3,l(e)=6, l(d)=8, l(z)=。 minvT{l(v)}=l(c)=3 is the length of a shortest path from a to c. Theorem 5.12:Suppose that minvT {l(v)}= l(v'). Then the length of the shortest path from v1 to v' is l (v').

Proof: Suppose that there is a path p from v1 to v', and the length of this path less than l(v'). Then the path p must conclude some vertices of T-{v'}.

l(v)? (1) S={v1},T=V-{v1},for vT (2)For SV, T=V-S, suppose that these vertices of the shortest paths from v1 to any vertices of S are in S. By Theorem 5.12(minvT{l(v)}=l(vk), vkT), we gained the result which l(vk) is the length of the shortest path from v1 to vk(distance)。The vertex vk is added to S. (3)Let S'=S∪{vk}, T'=T-{vk}, vT'. Suppose that l'(v) is the length of a shortest path from v1 to v containing only vertices in S'. Then l'(v)=min{l(v),l(vk)+w(vk,v))} (4)Let S=S',T=T', l(v)=l'(v), goto (2)

S={a,b},T={c,d,e,z} l(c)=3,l(e)=6, l(d)=8, l(z)=+。 minvT{l(v)}=l(c)=3 S’={a,b,c}, T’={d,e,z} l'(e)=min{ l(e), l(c)+w(c,e)}=4, l'(d)=min{l(d), l(c)+w(c,d)}=8, w(c,d)= + l'(z)=min{l(z), l(c)+w(c,z)}= +

Theorem 5.13: For vT‘, l’(v)= min{l(v), l(vk)+w(vk, v)} Proof: Let S'=S∪{vk}. Suppose that l‘(v) is the length of a shortest path from v1 to v containing only vertices in S’. (1)There are some paths from v1 to v, but these paths don’t contain the vertex vk and other vertices of T'. Then l(v) is the length of the shortest path of these paths, i.e. l'(v)=l(v)。 (2)There are some paths from v1 to v, these paths from v1 to vk don’t contain other vertices of T', and the vertex vk adjacent edge {vk,v}. Then l(vk)+w(vk,v) is the length of the shortest path of these paths, viz l'(v)= l(vk)+w(vk,v).

(1)Let S=,T=V,l(v1)=0,for vv1 and l(v)=+ Let k=1 (2)S'=S∪{vk},T'=T-{vk}, For each vertex v of T', l'(v)=min{l(v),l(vk)+w(vk,v)}; l'(v)l(v),S'S,T'T。 (3)minvT{l(v)}=l(vk+1)。 (4)if k=n-1,then stop if k<n-1,then k+1k goto (2)。

Example:Find the length of a shortest path between a and z in the given weighted graph

The length of a shortest path between a and z is 13 and the path is (a,c,g,e,f,z)

NEXT :Trees Exercise P320 (Sixth) OR P306(Fifth) 3,4,5,6,18 2.Find the length of a shortest path between a and z in the given weighted graph.