Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Algo (G,s,B,C)
- INIT(G)
- L=NIL
- GT=TRASPOSTA(G)
- DFS_VISIT(GT, s, c1)
- For each y in C do
- if [ c[y] = NERO ] then //verifico se dopo la DFS_VISIT qualche vertice di C è diventato nero
- return FALSE
- else
- return TRUE //altrimenti qui vuol dire che non c'è stato un vertice nero
- if (ret = TRUE) then
- for each x in B do
- if [ c[x] = NERO ] then
- INIT(G)
- DFS_VISIT(G,x,c)
- L=ADD(L,x)
- return L
- INIT(G)
- for each v in V do
- c[v]=bianco
- DFS_VISIT(G,s,c)
- c[s]=GRIGIO
- for each u € ADJ[s] do
- if ( c[u]=bianco) then
- DFS_VISIT(G,u,c)
- c[s]=NERO
- TRASPOSTA(G)
- VT=T
- for each v € VT do
- for each s € ADJT[v] do
- ADJT[s]=ADD(ADJT[s],v)
- return (<VT,ADJT>)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement