MCPcopy Create free account
hub / github.com/SR-Sunny-Raj/Hacktoberfest2021-DSA / dfs

Function dfs

17. Graph/BridgesInGraph.cpp:4–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include<vector>
3using namespace std;
4void dfs(int node, int parent, vector<int> &vis, vector<int> &tin, vector<int> &low, int &timer, vector<int> adj[])
5{
6 tin[node] = low[node] = timer++;
7 for(auto it : adj[node])
8 {
9 if(it == parent)
10 continue;
11 if(!vis[it]){
12 dfs(it, node, vis, tin, low, timer, adj);
13 low[node] = min(low[node], low[it]);
14 if(low[it] > tin[node])
15 cout << node << " " << it << endl;
16 }
17 else
18 low[node] = min(low[node], tin[it]);
19 }
20}
21int main()
22{
23 int n, m;

Callers 1

mainFunction · 0.70

Calls 1

minFunction · 0.50

Tested by

no test coverage detected