|
void | dfs (int current_node, int parent) |
|
◆ dfs()
void Solution::dfs |
( |
int | current_node, |
|
|
int | parent ) |
|
inlineprivate |
17 {
18 visited.
at(current_node) =
true;
19 in_time[current_node] = out_time[current_node] = timer++;
20 for (
auto& itr :
graph[current_node]) {
21 if (itr == parent) {
22 continue;
23 }
24 if (!visited[itr]) {
25 dfs(itr, current_node);
26 if (out_time[itr] > in_time[current_node]) {
28 }
29 }
30 out_time[current_node] =
31 std::min(out_time[current_node], out_time[itr]);
32 }
33 }
◆ search_bridges()
37 {
38 timer = 0;
43 for (auto& itr : connections) {
44 graph.at(itr[0]).push_back(itr[1]);
45 graph.at(itr[1]).push_back(itr[0]);
46 }
47 dfs(0, -1);
48 return bridge;
49 }
The documentation for this class was generated from the following file:
- graph/bridge_finding_with_tarjan_algorithm.cpp