You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling either undirected_gnp_random_graph(num_nodes, probability) or directed_gnp_random_graph(num_nodes, probability) for probability= 0 or 1 throws an error.
What is the expected behavior?
The expected behavior is to match that of networkx, where passing 0 for the probability returns an empty graph and passing 1 for the probability returns a full graph
Steps to reproduce the problem
Call either retworkx.undirected_gnp_random_graph(n,p) or retworkx.directed_gnp_random_graph(n,p) with p=0 or p=1.
The text was updated successfully, but these errors were encountered:
When p=0, we'll have an empty graph with n nodes and zero edges.
When p=1, we'll have a complete graph with n n(n-1) edges
for directed graphs and n(n-1)/2 edges for undirected graphs.
The time complexity stays the same. Let m be the max number of edges,
then run time is O(n+p*m), which reduces to O(n) when p=0 and, when
p=1 becomes O(n+n(n-1)) = O(n^2).
Fixes#172
MoAllabbad
changed the title
Change retworkx random G_n,p to accept exact 0 and 1 probabilities
retworkx random G(n,p) does not accept exact 0 and 1 probabilities
Nov 9, 2020
Information
What is the current behavior?
Calling either
undirected_gnp_random_graph(num_nodes, probability)
ordirected_gnp_random_graph(num_nodes, probability)
for probability= 0 or 1 throws an error.What is the expected behavior?
The expected behavior is to match that of networkx, where passing 0 for the probability returns an empty graph and passing 1 for the probability returns a full graph
Steps to reproduce the problem
Call either
retworkx.undirected_gnp_random_graph(n,p)
orretworkx.directed_gnp_random_graph(n,p)
with p=0 or p=1.The text was updated successfully, but these errors were encountered: