https://github.com/kumaarbalbir/n-neighbor-kdtree
kd tree based nearest neighbour search
https://github.com/kumaarbalbir/n-neighbor-kdtree
c kd-tree python3
Last synced: 6 months ago
JSON representation
kd tree based nearest neighbour search
- Host: GitHub
- URL: https://github.com/kumaarbalbir/n-neighbor-kdtree
- Owner: KumaarBalbir
- Created: 2025-04-06T05:08:48.000Z (6 months ago)
- Default Branch: development
- Last Pushed: 2025-04-06T06:24:30.000Z (6 months ago)
- Last Synced: 2025-04-06T07:26:23.862Z (6 months ago)
- Topics: c, kd-tree, python3
- Language: C
- Homepage:
- Size: 313 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Nearest Neighbor Search using K-d Tree
Allows querying the closest point (e.g., restaurant or location) to a given latitude and longitude from a CSV dataset. The python client uses subprocess to run the `nearest_neighbor` executable with the given latitude and longitude as arguments. The output is a JSON object with the name, latitude, and longitude of the nearest point. The python client also plots the nearest point on a map using matplotlib and saves the plot as a PNG file in the `output` directory.
All data points are from the Zomato restaurant dataset downloaded from kaggle.
#### Cloning the repository
```bash
git clone https://github.com/KumaarBalbir/n-neighbor-kdtree.git
```#### Usage
first go to the root directory of the project.
- To build the project, run the following command:
```bash
make clean && make
```
This will compile the program and create the `nearest_neighbor` executable in the `build` directory.- To run **only** the `main.c` application (kd-tree) after building with `make`, run the following command:
```bash
./build/nearest_neighbor
```
This will run the program with the given latitude and longitude.- To run the python client for plotting the nearest restaurant (basic line plot), run the following command:
```bash
python3 client/client.py
```
This will run the client script, which will prompt you to enter a latitude and longitude.press enter to use the default values of 3 and 4.
#### example plot
