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

Function dfs

graph/code8.cpp:17–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15}
16
17bool dfs(vector<int> vec[], vector<bool> &visited, int parent, int source)
18{
19 visited[source] = true;
20 for (int i = 0; i < vec[source].size(); i++)
21 {
22 int adjacent = vec[source][i];
23 if (visited[adjacent] == false)
24 {
25 if (dfs(vec, visited, source, adjacent) == true)
26 {
27 return true;
28 }
29 }
30 else if (visited[adjacent] == true && parent != adjacent)
31 {
32 return true;
33 }
34 }
35 return false;
36}
37
38bool dfs_rec(vector<int> vec[], int v)
39{

Callers 1

dfs_recFunction · 0.70

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected