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

Function cycleDFS

CPP/graphseries.cpp:32–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32bool cycleDFS(int node, int parent, vector<int> &vis, vector<int> arr[])
33{
34 vis[node] = 1;
35 for (auto i : arr[node])
36 {
37 if (!vis[i])
38 {
39 if (cycleDFS(i, node, vis, arr))
40 return true;
41 }
42 else
43 {
44 if (i != parent)
45 return true;
46 }
47 }
48
49 return false;
50}
51
52void bfs(int node, vector<int> &vis, vector<int> arr[], vector<int> &ans)
53{

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected