Davencode

Untitled

Sep 21st, 2021 (edited)
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. ALGO(G,B)
  2. INIT(G)
  3. GT=TRASPOSTA(G)
  4. for each v in B do
  5. if(c1[v]=bianco)then
  6. dfs_visit(GT,v,c1) //da b in B va a vedere al contrario quelli che raggiungerebbe b
  7. for each v in B do
  8. if(c2[v]=bianco)then
  9. dfs_visit(G,v,c2)
  10. for each v in V do
  11. if(c1[v]=nero && c2[v]=nero)then
  12. ret=false //non mi servono quei vertici per cui vale la mutua raggiungibilitĂ 
  13. else
  14. if(c1[v]=nero)then
  15. V1 = V1 U {v}
  16. else
  17. V2 = V2 U {v}
Add Comment
Please, Sign In to add comment