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

Added types and note to erdos_renyi function #340

Merged
merged 2 commits into from
Feb 9, 2024

Conversation

henrik-wolf
Copy link
Contributor

I added typed-definitions to the docstring of erdos_renyi, as we differentiate the two different definitions of the Erdös-Rényi ensemble by dispatching on the type of the second argument.

As I spent some time with the strange edge case of erdos_renyi(n, 1) != erdos_renyi(n , 1.0) today this feels like a good idea.

Copy link

codecov bot commented Feb 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (f6f8db6) 97.28% compared to head (11fe08f) 97.28%.
Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #340   +/-   ##
=======================================
  Coverage   97.28%   97.28%           
=======================================
  Files         115      115           
  Lines        6789     6789           
=======================================
  Hits         6605     6605           
  Misses        184      184           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@simonschoelly simonschoelly left a comment

Choose a reason for hiding this comment

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

I like these changes.

Eventually we should fix this mess and use something like erdos_renyi(n; probability=0.1) and erdos_renyi(n; num_edges=23).

Approved, but will merge it later, so someone else will have time to comment on this if they have a different opinion.

And don't worry about the failing tests, nightly is currently broken.

@gdalle
Copy link
Member

gdalle commented Feb 8, 2024

Some notes:

  • nightly isn't broken, JET is just more sensitive, so we'll have to fix it ourselves eventually (but not here of course), see Tests failing on nightly #338
  • DocStringExtensions.jl might be a good tool in the future to automatically generate typed signatures in the docstrings and avoid this uncertainty

@simonschoelly
Copy link
Member

* DocStringExtensions.jl might be a good tool in the future to automatically generate typed signatures in the docstrings and avoid this uncertainty

Afaik it is not always recommended to put the type signature in the doc string. This is anyways a special case, because Integer as subtype of a Real leads to a different behavior - something that I don't think is very desirable.

@simonschoelly simonschoelly merged commit 6028f5e into JuliaGraphs:master Feb 9, 2024
9 of 12 checks passed
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.

3 participants