Skip to content

Initial EmbeddedGraph implementation.#390

Open
pizzimathy wants to merge 2 commits intomggg:mainfrom
pizzimathy:feature/embedded-graph
Open

Initial EmbeddedGraph implementation.#390
pizzimathy wants to merge 2 commits intomggg:mainfrom
pizzimathy:feature/embedded-graph

Conversation

@pizzimathy
Copy link
Copy Markdown
Member

Because we are often interested in contour-based compactness scores (e.g. Polsby-Popper, Reock, Convex Hull, etc.), this implements the EmbeddedGraph class where each networkx node stores information about the (multi)polygon to which it's dual. Exterior nodes – those which form the boundary of the jurisdiction – store all the points from their dual polygons, while interior nodes store only the points on their dual polygons' convex hulls. This accomplishes a few things:

  1. first, we can easily access geometric information about the graph's embedding (or, rather, the embedding of the set of polygons to which the graph is dual) and modify it easily;
  2. the above enables us to – with some other optimizations/tricks – quickly calculate contour-based compactness scores without storing or otherwise keeping track of extraneous geometric information in other formats (e.g. shapefiles, GeoJSON;
  3. if we choose not to calculate compactness scores during chain runs, we can store only assignments, then re-project and score after-the-fact.

This is of course a WIP and needs feedback from everyone, but I believe it's a useful tool and can serve us well in future.

@pjrule pjrule added the summer-project Summer projects for 2023 and beyond label Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

summer-project Summer projects for 2023 and beyond work-in-progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants