Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool dfs(int v, int p)
- {
- bool fl = false;
- used[v] = 1; pr[v] = p;
- for (int i = 0; i < gr[v].size(); i++)
- {
- if ((gr[v][i] != p) && (used[gr[v][i]]))
- {
- return true;
- }
- if ((!used[gr[v][i]]) || dfs(gr[v][i], v))
- {
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement