MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / dfs

Function dfs

CPP/graph_tree/Kosaraju Algorithm.cpp:4–17  ·  view source on GitHub ↗

Similar to topological sort function (dfs)

Source from the content-addressed store, hash-verified

2
3// Similar to topological sort function (dfs)
4void dfs(int node,vector<int> adj[],vector<bool> &visited,stack<int> &stk)
5{
6 visited[node] = true;
7
8 for(auto child: adj[node])
9 {
10 if(!visited[child])
11 {
12 dfs(child,adj,visited,stk);
13 }
14 }
15
16 stk.push(node);
17}
18
19void dfsRec(int node,vector<int> g[],vector<bool> &visited)
20{

Callers 1

kosarajuFunction · 0.70

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected