Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void dfs(int from, std::vector<bool> &visited)
- {
- visited[from] = true;
- // do something
- for(int &to : edges[from])
- if(!visited[to])
- dfs(to, visited);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement