Module mspace :: Class FastBKTree
[hide private]
[frames] | no frames]

Class FastBKTree

source code

object --+
         |
        FastBKTree



Simpler version of BKTree. The tree's content is kept in nested
dictionaries where a "node"'s value is simply stored at key -1 and
its children are stored using their distance to the value as the
key. Example:

self.root = { -1: 'ABC',
               0: { -1: 'ABC' }
               1: { -1: 'ABCD',
                     1: { -1: 'ABCE' }
                  }
               2: { -1: 'A',
                     1: { -1: 'B',
                           1: { -1: 'C' } 
                        }
                  }
            }

Instance Methods [hide private]
 
__init__(self, objects, metric)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
insert(self, obj) source code
 
range_search(self, obj, min_dist=0, max_dist=0) source code
 
search(self, obj, max_dist) source code
 
nn_search(self, obj, num=1) source code
 
__len__(self) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, objects, metric)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)