random_bipartite(g,n,m,p) --- create a random bipartite graph the graph g is overwritten with a bipartite grapn with part sizes n and m with edge probability p. If p is missing, we take p = 1/2.
0001 function random_bipartite(g,n,m,p) 0002 % random_bipartite(g,n,m,p) --- create a random bipartite graph 0003 % the graph g is overwritten with a bipartite grapn with part sizes n and m 0004 % with edge probability p. If p is missing, we take p = 1/2. 0005 0006 if nargin == 3 0007 p = 0.5; 0008 end 0009 0010 0011 A = rand(n,m) <= p; 0012 fast_set_matrix(g, [ zeros(n,n), A; A', zeros(m,m) ] ); 0013 0014 0015 rmxy(g); 0016 0017 xy1 = [ [1:n]-n/2; -ones(1,n)*log(n+m+1) ]'; 0018 xy2 = [ [1:m]-m/2; ones(1,m)*log(n+m+1) ]'; 0019 xy = [xy1;xy2]; 0020 embed(g,xy); 0021 0022 0023 clear_labels(g);