An open API service indexing awesome lists of open source software.

https://github.com/olaszpl/kdtree_quadtree_project


https://github.com/olaszpl/kdtree_quadtree_project

Last synced: 12 months ago
JSON representation

Awesome Lists containing this project

README

          

# KD-Tree & QuadTree Python library

## Table of Contents
- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)
- [Modules](#modules)
- [Testing](#testing)
- [Visualization](#visualization)
- [Documentation](#documentation)
- [License](#license)

## Introduction
This project provides an implementation of KD-tree and QuadTree data structures in Python. It includes tools for building, querying, and visualizing these trees. The project is designed to help understand the functionality and efficiency of KD-tree and QuadTree for various datasets.

![image](https://github.com/user-attachments/assets/3e6c779f-4060-4d99-8f4c-f803cf524277)

## Installation
To install the necessary dependencies, run:

```sh
pip install -r requirements.txt
```

## Usage
To use the KD-tree and QuadTree implementations, you can run the Jupyter Notebook `main.ipynb` (in Polish). This notebook provides a comprehensive interface for testing, visualizing, and comparing these two data structures.

### Running the Notebook
1. Open `main.ipynb` in Jupyter Notebook or JupyterLab (preferred VS Code).
2. Follow the instructions in the notebook cells to run tests, generate visualizations, and compare the performance of KD-tree and QuadTree.

## Modules

### KDTree
- `kdtree.py`: Contains the implementation of the KD-tree data structure.
- `kdtree_test.py`: Contains unit tests for the KD-tree implementation.
- `kdtree_visualizer.py`: Provides visualization tools for the KD-tree.

### QuadTree
- `quad.py`: Contains the implementation of the QuadTree data structure.

### Other Modules
- `automatic_tests.py`: Contains integration tests for both KD-tree and QuadTree.
- `generators.py`: Provides functions to generate various types of point datasets.
- `gui_creator.py`: Provides a graphical user interface for creating points and query ranges.
- `visualizer`: Contains visualization tools written by [_BIT Scientific Group_](https://github.com/aghbit/Algorytmy-Geometryczne) (no additional dependencies than those specified in the [Installation](#installation) are required).

## Testing
To run the unit tests for KD-tree, execute the following command:

```sh
python -m kdtree.kdtree_test
```

To run the integration tests, execute the following command:

```sh
python automatic_tests.py
```

## Visualization
The project includes tools for visualizing the construction and querying of KD-tree and QuadTree. These visualizations can be generated by running the cells in `main.ipynb`.

### KD-tree Visualization
- **Build Visualization**: Shows the process of building the KD-tree.

![output](https://github.com/user-attachments/assets/6c60ac6b-f950-44b6-a3e3-045b5e2f7417)

- **Query Visualization**: Shows the process of querying the KD-tree.

![output](https://github.com/user-attachments/assets/9c5b13bb-63f0-4e48-9ada-f6e0c36f0c8c)

### QuadTree Visualization
- **Build Visualization**: Shows the process of building the QuadTree.

![output](https://github.com/user-attachments/assets/3c3418f9-aae8-40e9-a8db-ef51819de88a)

- **Query Visualization**: Shows the process of querying the QuadTree.

![output](https://github.com/user-attachments/assets/9df73db4-e4fd-403c-978e-1677e322c376)

## Documentation
The project includes detailed documentation in the form of PDF files (in Polish). You can find the documentation in the `documentation` folder:

- [presentation](documentation/prezentacja.pdf): A presentation about the project.
- [documentation](documentation/dokumentacja.pdf): Detailed documentation of the project.

## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.