igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Question on erdos_renyi random graph generator


From: Gabor Csardi
Subject: Re: [igraph] Question on erdos_renyi random graph generator
Date: Sat, 1 Dec 2007 19:57:52 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

Hi,

On Sat, Dec 01, 2007 at 01:35:44PM -0500, Richard Geddes wrote:
> Hello,
> 
> I'm attempting to generate random graph data and took an example in the
> tutorial and modified it a bit to generate an edgelist output file:
> 
[...]
> --- snip ---
> 
> I notice highest vertex value is consistently 999... ie the 1000th
> element starting from 0.  But, the number of vertices generated is not
> consistent... I ran the test 10 times and got the following number of
> vertices for each run:  988, 997, 992, 992, 995, 994, 991, 994, 993, 990
[...]
> 1) Is this function supposed to generate a random number of vertices?

No it isn't.

> 2) Is there an igraph function to verify the number of vertices generated?

igraph_vcount

Some thoughts:

1) Consider using the igraph R package
   or the Python R interface, it's much more productive, Eg. your 
   example of generating 1000 ER networks and saving them is just one or two
   lines in R.

2) If you save the graph in 'edgelist' format, you effectively lose the
   number of vertices if you can have isolate vertices in the graph.
   (Does not really happen with the parameters in your code, but is suspect
   you used lower density too.) Eg.

   g <- erdos.renyi.game(1000, 0.3/1000)
   write.graph(g, file="/tmp/er.txt", format="edgelist")
   g2 <- read.graph("/tmp/er.txt")
   vcount(g2)

   Use a different format, like 'graphml', or if you want a simple 
   format then go with 'lgl', and the option 'isolates=TRUE':

   g <- erdos.renyi.game(1000, 0.3/1000)
   write.graph(g, file="/tmp/er.txt", format="lgl", isolates=TRUE)
   g2 <- read.graph("/tmp/er.txt", format="lgl")
   vcount(g2)

3) There were a couple of bugs in the ER generator, they're all fixed
   in the development branch of igraph, but maybe not all of them in
   the current release.

4) Please consider joining the list, otherwise i) your messages might be
   delayed, even for days if i'm online and ii) you might miss some answers
   which are sent only to the list.

Hope this helps, tell me if not. In the latter case please send 
some simple code which can reproduce the problem.
Gabor

> Thank you
> Richard
> 
> 
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help

-- 
Csardi Gabor <address@hidden>    MTA RMKI, ELTE TTK




reply via email to

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