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

Harmonize code and improve docs #23

Merged
merged 15 commits into from
Dec 21, 2021
Merged

Harmonize code and improve docs #23

merged 15 commits into from
Dec 21, 2021

Conversation

gdalle
Copy link
Member

@gdalle gdalle commented Nov 28, 2021

Hey there,
I spent some time improving code quality in the package, standardizing notations, adding docstrings, that kind of things. I would love some feedback on this, especially since I seem to have broken the doctests on saving graphs to file. Since IO is not my strong suit, contributions are welcome!

@gdalle gdalle requested a review from bramtayl November 28, 2021 09:02
@gdalle
Copy link
Member Author

gdalle commented Nov 28, 2021

I think I might also have broken compatibility with 1.0 by splitting test, docs and main dependencies using separate Project.toml files

@mschauer
Copy link

Yeah, that’s post-1.0.

@gdalle
Copy link
Member Author

gdalle commented Nov 28, 2021

Yeah, that’s post-1.0.

Is it bad? I don't realize how many people are still stuck with 1.0.

@mschauer would you like to review?

src/metagraph.jl Outdated
} <: AbstractGraph{T}
graph::Graph
vprops::Dict{Label,Tuple{T,VertexMeta}}
labels::Dict{T,Label}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was never much of a fan of these fieldnames. I kept them to match with the original MetaGraphs. I think abbreviations make code hard to read, so I would have chosen something like vertex_codes and vertex_properties. If we are changing the fieldnames, though, we might want to release a new minor version, because we documented them and someone might be relying on them.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree with you on this. In fact, that is the convention I chose for my own personal twist on MetaGraphsNext, DataGraphs. I'll change it here then.

In any case, I think a PR of this size warrants a minor version release

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, maybe I misread. Why are you splitting up the label -> (code, metadata) Dict? Seems like that could lead to extra allocations?

@bramtayl
Copy link
Collaborator

bramtayl commented Nov 29, 2021

Looks good to me (pending fixing CI)! Writing isn't my strong suit, so I'm glad you're working on it.

@gdalle
Copy link
Member Author

gdalle commented Nov 29, 2021

Looks good to me (pending fixing CI)! Writing isn't my strong suit, so I'm glad you're working on it.

Regarding the CI fix:

  • Do you have any idea what causes the test failure when exporting to a file?
  • Is it okay if we leave version 1.0 behind to embrace the new Project.toml recommendations?

@codecov
Copy link

codecov bot commented Nov 29, 2021

Codecov Report

Merging #23 (a868f25) into master (307fe68) will decrease coverage by 8.03%.
The diff coverage is 89.80%.

Impacted file tree graph

@@             Coverage Diff             @@
##            master      #23      +/-   ##
===========================================
- Coverage   100.00%   91.96%   -8.04%     
===========================================
  Files            8        7       -1     
  Lines          230      224       -6     
===========================================
- Hits           230      206      -24     
- Misses           0       18      +18     
Impacted Files Coverage Δ
src/metagraph.jl 84.61% <81.81%> (-15.39%) ⬇️
src/graphs.jl 82.95% <82.19%> (-17.05%) ⬇️
src/dict_utils.jl 96.77% <96.42%> (-3.23%) ⬇️
src/metadigraph.jl 100.00% <100.00%> (ø)
src/metaundigraph.jl 100.00% <100.00%> (ø)
src/persistence.jl 100.00% <100.00%> (ø)
src/weights.jl 100.00% <100.00%> (ø)

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 307fe68...a868f25. Read the comment docs.

@bramtayl
Copy link
Collaborator

I think it's probably a good idea to keep 1.0 compatibility unless it becomes unmanageable, just in case.

@gdalle
Copy link
Member Author

gdalle commented Nov 29, 2021

I think it's probably a good idea to keep 1.0 compatibility unless it becomes unmanageable, just in case.

Yes, I went back on that :)

@gdalle
Copy link
Member Author

gdalle commented Nov 29, 2021

I only have to rename the fields and I think I'll be done

@bramtayl
Copy link
Collaborator

I'm still a bit concerned about this #23 (comment)

@gdalle
Copy link
Member Author

gdalle commented Nov 30, 2021

I'm still a bit concerned about this #23 (comment)

Where do you fear extra allocations?

@bramtayl
Copy link
Collaborator

I mean, I'm not 100% sure, but I suspect 2 dicts rather than 1 will lead to extra allocations?

@gdalle
Copy link
Member Author

gdalle commented Nov 30, 2021

It is indeed very possible, but I think the gain in clarity may be worth it 🤷
At any rate, we won't be sure about performance until we benchmark. Btw I also removed some @inline statements since you told me a while ago that you didn't know they were there.
I'll read through the code again and assess how much work it would be to change that back

@gdalle
Copy link
Member Author

gdalle commented Dec 21, 2021

OK @bramtayl I reverted the changes I made and went back to one single vertex_properties dictionary for now. I think it might be better for adding vertices, but maybe not for modifying their metadata without changing their code.
Should we issue a new release following this merge?

@gdalle gdalle merged commit 8ac9017 into JuliaGraphs:master Dec 21, 2021
@bramtayl
Copy link
Collaborator

Sure

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.

None yet

3 participants