How to find polygons in a given set of points and edges?
问题 Consider the following problem: Given N points in plane and M line segments connecting them, find all polygons (convex or concave) that do not contain any other polygons inside. For instance: There are 5 polygons founded: 1 - 2 - 5 - 6 2 - 3 - 5 3 - 4 - 5 7 - 8 - 9 10 - 13 - 20 - 12 - 11 How can I identify these polygons and there corresponding vertices and edges? And what is the fastest solution for this? 回答1: Build graph with segment ends as vertices and segments as edges, then find cycles