Given N
points in a map of edges Map<Point, List<Edge>>
, it's possible to get the polygons formed by these edges in O(N log N)
?
What I know is that you have to walk all the vertices and get the edges containing that vertex as a starting point. These are edges of a voronoi diagram, and each vertex has, at most, 3 artists containing it. So, in the map, the key is a vertex, and the value is a list where the vertex is the start node.
For example:
Points: a,b,c,d,e,f,g
Edges: [a,b]; [a,c]; [a,d], [b,c], [d,e], [e,g], [g,f]
My idea is to iterate the map counterclockwise until I get the initial vertex. That is a polygon, then I put it in a list of polygons and keep looking for others. The problem is I do not want to overcome the complexity O(N log N)
Thanks!
O(N log N)
bound, meaning that in such cases the complexity you aim for is not achievable. Are you interested in all polygons, or e.g. polygons with non-intersecting sets of vertices? – Forficate