-
Notifications
You must be signed in to change notification settings - Fork 161
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
Add configuration model #796
base: main
Are you sure you want to change the base?
Conversation
|
Pull Request Test Coverage Report for Build 4032314256
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing this! This is neat.
I will have to read the paper to give a better review of the code, but I do have a question about graph realization right off the bat
Some(seed) => Pcg64::seed_from_u64(seed), | ||
None => Pcg64::from_entropy(), | ||
}; | ||
let degree_sequence = match core_generators::DegreeSequence::new(degree_sequence) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to check this degree sequence with Erdős–Gallai? Or do you return a graph that might not be a simple graph?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The graph may not be simple. The generator in NetworkX works in a similar fashion: https://networkx.org/documentation/stable/reference/generated/networkx.generators.degree_seq.configuration_model.html#configuration-model
At some point, it would be good to add a parameter to DegreeSequence
constructors that specifies that the degree sequence must be graphical.
Also, you'll have to update |
} | ||
if sum % 2 == 1 { | ||
let index = rng.gen_range(0..length); | ||
degree_sequence[index] += 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This felt like a "pragmatic" way of ensuring that the sum is even. However, this could lead to out-of-distribution values in the sequence which is probably confusing for the user. Not sure how to fix it. Probably just retry n times?
Added a possibility to generate a random graph using a configuration model. The result is a random graph with a given degree sequence. The Rust library can additionally generate degree sequences from any
Distribution
.