AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
sccs.h
1
#ifndef ALGORITHMS_SCCS_H
2
#define ALGORITHMS_SCCS_H
3
4
#include <vector>
5
6
namespace
sccs {
7
/*
8
This function implements Tarjan's algorithm for finding the strongly
9
connected components of a directed graph. The runtime is O(n + m) for a
10
directed graph with n vertices and m arcs.
11
12
Input: a directed graph represented as a vector of vectors, where graph[i] is
13
the vector of successors of vertex i.
14
15
Output: a vector of strongly connected components, each of which is a vector
16
of vertices (ints). This is a partitioning of all vertices where each SCC is
17
a maximal subset such that each vertex in an SCC is reachable from all other
18
vertexs in the SCC. Note that the derived graph where each SCC is a single
19
"supervertex" is necessarily acyclic. The SCCs returned by this function are
20
in a topological sort order with regard to this derived DAG.
21
*/
22
std::vector<std::vector<int>> compute_maximal_sccs(
23
const
std::vector<std::vector<int>> &graph);
24
}
25
#endif
downward
algorithms
sccs.h
Generated on Tue Jan 7 2025 for AI 24/25 Project Software by
1.12.0