Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Algo(G,s,u,VAL[])
- INIT(G)
- L1=NIL
- L2=NIL
- DFS_VISIT(G,s,c) //effettuo una comune DFS_VISIT
- DFS_VISITPARI(G,s,c2,i,L1)
- DFS_VISITDISPARI(G,s,c3,i,L2)
- --------------------------------
- //La DFS che effettuo s'incentra sul visitare comunemente i vertici poi nel caso becca una condizione
- di percorso infinito verifico oltre a quella condizione se quel c[u] adiacente è proprio u e in tal caso
- ritorno true e dovrei riuscire nel primo punto
- DFS_VISIT(G,s,c)
- c[s]=grigio
- for each u € adj[s] do
- if(c[u]=bianco)then
- DFS_VISIT(G,u,c)
- else if(c[u]=grigio && c[u]=u)then
- return true
- else
- return false
- c[s]=nero
- --------------------------------
- //DFS_VISITPARI(G,s,c2,i,L1)
- c[s]=grigio
- for each u € adj[s] do
- if(c[u]=bianco)then
- DFS_VISITPARI(G,u,c2,i+1)
- else if(c[u]=grigio)then
- if(i%2=0)then
- L1=ADD(L1,u)
- c[s]=nero
- --------------------------------
- //DFS_VISITDISPARI(G,s,c3,i,L2)
- c[s]=grigio
- for each u € adj[s] do
- if(c[u]=bianco)then
- DFS_VISITDISPARI(G,u,c3,i+1)
- else if(c[u]=grigio)then
- if !(i%2=0) then
- L2=ADD(L2,u)
- c[s]=nero
Add Comment
Please, Sign In to add comment