Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Algo(G,a,b,c,d)
- Init(G)
- state = 0, foundB = False
- for each v € Adj(a):
- if not DFSmod(G,v,b,c,d,state,foundB)
- return False
- return True
- DFSmod(G,v,b,c,d,state,foundB)
- col[v]=g
- if (v = c or v = d) and not foundB:
- state++
- else if v=b:
- foundB=True
- for each u € Adj(v):
- if col[u]=g:
- if foundB and state != 2:
- return False
- else if col[u]=b:
- if not DFSmod(G,u,b,c,d,state,foundB)
- return False
- col[v]=n
- return True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement