SlideShare a Scribd company logo
Strongly Connected Component
Decomposition (SCCD)
Dr. AMIT KUMAR @JUET
Strongly Connected Component Decomposition
(SCCD)
• The third useful application of DFS is to perform a strongly
connected component decomposition
• Given a directed graph G(V,E), the strongly connected
component decomposition determi nes sets of
vertices Ci ∈ V such that
For every pair u,v ∈ Ci ⇒ u ↝ v and v ↝ u.
• In otherwords, it separates the graph into subsets of vertices
that are mutually reachable from each other.
Dr. AMIT KUMAR @JUET
Strongly Connected Component Decomposition
(SCCD)
• Define the transpose of a graph
• i.e. it is the original graph with all edges reversed. The
transpose graph can be created in O(V+E) time if the graph is
represented as an adjacency list.
• It can then be shown that u and v are mutually reachable
from each other in G if and only if u and v are mutually
reachable from each other in GT.
Dr. AMIT KUMAR @JUET
Strongly Connected Component Decomposition
(SCCD)
Thus the procedure for finding strongly connected
components is as follows:
1. Run DFS on G to find u.f's ⇒ O(V+E)
2. Compute GT ⇒ O(V+E)
3. Run DFS on GT considering the vertices in decreasing
order of u.f's from step 1 ⇒ O(V+E)
The resulting depth-first trees from step 3 are the strongly
connected components of G. Furthermore, the running time
of SCCD is Θ(V+E).
Dr. AMIT KUMAR @JUET
Strongly Connected Component Decomposition
(SCCD)
Example
Consider the following directed graph
Dr. AMIT KUMAR @JUET
Strongly Connected Component Decomposition
(SCCD)
Example
Step 1 - Run DFS on G
Running DFS on G (starting at vertex 1 and taking the vertices in numerical
order) gives
Thus the vertices in decreasing order of u.f is {1,4,2,5,3}.
Dr. AMIT KUMAR @JUET
Strongly Connected Component Decomposition
(SCCD)
Example
Step 2 - Compute GT
Dr. AMIT KUMAR @JUET
Strongly Connected Component Decomposition
(SCCD)
Example
Step 3 - Run DFS on GT
Running DFS on GT taking the vertices in the order {1,4,2,5,3}
Dr. AMIT KUMAR @JUET
Strongly Connected Component Decomposition
(SCCD)
Example
The depth-first trees from step 3 are
Hence the strongly connected components are {1,2,3,4} and {5}.
Dr. AMIT KUMAR @JUET
Topological Sorting
• A second application of DFS is to create a directed ordering of
nodes, e.g. task dependencies. This can be done based on an
important theorem that can be shown using DFS
• A directed graph is acyclic (i.e. a DAG) if and only if a DFS
produces no back edges. Thus DFS can be used to test
whether or not a graph has cycles on O(V+E) time.
Dr. AMIT KUMAR @JUET
Topological Sorting
• Given a directed acyclic graph G (i.e. DAG, which can be
determined via DFS), running DFS on G and sorting the
vertices by decreasing finishing times produces a sequential
ordering of the vertices.
• This can be seen since for any edge (u,v) in the depth-first
tree, u must appear before v in the sorted list (since G is a
DAG we know there are no back edges).
Dr. AMIT KUMAR @JUET
Topological Sorting
• For example,
If the vertices represent a set of tasks with edges representing
dependencies between tasks, a topological sort can be used
to find a critical path.
Since DFS runs in Θ(V + E), topological sort runs in the same
time
Dr. AMIT KUMAR @JUET

More Related Content

DOC
MTH101 - Calculus and Analytical Geometry- Lecture 37
PDF
Chris hill rps_postgis_threeoutoffouraintbad_20150505_1
PPTX
Shortest path algorithm
PPT
Double Patterning (4/2 update)
DOC
Akselrod article 2
PPTX
Minimum spanning tree
PPT
Double Patterning
PPTX
CFD Lecture (4/8): Compressible Flow- Basics
MTH101 - Calculus and Analytical Geometry- Lecture 37
Chris hill rps_postgis_threeoutoffouraintbad_20150505_1
Shortest path algorithm
Double Patterning (4/2 update)
Akselrod article 2
Minimum spanning tree
Double Patterning
CFD Lecture (4/8): Compressible Flow- Basics

What's hot (20)

PDF
P13 037
PPT
Mathematical Relations
PPTX
1.8. equivalence of finite automaton and regular expressions
PPTX
Fuzzy clustering using RSIO-FCM ppt
PPTX
Parallelizing matrix multiplication
PPTX
Double patterning for 32nm and beyond
PPTX
1 sollins algorithm
PPTX
Dijkstra algorithm a dynammic programming approach
PDF
Closed-Form Performance Analysis of Dual Polarization Based MIMO System in Sh...
PPT
L25 ppt conjugate
PPTX
fast-matmul-ppopp2015
PDF
Adjacency Decomposition Method: Breaking up problems
PPTX
How Matlab Helps
PPT
minimum spanning tree
PPTX
Karnaugh Maps
PPT
Minimum spanning tree
PDF
membranes2015_Attractive Planar Panelization using Dynamic Relaxation Princip...
PDF
Dijkstra's Algorithm
PPTX
Dijkstra's algorithm presentation
PDF
Cee 311(2)
P13 037
Mathematical Relations
1.8. equivalence of finite automaton and regular expressions
Fuzzy clustering using RSIO-FCM ppt
Parallelizing matrix multiplication
Double patterning for 32nm and beyond
1 sollins algorithm
Dijkstra algorithm a dynammic programming approach
Closed-Form Performance Analysis of Dual Polarization Based MIMO System in Sh...
L25 ppt conjugate
fast-matmul-ppopp2015
Adjacency Decomposition Method: Breaking up problems
How Matlab Helps
minimum spanning tree
Karnaugh Maps
Minimum spanning tree
membranes2015_Attractive Planar Panelization using Dynamic Relaxation Princip...
Dijkstra's Algorithm
Dijkstra's algorithm presentation
Cee 311(2)
Ad

Similar to Sccd and topological sorting (12)

PPT
Application of dfs
PPTX
Strongly connected components
PPT
topological_sort_strongly Connected Components
PPTX
Topological sort
PPTX
topologicalsort-using c++ as development language.pptx
PDF
Topological sorting
PPTX
Algorithm, Basic topic of algorithm
DOCX
graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
PPT
Strongly Connected Components
PPT
ALG5.1.pptdsfnj,sdhfjk hsdjkfhsdjkfhj ksd hfjksdhfjksd
PPT
Algorithm Design and Complexity - Course 8
PDF
DFS-model Graph Modeling (CES 417) Lecture 6
Application of dfs
Strongly connected components
topological_sort_strongly Connected Components
Topological sort
topologicalsort-using c++ as development language.pptx
Topological sorting
Algorithm, Basic topic of algorithm
graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
Strongly Connected Components
ALG5.1.pptdsfnj,sdhfjk hsdjkfhsdjkfhj ksd hfjksdhfjksd
Algorithm Design and Complexity - Course 8
DFS-model Graph Modeling (CES 417) Lecture 6
Ad

More from Amit Kumar Rathi (20)

PDF
Hybrid Systems using Fuzzy, NN and GA (Soft Computing)
PDF
Fundamentals of Genetic Algorithms (Soft Computing)
PDF
Fuzzy Systems by using fuzzy set (Soft Computing)
PDF
Fuzzy Set Theory and Classical Set Theory (Soft Computing)
PDF
Associative Memory using NN (Soft Computing)
PDF
Back Propagation Network (Soft Computing)
PDF
Fundamentals of Neural Network (Soft Computing)
PDF
Introduction to Soft Computing (intro to the building blocks of SC)
PDF
String matching, naive,
PDF
Shortest path algorithms
PDF
Red black trees
PDF
Recurrence and master theorem
PDF
Rabin karp string matcher
PDF
Minimum spanning tree
PDF
Merge sort analysis
PDF
Loop invarient
PDF
Linear sort
PDF
Heap and heapsort
PDF
Greedy algorithm activity selection fractional
PDF
Graph representation
Hybrid Systems using Fuzzy, NN and GA (Soft Computing)
Fundamentals of Genetic Algorithms (Soft Computing)
Fuzzy Systems by using fuzzy set (Soft Computing)
Fuzzy Set Theory and Classical Set Theory (Soft Computing)
Associative Memory using NN (Soft Computing)
Back Propagation Network (Soft Computing)
Fundamentals of Neural Network (Soft Computing)
Introduction to Soft Computing (intro to the building blocks of SC)
String matching, naive,
Shortest path algorithms
Red black trees
Recurrence and master theorem
Rabin karp string matcher
Minimum spanning tree
Merge sort analysis
Loop invarient
Linear sort
Heap and heapsort
Greedy algorithm activity selection fractional
Graph representation

