Closed erlebach closed 4 years ago
This is known behavior and it impacts most random graph generators that add edges iteratively. The reason it's happening is because as the number of edges already selected approaches V(V-1)
, the probability that the algorithm chooses a random edge that does not exist approaches 1 / (V(V-1))
.
This is, incidentally, a good example of why it is not a good idea to benchmark stochastic processes.
Description of bug The
LightGraphs
methodwatts_strogatz(nb_nodes, nb_edges, p)
stalls with a poor choice of arguments. While the code contains an assertion thatnb_nodes
must be greater thannb_edges
, this is not sufficient. Ifnb_nodes == nb_edges + 1
, the routines does not return. How to reproduce Execute the codeThe code does not exit. However, when the third parameter is 0, the method finishes executing.
Expected behavior Based on the error message, I expect the method to return for all values of parameters when nb_edges > nb_nodes, for al values of the third parameter.
Actual behavior When the second argument is only slightly higher than the first, and the third parameter is not sufficiently small, the routine does not return in a reasonable time (say 1 second, when the first two arguments are less than 30). Or an error message should be emitted.
Code demonstrating bug
Version information
] status LightGraphs
surrounded by backticks (``)Additional context Add any other context about the problem here.