niyaznigmatullin

Untitled

Sep 29th, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. for v in V do if deg[v] = 0 then q.add(v)
  2. while not q.empty() do
  3. v = q.get()
  4. if color[v] = -1 then
  5. for uv in E do
  6. if color[u] = 0 then
  7. color[u] = 1
  8. q.add(u)
  9. else
  10. for uv in E do
  11. deg[u] -= 1
  12. if deg[u] = 0 then
  13. color[u] = -1
  14. q.add(u)
Advertisement
Add Comment
Please, Sign In to add comment