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

gsp_erdos_renyi(N,p) wrong probability #5

Open
diegovalsesia opened this issue Sep 4, 2017 · 1 comment
Open

gsp_erdos_renyi(N,p) wrong probability #5

diegovalsesia opened this issue Sep 4, 2017 · 1 comment

Comments

@diegovalsesia
Copy link

The current implementation of the Erdos-Renyi graph seems to have an issue related to the generation of the adjacency matrix. In particular, the edge probability does not follow the input probability p but it is roughly half. This is due to the following lines:

G.W = sprandsym(N,p)>0;
G.W(1:N 1:end) = 0;

where sprandsym(N,p) generates a sparse matrix with nonzero probability p but the nonzero entries are normally distributed, so taking >0 only selects half of those.

A quick fix, albeit inefficient, is

G.W = tril(rand(N,N)<p);
G.W = G.W - eye(N);
G.W = G.W G.W';

@mdeff
Copy link
Contributor

mdeff commented Sep 21, 2017

Thanks for reporting this issue! Note however that this toolbox is not developed nor maintained anymore. Please consider using the pygsp instead, where that issue has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants