Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- color = [0] * n
- flag = True
- def dfs(v, c):
- color[v] = c
- if c == 1:
- c = 2
- else:
- c = 1
- for u in range(n):
- if a[v][u] == 1:
- if color[u] != 0 and color!=c:
- flag = False
- if color[u] == 0:
- dfs(u, c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement