{"id":19595971,"url":"https://github.com/innovativeinventor/balanced-edges","last_synced_at":"2025-02-26T14:40:55.521Z","repository":{"id":135191147,"uuid":"499579927","full_name":"InnovativeInventor/balanced-edges","owner":"InnovativeInventor","description":"Exploration of balanced edge seams for ReCombination MCMC graph partitioning in computational redistricting","archived":false,"fork":false,"pushed_at":"2022-08-20T17:45:23.000Z","size":33,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-09T07:21:13.320Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/InnovativeInventor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-03T16:32:36.000Z","updated_at":"2022-08-19T13:41:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"1fe6793b-cf37-423d-a81c-7c0440ff2068","html_url":"https://github.com/InnovativeInventor/balanced-edges","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InnovativeInventor%2Fbalanced-edges","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InnovativeInventor%2Fbalanced-edges/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InnovativeInventor%2Fbalanced-edges/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InnovativeInventor%2Fbalanced-edges/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InnovativeInventor","download_url":"https://codeload.github.com/InnovativeInventor/balanced-edges/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240874419,"owners_count":19871694,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T08:49:45.972Z","updated_at":"2025-02-26T14:40:55.151Z","avatar_url":"https://github.com/InnovativeInventor.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"## balanced-edges\nThe family of [ReCombination Markov Chains](https://hdsr.mitpress.mit.edu/pub/1ds8ptxu) (ReCom) have been used in redistricting to perform outlier analysis on gerrymandered maps.\nAt a high level, the precincts of a state can be represented as a dual graph. \nAdjacent districts get randomly merged, then split by drawing a spanning tree and finding a balanced edge to cut such that the population constraints of the redistricting problem are respected.\nThis method allows one to sample the space of plausible districting plans and make certain statistical claims about gerrymandered maps.\n\nThe original ReCom MCMC algo is not reversible. \nHowever, with a slight modification (by keeping track of certain probabilities), one can produce a reversible ReCom MCMC sampling method. [^1]\nIn order to sample properly, the reversible ReCom variant has to know the maximum length of a balanced edge seam, *M*, that can possibly occur while sampling.\n\nPreviously this was done through trial and error, however, with a recursive DFS search, we can establish firm upper bounds on *M* by reducing this problem down to a variant of the longest path problem.\nThe runtime for this implementation is somewhere around `O(v*2^d)` (it's DFS search for the longest path in the graph, not DFS for a particular node).\n\nNote: Since redistricting typically occurs on planar graphs, this is an [NP-hard problem](https://en.wikipedia.org/wiki/Longest_path_problem).\n\n## Usage\n\nBuild for release:\n```\nbash release.sh\n```\n\nExample usage (for MA senate, 40 districts, at 0.05 epsilon):\n```\n./target/release/balanced-edges -f ma-vtd-connected.json -d 40 -t 0.05\n```\nThis produces an upper bound of `9` in 23 seconds with 10 cores on my laptop.\n\n## Dual graphs\nDownload them from here: http://data.mggg.org.s3-website.us-east-2.amazonaws.com/dual-graphs/\nor generate them yourself.\n\n[^1]: This result is by Sarah Cannon, Moon Duchin, Dana Randall, and Parker Rule. (Preprint will be coming soon)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finnovativeinventor%2Fbalanced-edges","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finnovativeinventor%2Fbalanced-edges","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finnovativeinventor%2Fbalanced-edges/lists"}