This repository was archived by the owner on Sep 8, 2025. It is now read-only.
Commit 3da19a9
authored
Implement Tarjan's strongly-connected components algorithm (#11239)
* Implement Tarjan's strongly-connected components algorithm
This commit implements [Tarjan's algorithm] for finding strongly-connected
components.
This algorithm takes `O(V+E)` time and uses `O(V+E)` space.
Tarjan's algorithm is usually presented as a recursive algorithm, but we do not
trust the input and cannot recurse over it for fear of blowing the
stack. Therefore, this implementation is iterative.
This will be used to do bottom-up inlining in Wasmtime's compilation
orchestration.
[Tarjan's algorithm]: https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm
* address review feedback1 parent 27b1860 commit 3da19a9
3 files changed
Lines changed: 552 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
151 | 159 | | |
152 | 160 | | |
153 | 161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| |||
0 commit comments