Skip to content

Commit 34747aa

Browse files
author
Hamid Gasmi
committed
Strongly Connected Components description is created
1 parent 2ee8923 commit 34747aa

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

README.md

+23-3
Original file line numberDiff line numberDiff line change
@@ -1632,8 +1632,8 @@
16321632
- A **DAG**:
16331633
- **Directed Acyclic Graph**
16341634
- It's a directed graph G without any cycle
1635-
- A **source** is a vertex with no incoming edges
1636-
- A **sink** is a vertex with no outgoing edges
1635+
- A **source** vertex is a vertex with no incoming edges
1636+
- A **sink** vertex is a vertex with no outgoing edges
16371637
- A Topological Sort:
16381638
- Find sink; Put at end of order; Remove from graph; Repeat
16391639
- It's the DFS algorithm
@@ -1656,11 +1656,31 @@
16561656
- 2 vertices v, w in a directed graph are connected:
16571657
- if you can reach v from w and can reach w from v
16581658
- **Strongly connected graph**: is a directed graph where every vertex is reachable from every other vertex
1659-
- **Strongly connected components**: It's a collection of subgraphs of an arbitrary directed graph that are strongly connected
1659+
- **Strongly connected components**, **SCC**: It's a collection of subgraphs of an arbitrary directed graph that are strongly connected
16601660
- **Metagraph**:
16611661
- It's formed from all strongly connected components
16621662
- Each stromgly connected components is represented by a vertice
16631663
- **The metagraph of a directed graph is always a DAG**
1664+
- **Sink Components**
1665+
- It's a subgrph of a directed graph with no outgoing edges
1666+
- If v is in a sink SCC, `explore (v)` finds this SCC
1667+
- **Source Components**
1668+
- It's a subgrph of a directed graph with no incoming edges
1669+
- The vertex with the largest postorder number is in a source component
1670+
- **Reverse Graph**, **G^R**
1671+
- It's a directed graph obtained from G by reversing the direction of all of its edges
1672+
- G^R and G have same SCCs
1673+
- Source components of G^R are sink components of G
1674+
- **The vertex with largest postorder in G^R is in a sink SCC of G**
1675+
- Find all SCCs of a directed graph G:
1676+
- SCCs (G, Gr):
1677+
Run DFS(Gr):
1678+
fir v ∈ V in reverse postorder:
1679+
if v isn't visited:
1680+
Explore(v, G): vertices found are first SCC
1681+
Mark visited vertices as new SCC
1682+
- Time Complexity: O(|V| + |E|)
1683+
- It's essentially DFS on Gr and then on G
16641684
- For more details:
16651685
- UC San Diego Course:[Strongly Connected Components I](https://github.com/hamidgasmi/training.computerscience.algorithms-datastructures/blob/master/3-graph-algorithms/1_graph_decomposition/09_graph_decomposition_8_strongly-connected-components.pdf)
16661686
- UC San Diego Course:[Strongly Connected Components II](https://github.com/hamidgasmi/training.computerscience.algorithms-datastructures/blob/master/3-graph-algorithms/1_graph_decomposition/09_graph_decomposition_9_computing-sccs.pdf)

0 commit comments

Comments
 (0)