Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Algo(G,a,b,c)
- INIT(G)
- DFS_VISIT(G,a,c1)
- if(c1[b]=nero)then
- DFS_VISIT(G,b,c2)
- if(c2[c]=nero)then
- DFS_VISIT(G,c,c3)
- if(c1[b]=nero && c2[c]=nero)then
- DFS_CICLO(G,a,b,c)
- DFS_VISIT(G,a,c)
- c[a]=grigio
- for each u € adj[a] do
- if(c[u]=bianco)then
- DFS_VISIT(G,u,c)
- c[a]=nero
- DFS_CICLO(G,x,c)
- c[x]=grigio
- for each u € adj[x] do
- if(c[u]=bianco)then
- DFS_CICLO(G,u,c)
- else if(c[u]=grigio)then
- if(u!=c)then
- return true
- c[x]=nero
- INIT(G)
- For each v in V do
- c1[v]=bianco
- c2[v]=bianco
- c3[v]=bianco
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement