Skip to content

A QuadTree Implementation using Python and visualizer in PyGame

Notifications You must be signed in to change notification settings

rishabhsinghvi/QuadTree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

QuadTree

A QuadTree implementation using Python, with a visualizer written using PyGame.

The QuadTree uses a maximum capacity of 5 points per quad, although it can be changed.

To run the code:

  1. Install packages using pip:
pip install -r requirements.txt
  1. To run the visualizer:
python QuadTree.py -v

or alternatively,

python QuadTree.py --visualize

To use the visualizer, simply click on the window where you want to insert a point. The children of the quadtree are automatically created once the number of points exceeds the maximum capacity.

Example of the visualizer:

Visualizer

  1. To run the visualizer with random points:
python QuadTree.py -rv

or alternatively,

python QuadTree.py --random

Example of the visualizer:

Visualizer

The visualizer inserts a point every 60 frames, which should translate to 1 second on most systems.

  1. To plot speedup between linear and quadtree search, simply run the script with the argument -p or --plot

Example, with 4000 points and the search point in the middle of the linear array.

Plot

About

A QuadTree Implementation using Python and visualizer in PyGame

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages