Top Banner
CSE 211 Discrete Mathematics Chapter 8.4 Connectivity
46

CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Mar 27, 2015

Download

Documents

Aiden Ball
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

CSE 211Discrete Mathematics

Chapter 8.4Connectivity

Page 2: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Paths in Undirected Graphs

• There is a path from vertex v0 to vertex vn if there is a sequence of edges from v0 to vn

– This path is labeled as v0,v1,v2,…,vn and has a length of n.

• The path is a circuit if the path begins and ends with the same vertex.

• A path is simple if it does not contain the same edge more than once.

Page 3: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Graph Theoretic Foundations

• Paths and Cycles:

• Walk in a graph G is v0, e1, v1, …, vl-1, el, vl

Page 4: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Graph Theoretic Foundations

• Paths and Cycles:

• IF v0, v1, …, vl are distinct (except possible v0,vl) then the walk is a path.

• Denoted by v0, v1, …, vl or e1, e2, …, el

• Length of path is l

Page 5: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Paths, Cycles, and Trails

• A trail is a walk with no repeated edge.

Page 6: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Graph Theoretic Foundations

• Paths and Cycles:

• A path or walk is closed if v0 = vl

• A closed path containing at least one edge is called a cycle.

Page 7: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Paths in Undirected Graphs

• A path or circuit is said to pass through the vertices v0, v1, v2, …, vn or traverse the

edges e1, e2, …, en.

Page 8: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Example

• u1, u4, u2, u3

– Is it simple? – yes

– What is the length? – 3

– Does it have any circuits? – no

u1 u2

u5 u4 u3

Page 9: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Example

• u1, u5, u4, u1, u2, u3

– Is it simple?– yes

– What is the length?– 5

– Does it have any circuits?– Yes; u1, u5, u4, u1

u1 u2

u5 u3

u4

Page 10: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Example

• u1, u2, u5, u4, u3

– Is it simple?– yes

– What is the length?– 4

– Does it have any circuits?– no

u1 u2

u5 u3

u4

Page 11: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Connectedness

• An undirected graph is called connected if there is a path between every pair of distinct vertices of the graph.

• There is a simple path between every pair of distinct vertices of a connected undirected graph.

Page 12: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Example

Are the following graphs connected?

c

e

f

a

d

b

g

e

c

a

f

b

d

Yes No

Page 13: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Connectedness (Cont.)

• A graph that is not connected is the union of two or more disjoint connected subgraphs (called the connected components of the graph).

Page 14: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Example

• What are the connected components of the following graph?

b

a c

d e

h g

f

Page 15: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Example

• What are the connected components of the following graph?

b

a c

d e

h g

f

{a, b, c}, {d, e}, {f, g, h}

Page 16: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Cut edges and vertices

• If one can remove a vertex (and all incident edges) and produce a graph with more connected components, the vertex is called a cut vertex.

• If removal of an edge creates more connected components the edge is called a cut edge or bridge.

Page 17: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Example

• Find the cut vertices and cut edges in the following graph.

a

b c

d f

e h

g

Page 18: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Example

• Find the cut vertices and cut edges in the following graph.

a

b c

d f

e h

g

Cut vertices: c and eCut edge: (c, e)

Page 19: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Graph Theoretic Foundations• Connectivity:• Connectivity (G) of graph G is …• G is k connected if (G) k• Separator or vertex-cut Cut

vertex

Separation pair

Page 20: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Graph Theoretic Foundations

• Trees and Forests:• Tree – connected graph without any cycle• Forest – a graph without any cycle

Page 21: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Connectedness in Directed Graphs

• A directed graph is strongly connected if there is a directed path between every pair of vertices.

• A directed graph is weakly connected if there is a path between every pair of vertices in the underlying undirected graph.

Page 22: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Example

• Is the following graph strongly connected? Is it weakly connected?

a b

c

e d

This graph is strongly connected. Why? Because there is a directed path between every pair of vertices.

If a directed graph is strongly connected, then it must also be weakly connected.

Page 23: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Example

• Is the following graph strongly connected? Is it weakly connected?

a b

c

e d

This graph is not strongly connected. Why not? Because there is no directed path between a and b, a and e, etc.

However, it is weakly connected. (Imagine this graph as an undirected graph.)

Page 24: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Connectedness in Directed Graphs

• The subgraphs of a directed graph G that are strongly connected but not contained in larger strongly connected subgraphs (the maximal strongly connected subgraphs) are called the strongly connected components or strong components of G.

Page 25: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Example

• What are the strongly connected components of the following graph?a b

c

e d

This graph has three strongly connected components:• The vertex a• The vertex e• The graph consisting of V = {b, c, d} and E = { (b, c), (c, d), (d, b)}

Page 26: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Consider a connected graph G. The distance between vertices u and v in G, written d(u, v), is the length of the shortest path between u and v. The diameter of G, written diam(G), is the maximum distance between any two points in G. For example, in Fig. 1-8(a), d(A,F) = 2 and diam(G) = 3, whereas in Fig. 1-8(b), d(A, F) = 3 and diam(G) = 4

Distance in Trees and Graphs

Page 27: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Distance in Trees and Graphs

• If G has a u, v-path, then the distance from u to v, written dG(u, v) or simply d(u, v), is the least length of u, v-path.

• The diameter (diam G) is maxu,vV(G)d(u,v)

Page 28: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Distance in Trees and Graphs

• Find the diameter, eccentricity, radius and center of the given G.

Page 29: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

CSE 211 Discrete Mathematics and Its Applications

Chapter 8.5Euler and Hamilton Paths

Page 30: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Euler Paths and Circuits

• The Seven bridges of Königsberg

a

b

c

dA

B

C

D

Page 31: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Euler Paths and Circuits

• An Euler path is a path using every edge of the graph G exactly once.

• An Euler circuit is an Euler path that returns to its start.

A

B

C

DDoes this graph have an

Euler circuit?No.

Page 32: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Necessary and Sufficient Conditions

• How about multigraphs?

• A connected multigraph has a Euler circuit iff each of its vertices has an even degree.

• A connected multigraph has a Euler path but not an Euler circuit iff it has exactly two vertices of odd degree.

Page 33: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Example• Which of the following graphs has an Euler circuit?

e

d

a

c

b

e

d

a

c

b

ec

a

d

b

yes no no(a, e, c, d, e, b, a)

Page 34: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Example• Which of the following graphs has an Euler path?

e

d

a

c

b

e

d

a

c

b

ec

a

d

b

yes no yes(a, e, c, d, e, b, a ) (a, c, d, e, b, d, a, b)

Page 35: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Euler Circuit in Directed Graphs

NO (a, g, c, b, g, e, d, f, a) NO

Page 36: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Euler Path in Directed Graphs

NO (a, g, c, b, g, e, d, f, a) (c, a, b, c, d, b)

Page 37: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Hamilton Paths and Circuits

• A Hamilton path in a graph G is a path which visits every vertex in G exactly once.

• A Hamilton circuit is a Hamilton path that returns to its start.

Page 38: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Hamilton Circuits

Is there a circuit in this graph that passes through each vertex exactly once?

Page 39: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Hamilton Circuits

Yes; this is a circuit that passes through each vertex exactly once.

Page 40: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Finding Hamilton Circuits

Which of these three figures has a Hamilton circuit? Of, if no Hamilton circuit, a Hamilton path?

Page 41: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Finding Hamilton Circuits

• G1 has a Hamilton circuit: a, b, c, d, e, a• G2 does not have a Hamilton circuit, but does have a Hamilton path: a, b, c, d• G3 has neither.

Page 42: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Finding Hamilton Circuits

• Unlike the Euler circuit problem, finding Hamilton circuits is hard.

• There is no simple set of necessary and sufficient conditions, and no simple algorithm.

Page 43: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Properties to look for ...

• No vertex of degree 1• If a node has degree 2, then both edges

incident to it must be in any Hamilton circuit.

• No smaller circuits contained in any Hamilton circuit (the start/endpoint of any smaller circuit would have to be visited twice).

Page 44: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

A Sufficient Condition

Let G be a connected simple graph with n vertices with n 3.

G has a Hamilton circuit if the degree of each vertex is n/2.

Page 45: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Travelling Salesman Problem

A Hamilton circuit or path may be used to solve practical problems that require visiting “vertices”, such as:

road intersectionspipeline crossingscommunication network nodes

A classic example is the Travelling Salesman Problem – finding a Hamilton circuit in a complete graph such that the total weight of its edges is minimal.

Page 46: CSE 211 Discrete Mathematics Chapter 8.4 Connectivity.

Summary

Property Euler Hamilton

Repeated visits to a given node allowed?

Yes No

Repeated traversals of a given edge allowed?

No No

Omitted nodes allowed? No No

Omitted edges allowed? No Yes