Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void dfs(int x) {
- vis[x] = 1;
- nivel[x] = menor[x] = cont++;
- int sons = 0;
- REP(i, graph[x].size()) {
- if(vis[graph[x][i]] == 0) {
- sons += 1;
- pai[graph[x][i]] = x;
- dfs(graph[x][i]);
- if(menor[graph[x][i]] < menor[x]) menor[x] = menor[graph[x][i]];
- if(menor[graph[x][i]] == nivel[graph[x][i]]) {
- bridges += 1
- }
- } else if(vis[graph[x][i]] == 1 && pai[x] != graph[x][i]) {
- if(nivel[graph[x][i]] < menor[x]) menor[x] = nivel[graph[x][i]];
- }
- }
- vis[x] = 2;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement