Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ALGO(G,a,b,c,d)
- INIT(G)
- DFS_visit(G,a) //classica DFS
- if col[b]=n then
- if isCiclico(G,b) then
- INIT(G)
- col[c]=col[d]=n
- DFS_visit(G,a)
- if col[b]=n then
- return false
- return true
- isCiclico(G,v)
- INIT(G)
- return !DFS_visit_mod(G,v)
- DFS_visit_mod(G, v)
- col[v]=g
- for each u€Adj[v] do
- if col[u]=b then
- return DFS_visit_mod(G,u)
- else if col[u]=g then
- return false
- col[v]=n
- return true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement