Task
Compute the dual graph from a set of non-overlapping (but touching) polygons.
Example
Polygons A, B and C, their partially shared coordinates 1—22 (yellow) and the dual graph (blue).
Data
I have a set S of polygons. Every polygon Pi is represented as ordered list of coordinates. The edge a — b of a polygon Pi is denoted by Pi,(a,b)
Idea
The polygons represent the faces and hence the nodes of the dual graph. To identify adjacent faces of the polygon Pi just compare every edge of Pi with every edge of every other polygon Pj. If the edge is shared by the other polygon then Pi and Pj are adjacent.
This will create a significant amount of multiple edges which can be removed later.
Problem
The algorithm is not very efficient as it runs in O(E2) where E denotes the number of edges of the set S of polygons.
Improvement ideas
Create an edge-index in a first-step. This will reduce running-time to O(2×E) = O(E)
Remove every node with degree 2. (I think this won't affect the dual graph?)
Questions
- Am I on the right track?
- Are there any approved algorithms for this task?