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

Balance edges algos separate file #96

Merged
merged 5 commits into from
Dec 22, 2020
Merged

Conversation

bsuwal
Copy link
Contributor

@bsuwal bsuwal commented Dec 16, 2020

The currently used balanced edge algorithm are in a new file, balance_edges.jl.

Made a corresponding test file.

Changed the name of weighted_kruskal_mst() to random_kruskal_mst() and made the latter take the latter generate the random weights.

I introduced no new code, only renamed functions and introduced 2 new files, and moved some previously written code into them.

All of these changes are derived from #94 , but that PR is a bit too big, and has some type changes so this is the first in what I foresee about 5 small PRs that will comprise the changes in #94.

@codecov-io
Copy link

Codecov Report

Merging #96 (9f5e2fd) into main (489f9c3) will decrease coverage by 1.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #96      +/-   ##
==========================================
- Coverage   91.18%   90.10%   -1.08%     
==========================================
  Files          12       13       +1     
  Lines         771      667     -104     
==========================================
- Hits          703      601     -102     
+ Misses         68       66       -2     
Impacted Files Coverage Δ
src/GerryChain.jl 100.00% <ø> (ø)
src/graph.jl 98.78% <ø> (-0.30%) ⬇️
src/balance_edges.jl 100.00% <100.00%> (ø)
src/recom.jl 95.65% <100.00%> (+0.65%) ⬆️
src/accept.jl 90.00% <0.00%> (-2.86%) ⬇️
src/plot.jl 72.72% <0.00%> (-2.69%) ⬇️
src/scores.jl 79.21% <0.00%> (-2.43%) ⬇️
src/partition.jl 91.52% <0.00%> (-1.02%) ⬇️
src/geo.jl 95.55% <0.00%> (-0.60%) ⬇️
src/flip.jl 97.82% <0.00%> (-0.33%) ⬇️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 489f9c3...9f5e2fd. Read the comment docs.

Copy link
Collaborator

@sunnymatt sunnymatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay for this! Just a few tiny notes (including a request for an additional test) but overall looks fantastic.

image


*Returns* a BitSet of edges that form a mst.
"""
function random_kruskal_mst(graph::BaseGraph,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the functions being split like this! Clean and concise and easy to understand. Yay!


""" Refer to test/graph.jl to see the test graph being loaded
"""

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also write a tiny test for the kruskal_mst method if it's not too much trouble? 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

of course!!! thanks for keeping me honest

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done and passed!

@bsuwal bsuwal merged commit 3db8b18 into main Dec 22, 2020
@bsuwal bsuwal deleted the balance-edges-algos-separate-file branch December 22, 2020 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants