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

Function main

CPP/graph_tree/dfs.cpp:29–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27 adj[v].push_back(u);
28}
29int main()
30{
31 vector<int> adj[6];
32
33 addEdge(adj,1,2);
34 addEdge(adj,1,3);
35 addEdge(adj,1,4);
36 addEdge(adj,1,5);
37 addEdge(adj,2,4);
38 addEdge(adj,2,1);
39 addEdge(adj,3,1);
40 addEdge(adj,4,1);
41 addEdge(adj,4,2);
42 addEdge(adj,5,1);
43 Solution obj;
44 vector<int> df;
45 df= obj.dfsOfGraph(5, adj);
46 for(auto it: df)
47 cout<<it<<" ";
48
49 return 0;
50}
51
52/*
53Output:

Callers

nothing calls this directly

Calls 2

addEdgeFunction · 0.85
dfsOfGraphMethod · 0.80

Tested by

no test coverage detected