2. Course: CSE
Course Teacher:
Masud Rabbani
Lecturer
Department of CSE
Daffodil International University
Presented by:
Maksudur Rahman (162-15-7955)
MD. Nazmul Hossain Mir (163-15-8386)
Abir Abdullah (162-15-7773)
MD. Raisul Islam Masum (162-15-
3. Connectivity
A graph is connected when there is a path between every pair of vertices. In a
connected graph, there are no unreachable vertices. A graph that is not
connected is disconnected. A graph G is said to be disconnected if there exist
two nodes in G such that no path in G has those nodes as endpoints.
A graph with just one vertex is connected. An edgeless graph with two or more
vertices is disconnected.
4. Connectivity
• Connected Graph
In an undirected graph G, two vertices u and v are called connected if G
contains a path from u to v. Otherwise, they are called disconnected.
A directed graph is called connected if every pair of distinct vertices in
the graph is connected
• Connected Components
A connected component is a maximal connected subgraph of G. Each
vertex belongs to exactly one connected component, as does each
edge.
6. Strongly Connected Components
A directed graph is strongly connected if there is a path
between all pairs of vertices. A strongly connected component
(SCC) of a directed graph is a maximal strongly connected
subgraph. For example, there are 3 SCCs in the following graph:
7. Weakly Connected Components
A directed graph is called weakly connected if replacing
all of its directed edges with undirected edges produces
a connected (undirected) graph.
8. Connected Components
In graph theory, a connected component (or just component) of an
undirected graph is a subgraph in which any two vertices are connected
to each other by paths, and which is connected to no additional
vertices in the supergraph. For example, the graph shown in the
illustration has three connected components. A vertex with no incident
edges is itself a connected component. A graph that is itself connected
has exactly one connected component, consisting of the whole graph.
9. Component Graph
• GSCC = (VSCC, ESCC).
• VSCC has one vertex for each SCC in G.
• ESCC has an edge if there’s an edge between the corresponding SCC’s in G.
• GSCC for the example considered:
C1 C2
C3
C4
C1 C2
C3
C4
10. Transpose of a directed graph
The transpose MT of an NxN matrix M is the matrix obtained
when the rows become columns and the column become rows:
11. Strongly Connected Components
The transpose MT of an NxN matrix M is the matrix obtained
when the rows become columns and the column become rows:
a b c d
a
b
c
d
a b c d
a
b
c
d
a
b c
d da
b c
M MT
GT
G
Edges
have reverse
direction!
1
1 1
1
1
1
11
12.
13. Algorithm to determine SCC
• Call DFS(G) to compute finishing times f[u] for each
vertex u
• Compute Transpose(G)
• Call DFS(Transpose(G)), but in the main loop of DFS,
consider the vertices in order of decreasing f[u] (as
computed in step 1)
• Output the vertices of each tree in the depth-first
forest of step 3 as a separate strong connected
component
17. Step-3:Call DFS(Transpose(G)), but in the main loop of DFS, consider the vertices in
order of decreasing f[u] (as computed in step 1).
• Okay, so vertices in order of decreasing post-visit(finishing times) values:
• {E, B, A, H, G, I , C, D, F ,J}
• So at this step, we run DFS on G^T but start with each vertex from above list:
• DFS(E): {E}
• DFS(B): {B}
• DFS(A): {A}
• DFS(H): {H, I, G}
• DFS(G): remove from list since it is already visited
• DFS(I): remove from list since it is already visited
• DFS(C): {C, J, F, D}
• DFS(J): remove from list since it is already visited
• DFS(F): remove from list since it is already visited
• DFS(D): remove from list since it is already visited
18. Step 4: Output the vertices of each tree in the depth-first forest
of step 3 as a separate strong connected component.
So we have five strongly connected components: {E}, {B}, {A},
{H, I, G}, {C, J, F, D}