Connectivity and Connected Components

CS 30 : Discrete Mathematics for Computer Science First Semester, AY 2012-2013

https://sites.google.com/a/dcs.upd.edu.ph/nhsh_classes/cs30

sablay-logo

Nestine Hope S. Hernandez Algorithms and Complexity Laboratory Department of Computer Science University of the Philippines, Diliman nshernandez@dcs.upd.edu.ph updilseal

Day 19

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

Graph Theory

sablay-logo

1

Connectivity and Connected Components

updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

s not a path since there is no edge {P2 , P6 }. The sequence Îł is a trail since no edge is a simple path since the vertex P5 is used twice. The sequence Î´ is a simple path fro Denition the shortest path (with respect to length) from P4 to P6 . The shortest path from P4 to , P5 , P6 ) which has length 2. Connectivity and Connected Components

A graph

G

is

connected

if there is a path between any two of its vertices.

sablay-logo

updilseal

Fig. 8-8 dcs-logo

By eliminating unnecessary edges, it is not difficult to see that any path from a vertex u aced by a simple path from u to v. We state this result formally. acl-logo

eorem 8.2: There is a path from a vertex u to a vertex v if and only if there exists a sim Discrete Mathematics for Computer Science

CS 30

5 1{P 2 , P3 }.6 The sequence 4 1 γ 5 is 2a trail 6 since no edge is s not a path since there4 is1 no2 edge 2 6 γ = (P , P3 ,isP5used , P6 ), twice.δ = (P4sequence , P1 , P5 , P3 ,δP6is ). a simple path fro 4 , Pvertex 1 , P5 , P2P The a simple path since the 5 Denition is not a from trail since edge {P1 , P twice.from The sequence ethe sequence α is path a path(with from Prespect to P shortest P4 to shortest to itlength) P4 the 4 to P6 ; but 2 } is usedpath 6 . The , P }. The sequence γ is a trail since no edge is used twice; but it is s not a path since there is no edge {P 2 6 , P5 , P6 ) which has length 2. Connectivity and Connected Components

t a simple path since the vertex P5 is used twice. The sequence δ is a simple path from P4 to P6 ; but it is t the shortest path (with respect to length) from P4 to P6 . The shortest path from P4 to P6 is the simple path hasGlength 2. graph is connected if there is a path between any two of its vertices. 4 , P5 , P6 )Awhich

sablay-logo

Fig. 8-8

updilseal

Fig. 8-8

By eliminating unnecessary edges, it is not difficult to see that any path from a vertex u to a vertex vdcs-logo can be placed by a simple path from u to v. We state it thisisresult formally. to see that any path from a vertex u By eliminating unnecessary edges, not difficult

aced by to v.uWe result eorem 8.2:a simple There is apath path from from auvertex to a state vertex this v if and onlyformally. if there exists a simple path from u to v acl-logo

eorem 8.2: There is a path from a vertex u to a vertex v if and only if there exists a sim Discrete Mathematics for Computer Science

CS 30

5 1{P 2 , P3 }.6 The sequence 4 1 γ 5 is 2a trail 6 since no edge is s not a path since there4 is1 no2 edge 2 6 γ = (P , P3 ,isP5used , P6 ), twice.δ = (P4sequence , P1 , P5 , P3 ,δP6is ). a simple path fro 4 , Pvertex 1 , P5 , P2P The a simple path since the 5 Denition is not a from trail since edge {P1 , P twice.from The sequence ethe sequence α is path a path(with from Prespect to P shortest P4 to shortest to itlength) P4 the 4 to P6 ; but 2 } is usedpath 6 . The , P }. The sequence γ is a trail since no edge is used twice; but it is s not a path since there is no edge {P 2 6 , P5 , P6 ) which has length 2. Connectivity and Connected Components

t a simple path since the vertex P5 is used twice. The sequence δ is a simple path from P4 to P6 ; but it is t the shortest path (with respect to length) from P4 to P6 . The shortest path from P4 to P6 is the simple path hasGlength 2. graph is connected if there is a path between any two of its vertices. 4 , P5 , P6 )Awhich

sablay-logo

A connected subgraph H of G is called a connected component of Fig. 8-8 is not contained in any larger connected subgraph Fig. 8-8 of G.

G

if

H

updilseal

By eliminating unnecessary edges, it is not difficult to see that any path from a vertex u to a vertex vdcs-logo can be placed by a simple path from u to v. We state it thisisresult formally. to see that any path from a vertex u By eliminating unnecessary edges, not difficult

aced by to v.uWe result eorem 8.2:a simple There is apath path from from auvertex to a state vertex this v if and onlyformally. if there exists a simple path from u to v acl-logo

eorem 8.2: There is a path from a vertex u to a vertex v if and only if there exists a sim Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

sablay-logo

updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

phs in Example 8.5(a), (c), and (d) are all connec component. The graph in Example 8.5(b) is dis nents. Connectivity and Connected Components

1

2

3

sablay-logo

