Search code examples
javagraphpartitioninggraph-algorithmquadtree

How to partition a graph using a quadtree?


I have a program that allows the user to draw vertices and edges on a JFrame of size 1000 by 750. Now I need to use a quadtree to partition the input graph depending on how many vertices there are in a single quadrant. I would really appreciate it if someone can point me in the right direction on how to achieve this?

Additional information: I have an Edge class which stores: source (vertex), target (vertex) and weight. I have a Vertex class which stores: name, x-coordinates, y-coordinates, and Edge[] adjacentList. I also have a Graph class which stores two ArrayLists: edges and vertices.


Solution

  • I've recently implemented code, that should solve your problem. It's free for download on my recent blog post. Quadtrees for Space Decomposition, Java Implementation http://kirstywilliams.co.uk/blog/2012/08/quadtrees-java-implementation/