Reputation: 582
Networkx appears to have a lot of random graph generators. Why are there so many and which should I choose?
fast_gnp_random_graph,
gnp_random_graph
dense_gnm_random_graph
gnm_random_graph
erdos_renyi_graph
binomial_graph
https://networkx.github.io/documentation/stable/reference/generators.html
Upvotes: 2
Views: 612
Reputation: 185
Some of them really are identical – i.e. just aliases for the purpose of convenience.
E.g. gnp_random_graph
= binomial_graph
= erdos_renyi_graph
.
They all generate the same type of graph but some use different algorithms that perform better or worse depending on the parameters/properties of your graph (size, density, ...). So there is no single best choice. (Even if there were, it may be of academic interest to some people to also have alternate algorithms available – e.g. for speed comparisons.)
Some also differ in the way you define/paramerterize your graph. E.g. Some use the number of nodes and the probability to grow an edge, while others are defined by the number of nodes and the number of edges.
Depending on your application one may be preferable to the other.
Upvotes: 3