Research Article
A Log-Based Anomaly Detection Method with Efficient Neighbor Searching and Automatic K Neighbor Selection
Algorithm 2
The neighbor searching algorithm of MVP-tree.
| Require: The sample to be detected , the distance threshold r | | Ensure: The nearest sample | (1) | function QueryTree | (2) | Compute , | (3) | ifthen return | (4) | end if | (5) | ifthen return | (6) | end if | (7) | For the leaf tree nodes, goto (8), for the intermediate tree nodes, goto (16) | (8) | fordo | (9) | if and then | (10) | if, then | (11) | ifthen return | (12) | end if | (13) | end if | (14) | end if | (15) | end for | (16) | ifthen | (17) | | (18) | end if | (19) | ifthen | (20) | | (21) | end if | (22) | ifthen | (23) | ifthen | (24) | , goto (23) for recursion | (25) | end if | (26) | ifthen | (27) | , goto (26) for recursion | (28) | end if | (29) | end if | (30) | ifthen | (31) | ifthen | (32) | , goto (31) for recursion | (33) | end if | (34) | ifthen | (35) | , goto (34) for recursion | (36) | end if | (37) | end if | (38) | end function |
|