No project description provided
Project description
kdtreePython
KDTree implementation with the support of weights. Each node created will be associated with a weight. Every node stores the weight associated to that package, the minimum weight in that subtree and the maximum weight.
Example:
- Creating kdtree
from weighted_kdtree import kdtree
points = [(12,34), (25,36), (9,10), (5, 15), (30, 20), (20, 27)]
weights = [10, 20, 12, 20, 30, 28]
kd_tree = kdtree.KDTree(points, weights)
- Preorder Traversal
kdtree.KDTree.preorderTraversal(kd_tree.root)
[[(9, 10)], [(12, 34)], [(5, 15)], [(30, 20)], [(25, 36)], [(20, 27)]]
- Weights
kd_tree.root.val, kd_tree.root.weight["weight"], kd_tree.root.weight["minWeight"], kd_tree.root.weight["maxWeight"]
((20, 27), 28, 30, 10)
- Nearest Neighbor
kdtree.KDTree.nnKDTree((10, 20), kd_tree.root, 15, 3)
[(10.04987562112089, (9, 10)),
(12.206555615733702, (20, 27)),
(14.142135623730951, (12, 34))]
Future work: Following weights related methods are to be added soon:
- nearestNeighbor
- Find points in a query rectangle with a weight threshold
- Point with minimum weight in a query rectangle
- Point with maximum weight in a query rectangle
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file weighted_kdtree-0.1.1-py3-none-any.whl.
File metadata
- Download URL: weighted_kdtree-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
036427019d78362d967970bd60eda2b8cdcf7c50aeccaccba4d33e753a365424
|
|
| MD5 |
826e6db76bd99f94246e3a3c807af533
|
|
| BLAKE2b-256 |
25381e9ef05c2c64a598eb4e9d3d3347ab749d1c4f7401a9b973ed3b1cb713fb
|