Recently uploaded (20)

PDF
Well-logging-methods_new................
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPT
Mechanical Engineering MATERIALS Selection
PPTX
Geodesy 1.pptx...............................................
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
Construction Project Organization Group 2.pptx
PDF
composite construction of structures.pdf
PDF
PPT on Performance Review to get promotions
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
additive manufacturing of ss316l using mig welding
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Well-logging-methods_new................
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Mechanical Engineering MATERIALS Selection
Geodesy 1.pptx...............................................
UNIT 4 Total Quality Management .pptx
Construction Project Organization Group 2.pptx
composite construction of structures.pdf
PPT on Performance Review to get promotions
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Operating System & Kernel Study Guide-1 - converted.pdf
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Lesson 3_Tessellation.pptx finite Mathematics
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
bas. eng. economics group 4 presentation 1.pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
OOP with Java - Java Introduction (Basics)
additive manufacturing of ss316l using mig welding
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx

Sccd and topological sorting

  • 1. Strongly Connected Component Decomposition (SCCD) Dr. AMIT KUMAR @JUET
  • 2. Strongly Connected Component Decomposition (SCCD) • The third useful application of DFS is to perform a strongly connected component decomposition • Given a directed graph G(V,E), the strongly connected component decomposition determi nes sets of vertices Ci ∈ V such that For every pair u,v ∈ Ci ⇒ u ↝ v and v ↝ u. • In otherwords, it separates the graph into subsets of vertices that are mutually reachable from each other. Dr. AMIT KUMAR @JUET
  • 3. Strongly Connected Component Decomposition (SCCD) • Define the transpose of a graph • i.e. it is the original graph with all edges reversed. The transpose graph can be created in O(V+E) time if the graph is represented as an adjacency list. • It can then be shown that u and v are mutually reachable from each other in G if and only if u and v are mutually reachable from each other in GT. Dr. AMIT KUMAR @JUET
  • 4. Strongly Connected Component Decomposition (SCCD) Thus the procedure for finding strongly connected components is as follows: 1. Run DFS on G to find u.f's ⇒ O(V+E) 2. Compute GT ⇒ O(V+E) 3. Run DFS on GT considering the vertices in decreasing order of u.f's from step 1 ⇒ O(V+E) The resulting depth-first trees from step 3 are the strongly connected components of G. Furthermore, the running time of SCCD is Θ(V+E). Dr. AMIT KUMAR @JUET
  • 5. Strongly Connected Component Decomposition (SCCD) Example Consider the following directed graph Dr. AMIT KUMAR @JUET
  • 6. Strongly Connected Component Decomposition (SCCD) Example Step 1 - Run DFS on G Running DFS on G (starting at vertex 1 and taking the vertices in numerical order) gives Thus the vertices in decreasing order of u.f is {1,4,2,5,3}. Dr. AMIT KUMAR @JUET
  • 7. Strongly Connected Component Decomposition (SCCD) Example Step 2 - Compute GT Dr. AMIT KUMAR @JUET
  • 8. Strongly Connected Component Decomposition (SCCD) Example Step 3 - Run DFS on GT Running DFS on GT taking the vertices in the order {1,4,2,5,3} Dr. AMIT KUMAR @JUET
  • 9. Strongly Connected Component Decomposition (SCCD) Example The depth-first trees from step 3 are Hence the strongly connected components are {1,2,3,4} and {5}. Dr. AMIT KUMAR @JUET
  • 10. Topological Sorting • A second application of DFS is to create a directed ordering of nodes, e.g. task dependencies. This can be done based on an important theorem that can be shown using DFS • A directed graph is acyclic (i.e. a DAG) if and only if a DFS produces no back edges. Thus DFS can be used to test whether or not a graph has cycles on O(V+E) time. Dr. AMIT KUMAR @JUET
  • 11. Topological Sorting • Given a directed acyclic graph G (i.e. DAG, which can be determined via DFS), running DFS on G and sorting the vertices by decreasing finishing times produces a sequential ordering of the vertices. • This can be seen since for any edge (u,v) in the depth-first tree, u must appear before v in the sorted list (since G is a DAG we know there are no back edges). Dr. AMIT KUMAR @JUET
  • 12. Topological Sorting • For example, If the vertices represent a set of tasks with edges representing dependencies between tasks, a topological sort can be used to find a critical path. Since DFS runs in Θ(V + E), topological sort runs in the same time Dr. AMIT KUMAR @JUET