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

Method dfs

CPP/graph_tree/dfs.cpp:4–12  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2using namespace std;
3class Solution {
4 void dfs(int node, vector<int> &vis, vector<int> adj[], vector<int> &storeDfs) {
5 storeDfs.push_back(node);
6 vis[node] = 1;
7 for(auto it : adj[node]) {
8 if(!vis[it]) {
9 dfs(it, vis, adj, storeDfs);
10 }
11 }
12 }
13public:
14 vector<int>dfsOfGraph(int V, vector<int> adj[]){
15 vector<int> storeDfs;

Callers

nothing calls this directly

Calls 2

push_backMethod · 0.80
dfsFunction · 0.70

Tested by

no test coverage detected