Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial EmbeddedGraph implementation. #390

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

pizzimathy
Copy link
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