Input: graph G; node u; width k; depth ℓ
|
Output: signature Hu
|
1: Hu ← empty list |
⊳ append right |
2: Q ← empty queue |
⊳ FIFO data-structure; pop left (get and remove); append right |
3: Q ← append π = (u) |
⊳ π is the zero-length, single-node path |
4: while
Q is not empty do
|
|
5: π = (u, …, vh) ← pop path from Q
|
|
6: Hu ← append f(π) |
|
7: if
h < ℓ
then
|
⊳ h is the length of π
|
8: πz ← (u, …, vh, z), ∀z ∈ V
|
⊳ if (vh, z) ∉ E then w(vh, z) = 0 ⇒ f(πz) = 0 |
9: z1, …, zn ← nodes s.t. f(πz1) ≥ … ≥ f(πzn) |
⊳ ties broken uniformly at random |
10: Q ← append the k paths πz1,…,πzk. |
|
11: end if
|
|
12: end while
|
|
13: return
Hu
|
|