Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function paint(v, color, parent):
- for (v,u)∈E:
- if u == parent
- continue
- if not visited[u]
- if up[u] ⩾ tin[v]
- newColor = ++maxColor
- col[vu] = newColor
- paint(u, newColor, v)
- else
- col[vu] = color
- paint(u, color, v)
- else if tin[u] < tin[v]
- col[vu] = color
- function solve():
- for v∈V:
- dfs(v)
- for v∈V:
- if not visited[v]
- maxColor++
- paint(v, maxColor, -1)
Add Comment
Please, Sign In to add comment