4

5 6

7

nduced by {1, 2, 4, 5, 6}, and the other is induced updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

A vertex v in G is called a cutpoint (also cut vertex or articulation point if G \ v is disconnected. (Note that G \ v is the graph obtained from G by deleting v and all edges containing v .)

sablay-logo

updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

A vertex v in G is called a cutpoint (also cut vertex or articulation point if G \ v is disconnected. (Note that G \ v is the graph obtained from G by deleting v and all edges containing v .)

sablay-logo

An edge e of G is called a bridge if G \ e is disconnected. (Note that G \ e is the graph obtained from G by simply deleting the edge e ).

updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

Distance and Diameter 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 Apoints vertex v For in G is called cutpoint vertex = or 3,articulation any two in G. example, in Fig.a8-9(a), d(A, F(also ) = 2 cut and diam(G) whereas in Fig.point 8-9(b), d(A, Fif) =G3 \ and = 4. v diam(G) is disconnected.

(Note that G \ v is the graph obtained from edges containing v .)

Cutpoints and Bridges

G

by deleting

v

and all

Let G be a connected graph. A vertex v in G is called a cutpoint if G − v is disconnected. (Recall that G − v is the graph obtained from G by deleting v and all edges containing v.) An edge e of G is called a bridge if G − e An edge e ofthat G Gis−called a bridge if from G \Gebyissimply disconnected. is disconnected. (Recall e is the graph obtained deleting the edge e). In Fig. 8-9(a), the vertex D is athat cutpoint are no bridges.obtained In Fig. 8-9(b), the edge = {D, F } is adeleting bridge. (Its the endpoints (Note G and \ ethere is the graph from G by simply D and F are necessarily cutpoints.)

edge

e

sablay-logo

).

updilseal

Fig. 8-9

8.5 TRAVERSABLE AND EULERIAN GRAPHS, BRIDGES OF KÖNIGSBERG Discrete Mathematics for Computer Science CS 30

dcs-logo

acl-logo

Connectivity and Connected Components

aph G = (V, E) from Example 8.5(d), 1

a

2

sablay-logo

b

c 3

f

e

d 4

g

5

h

e, 2, d, 4 is a walk of length 5 that starts at 1

updilseal

dcs-logo

g, 4, d, 2, a , 1 is a circuit of length 6 that star acl-logo

Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

Connectivity

Suppose a graph represents a power grid. The failure of power stations or cables in that grid can be reected by the deletion of the corresponding vertices or edges in the graph.

sablay-logo

updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

Connectivity

Suppose a graph represents a power grid. The failure of power stations or cables in that grid can be reected by the deletion of the corresponding vertices or edges in the graph. The new graph obtained can then be used to study the power delivery capabilities and limitations of the new grid. Such analysis is important, since storms or other incidents can damage a grid.

sablay-logo

updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

Connectivity

Suppose a graph represents a power grid. The failure of power stations or cables in that grid can be reected by the deletion of the corresponding vertices or edges in the graph. The new graph obtained can then be used to study the power delivery capabilities and limitations of the new grid. Such analysis is important, since storms or other incidents can damage a grid.

sablay-logo

We now consider the vulnerability of a graph to the removal of vertices and edges. updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

An example

sablay-logo

updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

Vertex Connectivity

sablay-logo

updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

Another example

sablay-logo

updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

Edge Connectivity

sablay-logo

updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

A directed graph is said to be strongly connected if for every pair of distinct vertices u and v in G , there is a directed path from u to v and also from v to u .

sablay-logo

updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

A directed graph is said to be strongly connected if for every pair of distinct vertices u and v in G , there is a directed path from u to v and also from v to u . A directed graph is said to be weakly connected if there is a path between every two vertices in the underlying undirected graph.

sablay-logo

updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

A directed graph is said to be strongly connected if for every pair of distinct vertices u and v in G , there is a directed path from u to v and also from v to u . A directed graph is said to be weakly connected if there is a path between every two vertices in the underlying undirected graph.

sablay-logo

updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

A strong component of G is a strongly connected subgraph contained in any other strongly connected subgraph of G .

H

that is not

sablay-logo

updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

A strong component of G is a strongly connected subgraph contained in any other strongly connected subgraph of G .

H

that is not

A weak component of G is a subgraph H such that the underlying undirected graph of H is a component of the underlying undirected graph of G .

sablay-logo

updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

A strong component of G is a strongly connected subgraph contained in any other strongly connected subgraph of G .

H

that is not

A weak component of G is a subgraph H such that the underlying undirected graph of H is a component of the underlying undirected graph of G .

sablay-logo

updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

H

that is not

A weak component of G is a subgraph H such that the underlying undirected graph of H is a component of the underlying undirected graph of G .

sablay-logo

updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30

Connectivity and Connected Components

Questions?

sablay-logo

See you next meeting!

updilseal

dcs-logo

acl-logo Discrete Mathematics for Computer Science

CS 30