{"id":31955714,"url":"https://github.com/theronwolcott/data-structure-kdtree-prquadtree","last_synced_at":"2025-10-14T14:27:27.746Z","repository":{"id":310703822,"uuid":"774678742","full_name":"theronwolcott/data-structure-kdtree-prquadtree","owner":"theronwolcott","description":"Implemented KD-Trees and PR-QuadTrees with efficient spatial queries, using inheritance and polymorphism. Optimized k-NN and range searches, dynamic node transformations, and geometric computations for high performance.","archived":false,"fork":false,"pushed_at":"2025-08-19T17:36:08.000Z","size":412,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-19T19:34:42.168Z","etag":null,"topics":["data-structures","java","trees"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theronwolcott.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2024-03-20T01:13:08.000Z","updated_at":"2025-08-19T17:36:12.000Z","dependencies_parsed_at":"2025-08-21T23:18:48.865Z","dependency_job_id":null,"html_url":"https://github.com/theronwolcott/data-structure-kdtree-prquadtree","commit_stats":null,"previous_names":["theronwolcott/data-structure-kdtree-prquadtree"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/theronwolcott/data-structure-kdtree-prquadtree","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theronwolcott%2Fdata-structure-kdtree-prquadtree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theronwolcott%2Fdata-structure-kdtree-prquadtree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theronwolcott%2Fdata-structure-kdtree-prquadtree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theronwolcott%2Fdata-structure-kdtree-prquadtree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theronwolcott","download_url":"https://codeload.github.com/theronwolcott/data-structure-kdtree-prquadtree/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theronwolcott%2Fdata-structure-kdtree-prquadtree/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279019119,"owners_count":26086680,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"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":["data-structures","java","trees"],"created_at":"2025-10-14T14:27:24.861Z","updated_at":"2025-10-14T14:27:27.738Z","avatar_url":"https://github.com/theronwolcott.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KD-Trees and PR-QuadTrees\n\n## Overview\nThis project is an implementation of two essential spatial data structures: **KD-Trees** and **Point-Region (PR) QuadTrees**. It showcases the application of **object-oriented programming** principles, specifically **inheritance** and **polymorphism**, to build efficient, modular, and reusable components. The project demonstrates expertise in handling spatial data, designing algorithms for spatial queries, and implementing advanced data structures for multi-dimensional indexing.\n\n## Features\n\n### 1. KD-Tree Implementation\n- **Node Management**: Implemented the `KDTreeNode` class, enabling hierarchical multi-dimensional indexing.\n- **Nearest Neighbor Queries**: Efficiently performed \\( k \\)-nearest neighbor searches using heuristic and branch-and-bound techniques.\n- **Bounded Priority Queue**: Designed a custom `BoundedPriorityQueue` to manage the top-\\( k \\) nearest neighbors, adhering to elementary efficiency principles.\n- **Range Queries**: Implemented range search queries to retrieve all points within a specified range efficiently.\n\n### 2. PR-QuadTree Implementation\n- **Dynamic Node Management**: Implemented `PRQuadBlackNode` and `PRQuadGrayNode` classes to handle black and gray nodes dynamically based on the state of the tree.\n- **Spatial Queries**: Designed and implemented range and \\( k \\)-nearest neighbor search algorithms optimized for PR-QuadTrees.\n- **Region Splitting**: Developed logic for region splitting with precise geometric boundaries, handling edge cases with a `CentroidAccuracyException` for minimum region sizes.\n- **Polymorphism**: Leveraged the abstract `PRQuadNode` class to handle node operations polymorphically.\n\n## Project Highlights\n\n### Code Structure\nThe project is organized into two main components:\n\n#### KD-Trees\n- `KDTree`: The main class provided, delegating operations to `KDTreeNode`.\n- `KDTreeNode`: Handles core KD-Tree functionality like insertion, deletion, and spatial queries.\n- `BoundedPriorityQueue`: Manages the top-\\( k \\) neighbors efficiently for nearest neighbor queries.\n\n#### PR-QuadTrees\n- `PRQuadTree`: The main class provided, delegating operations to the node classes.\n- `PRQuadBlackNode`: Represents leaf nodes containing points.\n- `PRQuadGrayNode`: Represents internal nodes, managing up to four child quadrants.\n- `PRQuadNode`: Abstract class defining the common interface for all node types.\n\n### Design Principles\n- **Efficiency**: Avoided naive search methods, employing heuristic-driven spatial query algorithms.\n- **Modularity**: Built reusable and extensible components adhering to object-oriented programming best practices.\n- **Error Handling**: Introduced exception handling (`CentroidAccuracyException`) to manage edge cases robustly.\n\n### Algorithms\n- Implemented range queries using a combination of depth-first traversal and geometric intersection checks.\n- Designed nearest neighbor queries with descending (greedy) and ascending (pruning) phases for optimal performance.\n- Ensured \\( k \\)-NN queries exclude the anchor point, as required.\n\n### Testing\n- Comprehensive unit tests for all components, including edge cases and performance benchmarks.\n- Visualizations of trees using the provided `treeDescription()` methods for KD-Trees and PR-QuadTrees.\n\n## Challenges Overcome\n- Designed recursive algorithms for dynamic node transformations in PR-QuadTrees.\n- Handled mutable `KDPoint` objects without aliasing by employing deep copies.\n- Optimized spatial queries to minimize unnecessary traversal and maximize efficiency.\n\n## Key Learnings\n- Gained proficiency in implementing advanced spatial data structures and algorithms.\n- Deepened understanding of geometric computations and their application in computer science.\n- Strengthened object-oriented programming skills, including inheritance, polymorphism, and encapsulation.\n\n## Usage\nThis project can be used as a reference or foundation for applications in:\n- Geographic Information Systems (GIS)\n- Computer Graphics\n- Robotics (e.g., obstacle avoidance)\n- Game Development (e.g., collision detection)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheronwolcott%2Fdata-structure-kdtree-prquadtree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheronwolcott%2Fdata-structure-kdtree-prquadtree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheronwolcott%2Fdata-structure-kdtree-prquadtree/lists"}