igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] How to a generate a random bipartite graph (one-to-many)?


From: Tamás Nepusz
Subject: Re: [igraph] How to a generate a random bipartite graph (one-to-many)?
Date: Wed, 23 May 2012 12:08:46 +0200

Hi, 

Suppose that you have N vertices in A and M vertices in B. You can generate an 
edge list manually as follows:

edgelist <- cbind(1:n, sample(1:m, n, replace=T))
g <- graph.edgelist(edgelist)

Note that this is for R-igraph 0.6 where vertices are indexed from 1; if you 
are using 0.5.x, you have to subtract 1 from the edge list. 

-- 
T.


On Wednesday, 23 May 2012 at 10:12, Moses Boudourides wrote:

> Hello,
> 
> How could I generate in igraph a random bipartite graph (with random
> numbers of vertices of class A and B) such that every vertex in A is
> connected to exactly one vertex in B (not distinct, of course, so that
> a vertex in B might be connected to many vertices in A)?
> 
> I'd appreciate your assistance.
> 
> Best,
> 
> --Moses
> 
> _______________________________________________
> igraph-help mailing list
> address@hidden (mailto:address@hidden)
> https://lists.nongnu.org/mailman/listinfo/igraph-help






reply via email to

[Prev in Thread] Current Thread [Next in Thread]