Skip to content

Commit 105c97c

Browse files
committed
fixed some typos
1 parent c190d37 commit 105c97c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/graph/strongly-connected-components.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,7 @@ We consider the minimal value of $t_{in}$ of the unclaimed vertices we can reach
234234
We will call the propagated value $t_{low}$.
235235
236236
More formally, we define $t_{low}[v]$ to be the lowest value of $t_{in}$ a vertex in the subtree of $v$ can reach through a direct edge.
237-
238-
We therefore can detect whether a vertex $v$ is a root or not by checking if $t_{low}[v] < $t_{in}[v]$.
237+
We therefore can detect whether a vertex $v$ is a root or not by checking if $t_{low}[v] < t_{in}[v]$.
239238
240239
Lastly, to claim the vertices, there are many ways to do it, such as another graph traversal algorithm, but it's also possible to use a simple data structure to keep track of the unclaimed vertices.
241240
To determine the data structure from first principles, let's go through the methods it must implement, which are only two:
@@ -258,12 +257,12 @@ We can now see that this can be implemented with a stack:
258257
259258
This finally lets us implement the algorithm.
260259
261-
The runtinme complexity of the sequence of `dfs` calls is $O(n + m)$.
260+
The runtime complexity of the sequence of `dfs` calls is $O(n + m)$.
262261
Considering the stack, its complexity amortizes to $O(n)$ since each node is only pushed and popped once.
263262
The total runtime complexity is therefore $O(n + m)$.
264263
265-
As an additional remark, the roots are found in reversed topological ordering.
266-
In the algorithm, the vertex is a a root if there are no edges to unclaimed vertices outside of its subtree, meaning all other reachable components are either in its subtree (and therefore their roots were already found) or they connect to already claimed vertices outside of the subtree (whose roots were also already found).
264+
As an additional remark, the roots are found in reversed topological order.
265+
In the algorithm, the vertex is a root if there are no edges to unclaimed vertices outside of its subtree, meaning all other reachable components are either in its subtree (and therefore their roots were already found) or they connect to already claimed vertices outside of the subtree (whose roots were also already found).
267266
So all reachable components were already found, meaning they are introduced in a valid reversed topological ordering of the condensation graph.
268267
269268
### Implementation
@@ -350,7 +349,7 @@ void strongly_connected_components(vector<vector<int>> const &adj,
350349
}
351350
```
352351

353-
The iteration through the adjacency list is not exactly as we described.
352+
Note that the iteration through the adjacency list is not exactly as we described.
354353
Currently, the iteration does the following:
355354

356355
```c++

0 commit comments

Comments
 (0)