SHARE
TWEET

Untitled

a guest Feb 20th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ALGO(G, s, A, k)
  2.     return BFS(G, s, A, k)
  3.  
  4. BFS(G, s, A, k)
  5.     INIT(G)
  6.     c[s]=g
  7.     d[s]=0
  8.     Q={s}
  9.     while (Q != NULL) do
  10.         v=First(Q)
  11.         for each (u in Adj[v]) do
  12.             if (u in A && d[v]+1 <= k) then
  13.                 return false
  14.             if (c[u] = b) then
  15.                 c[u]=g
  16.                 d[u]=d[v]+1
  17.                 Q=Enqueue(Q, u)
  18.         c[v]=n
  19.         Q=Dequeue(Q)
  20.     return true
  21.  
  22. INIT(G)
  23.     for each (v in V) do
  24.         c[v]=b
  25.         d[v]="simbolo infinito"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top