Advertisement
Davencode

Untitled

Sep 8th, 2021
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. Algo(G,a,b,c)
  2. INIT(G)
  3. DFS_VISIT(G,a,c1)
  4. if(c1[b]=nero)then
  5. DFS_VISIT(G,b,c2)
  6. if(c2[c]=nero)then
  7. DFS_VISIT(G,c,c3)
  8. if(c1[b]=nero && c2[c]=nero)then
  9. DFS_CICLO(G,a,b,c)
  10.  
  11.  
  12. DFS_VISIT(G,a,c)
  13. c[a]=grigio
  14. for each u € adj[a] do
  15. if(c[u]=bianco)then
  16. DFS_VISIT(G,u,c)
  17. c[a]=nero
  18.  
  19. DFS_CICLO(G,x,c)
  20. c[x]=grigio
  21. for each u € adj[x] do
  22. if(c[u]=bianco)then
  23. DFS_CICLO(G,u,c)
  24. else if(c[u]=grigio)then
  25. if(u!=c)then
  26. return true
  27. c[x]=nero
  28.  
  29. INIT(G)
  30. For each v in V do
  31. c1[v]=bianco
  32. c2[v]=bianco
  33. c3[v]=bianco
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement