{"id":20739287,"url":"https://github.com/ramy-badr-ahmed/kd-tree-python","last_synced_at":"2026-06-01T10:31:13.123Z","repository":{"id":255169280,"uuid":"848750369","full_name":"Ramy-Badr-Ahmed/KD-Tree-Python","owner":"Ramy-Badr-Ahmed","description":" KD-Tree Implementation in Python - https://doi.org/10.5281/zenodo.13384095","archived":false,"fork":false,"pushed_at":"2024-09-19T12:47:47.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-19T20:10:06.155Z","etag":null,"topics":["binary-space-partitioning","data-structures-and-algorithms","hypercube-points","kd-tree","nearest-neighbor-search","python","space-partitioning","spatial-indexing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ramy-Badr-Ahmed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-28T10:42:01.000Z","updated_at":"2024-09-19T12:47:51.000Z","dependencies_parsed_at":"2024-11-17T06:26:28.197Z","dependency_job_id":"fc74c7ae-9530-40d6-951f-15ca108356e9","html_url":"https://github.com/Ramy-Badr-Ahmed/KD-Tree-Python","commit_stats":null,"previous_names":["ramy-badr-ahmed/kd-tree-python"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Ramy-Badr-Ahmed/KD-Tree-Python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ramy-Badr-Ahmed%2FKD-Tree-Python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ramy-Badr-Ahmed%2FKD-Tree-Python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ramy-Badr-Ahmed%2FKD-Tree-Python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ramy-Badr-Ahmed%2FKD-Tree-Python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ramy-Badr-Ahmed","download_url":"https://codeload.github.com/Ramy-Badr-Ahmed/KD-Tree-Python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ramy-Badr-Ahmed%2FKD-Tree-Python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33771627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binary-space-partitioning","data-structures-and-algorithms","hypercube-points","kd-tree","nearest-neighbor-search","python","space-partitioning","spatial-indexing"],"created_at":"2024-11-17T06:24:21.832Z","updated_at":"2026-06-01T10:31:13.106Z","avatar_url":"https://github.com/Ramy-Badr-Ahmed.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Python](https://img.shields.io/badge/Python-3670A0?style=plastic\u0026logo=python\u0026logoColor=ffdd54) ![NumPy](https://img.shields.io/badge/Numpy-777BB4.svg?style=plastic\u0026logo=numpy\u0026logoColor=white) ![GitHub](https://img.shields.io/github/license/Ramy-Badr-Ahmed/KD-Tree-Python?style=plastic\u0026cached)\n\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.13384095.svg)](https://doi.org/10.5281/zenodo.13384095)\n\n# KD-Tree Implementation in Python\n\nThis repository contains Python implementation of the kd-tree data structure and performing k-nearest neighbour search.\n\nIts Matlab implementation is located here: [KD-Tree-Matlab](https://github.com/Ramy-Badr-Ahmed/KD-Tree-Matlab)\n\n### About\nThe kd-tree is a space-partitioning data structure for organizing points in a k-dimensional space.\n\n\u003e [Mathematica Link](https://reference.wolfram.com/language/ref/datastructure/KDTree.html)\n\n### Scripts\n\n1. `build_kdtree.py`\n\n   \u003e Builds a kd-tree from a set of points.\n\n2. `nearest_neighbour_search.py`\n\n   \u003e Performs nearest neighbour search using the built kd-tree.\n\n3. `hypercube_points.py`\n\n   \u003e Generates n-Dimensional Points Uniformly in an n-Dimensional Hypercube.\n\n### Example Usage\n\n```python\nfrom kdtree.build_kdtree import build_kdtree\nfrom kdtree.nearest_neighbor_search import nearest_neighbor_search\nfrom examples.hypercube_points import hypercube_points\n\nnum_points = 5000\ncube_size = 10\nnum_dimensions = 10\n\npoints = hypercube_points(num_points, cube_size, num_dimensions)\nhypercube_kdtree = build_kdtree(points.tolist())\n\nquery_point = np.random.rand(num_dimensions).tolist()\n\nnearest_point, nearest_dist, nodes_visited = nearest_neighbor_search(hypercube_kdtree, query_point)\n\nprint(f\"Query point: {query_point}\")\nprint(f\"Nearest point: {nearest_point}\")\nprint(f\"Distance: {nearest_dist:.4f}\")\nprint(f\"Nodes visited: {nodes_visited}\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framy-badr-ahmed%2Fkd-tree-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Framy-badr-ahmed%2Fkd-tree-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framy-badr-ahmed%2Fkd-tree-python/lists"}