Input: a function f and its Voronoi tree T |
Output: the left valley site of each Voronoi edge, represented by ValleyL (•), the right valley site of each Voronoi edge, represented by ValleyR (•), the peak site of each Voronoi edge, represented by Peak (•), and the prominence of each Voronoi edge, represented by Prominence (•) |
Begin |
(1)for each Voronoi edge e in T do //T is visited in a bottom-up order. |
(2) Let the two input sites be pi and pj with i ≤ j. |
(3) if j = i then //in this case e is a leaf node. |
(4) Peak(e) = ValleyL(e) = ValleyR(e) = pi |
(5) else |
(6) let the first and second child nodes of e be, respectively, e1 and e2 |
(7) if y(Peak (e1)) < y(Peak (e2)) then |
(8) Peak (e) = Peak (e2) |
(9) ValleyL (e) = the lowest of ValleyL (e1), ValleyR (e1), and ValleyL (e2) |
(10) ValleyR (e) = ValleyR (e2) |
(11) else |
(12) Peak (e) = Peak (e1) |
(13) ValleyL (e) = ValleyL (e1) |
(14) ValleyR (e) = the lowest of ValleyR (e1), ValleyL (e2), and ValleyR (e2) |
(15) Prominence(e) = y(Peak (e))−max(y(ValleyL (e)), y(ValleyR (e))) |
(16)return ValleyL (•), ValleyR (•), Peak (•), and Prominence (•). |
End |