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

What's hot (20)

PDF
P13 037
Léo Ribeiro
 
PPT
Mathematical Relations
mohull
 
PPTX
1.8. equivalence of finite automaton and regular expressions
Sampath Kumar S
 
PPTX
Fuzzy clustering using RSIO-FCM ppt
NIGAN NAYAK
 
PPTX
Parallelizing matrix multiplication
DEEPIKA T
 
PPTX
Double patterning for 32nm and beyond
Manikandan Sampathkumar
 
PPTX
1 sollins algorithm
Muhammad Salman
 
PPTX
Dijkstra algorithm a dynammic programming approach
Akash Sethiya
 
PDF
Closed-Form Performance Analysis of Dual Polarization Based MIMO System in Sh...
IJERA Editor
 
PPT
L25 ppt conjugate
Dr. OmPrakash
 
PPTX
fast-matmul-ppopp2015
Austin Benson
 
PDF
Adjacency Decomposition Method: Breaking up problems
Jayant Apte, PhD
 
PPTX
How Matlab Helps
siufu
 
PPT
minimum spanning tree
Melaku Bayih Demessie
 
PPTX
Karnaugh Maps
Ammara Javed
 
PPT
Minimum spanning tree
Hinal Lunagariya
 
PDF
membranes2015_Attractive Planar Panelization using Dynamic Relaxation Princip...
Florian Gauss
 
PDF
Dijkstra's Algorithm
ArijitDhali
 
PPTX
Dijkstra's algorithm presentation
Subid Biswas
 
PDF
Cee 311(2)
apudgr8
 
P13 037
Léo Ribeiro
 
Mathematical Relations
mohull
 
1.8. equivalence of finite automaton and regular expressions
Sampath Kumar S
 
Fuzzy clustering using RSIO-FCM ppt
NIGAN NAYAK
 
Parallelizing matrix multiplication
DEEPIKA T
 
Double patterning for 32nm and beyond
Manikandan Sampathkumar
 
1 sollins algorithm
Muhammad Salman
 
Dijkstra algorithm a dynammic programming approach
Akash Sethiya
 
Closed-Form Performance Analysis of Dual Polarization Based MIMO System in Sh...
IJERA Editor
 
L25 ppt conjugate
Dr. OmPrakash
 
fast-matmul-ppopp2015
Austin Benson
 
Adjacency Decomposition Method: Breaking up problems
Jayant Apte, PhD
 
How Matlab Helps
siufu
 
minimum spanning tree
Melaku Bayih Demessie
 
Karnaugh Maps
Ammara Javed
 
Minimum spanning tree
Hinal Lunagariya
 
membranes2015_Attractive Planar Panelization using Dynamic Relaxation Princip...
Florian Gauss
 
Dijkstra's Algorithm
ArijitDhali
 
Dijkstra's algorithm presentation
Subid Biswas
 
Cee 311(2)
apudgr8
 

Similar to Sccd and topological sorting (12)

PPT
Application of dfs
Hossain Md Shakhawat
 
PPTX
Strongly connected components
Md Nazmul Hossain Mir
 
PPT
topological_sort_strongly Connected Components
JahidulIslam47153
 
PPTX
Topological sort
jabishah
 
PPTX
topologicalsort-using c++ as development language.pptx
janafridi251
 
PDF
Topological sorting
Amit Kumar Rathi
 
PPTX
Algorithm, Basic topic of algorithm
MdZiad
 
DOCX
graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
whittemorelucilla
 
PPT
Strongly Connected Components
Md. Shafiuzzaman Hira
 
PPT
ALG5.1.pptdsfnj,sdhfjk hsdjkfhsdjkfhj ksd hfjksdhfjksd
robozenbd
 
PPT
Algorithm Design and Complexity - Course 8
Traian Rebedea
 
PDF
DFS-model Graph Modeling (CES 417) Lecture 6
DanialKhawaja4
 
Application of dfs
Hossain Md Shakhawat
 
Strongly connected components
Md Nazmul Hossain Mir
 
topological_sort_strongly Connected Components
JahidulIslam47153
 
Topological sort
jabishah
 
topologicalsort-using c++ as development language.pptx
janafridi251
 
Topological sorting
Amit Kumar Rathi
 
Algorithm, Basic topic of algorithm
MdZiad
 
graphin-c1.pnggraphin-c1.txt1 22 3 83 44 5.docx
whittemorelucilla
 
Strongly Connected Components
Md. Shafiuzzaman Hira
 
ALG5.1.pptdsfnj,sdhfjk hsdjkfhsdjkfhj ksd hfjksdhfjksd
robozenbd
 
Algorithm Design and Complexity - Course 8
Traian Rebedea
 
DFS-model Graph Modeling (CES 417) Lecture 6
DanialKhawaja4
 
Ad

More from Amit Kumar Rathi (20)

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

Recently uploaded (20)

PPTX
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
PDF
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
PPTX
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
PPTX
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
PPTX
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
PDF
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
PDF
Halide Perovskites’ Multifunctional Properties: Coordination Engineering, Coo...
TaameBerhe2
 
PPTX
Introduction to Basic Renewable Energy.pptx
examcoordinatormesu
 
PPTX
Thermal runway and thermal stability.pptx
godow93766
 
PPTX
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
PPTX
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
PDF
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
PPTX
Worm gear strength and wear calculation as per standard VB Bhandari Databook.
shahveer210504
 
PPTX
MATLAB : Introduction , Features , Display Windows, Syntax, Operators, Graph...
Amity University, Patna
 
PPTX
DATA BASE MANAGEMENT AND RELATIONAL DATA
gomathisankariv2
 
PDF
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
DOCX
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
Halide Perovskites’ Multifunctional Properties: Coordination Engineering, Coo...
TaameBerhe2
 
Introduction to Basic Renewable Energy.pptx
examcoordinatormesu
 
Thermal runway and thermal stability.pptx
godow93766
 
Heart Bleed Bug - A case study (Course: Cryptography and Network Security)
Adri Jovin
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
MRRS Strength and Durability of Concrete
CivilMythili
 
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
Worm gear strength and wear calculation as per standard VB Bhandari Databook.
shahveer210504
 
MATLAB : Introduction , Features , Display Windows, Syntax, Operators, Graph...
Amity University, Patna
 
DATA BASE MANAGEMENT AND RELATIONAL DATA
gomathisankariv2
 
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 

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