[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] random weighted graphs
From: |
Gábor Csárdi |
Subject: |
Re: [igraph] random weighted graphs |
Date: |
Mon, 23 Jul 2012 12:09:35 -0400 |
On Mon, Jul 23, 2012 at 9:16 AM, Umberto77 <address@hidden> wrote:
> Hi all,
> thank for the answers to all of my questions previously posted.
> I need to compare both binary and weighted network indexes from a real
> multiple directed network - with loops - to random ones.
> Thus, I was thinking ot generate some thousands of random graphs and then to
> look at the distribution of the average indexes' values, keeping constant
> the number of vertices and edges (163 and 573, respectively). This should be
> enough right now.
> While for the binary version of my network I was thinking to use:
> randomgraph<-erdos.renyi.game(163, 573, type=c("gnm"), directed=TRUE,
> loops=TRUE)
> I don't know how do to it with the weighted network, is ot say, how to
> randomly distribute weights belonging to a set range (i.e.ranging from 0 to
> 1 billion).
First of all you need to decide whether there is any correlation
between the network structure and the weights. If not, that is easier,
so I'll assume that here. Then you'll need to decide/measure/model the
distribution of the weights. If you have that, and it is say a normal
distribution, then you can simply assign the weights via
randomgraph <- set.edge.attribute(randomgraph, "weight",
rnorm(ecount(randomgraph), mean, sd))
If they are not normally distributed, then you'll need another
function than rnorm(), R contains random number generators for most
distributions, just search the R manual for the name of the
distribution, e.g. runif(), rt(), rlogis(), rlnorm(), etc.
> Also, I was wondering if this function to iterate the random graph
> generation and storing the average node degree (ND), is correct or not.
> nodeDegree<-array()
This will be numeric in the end, so
nodeDegree <- numeric()
is better.
> for (i in 1:3000){
> randomgraph<-erdos.renyi.game(163, 573, type=c("gnm"), directed=TRUE,
> loops=TRUE)
> nodeDegree[i]<-mean(degree(graph))
> }
Look like it, but please double check it for yourself.
> Thanks a lot,
>
> P.s. I've seen that the on line tutorial is growing, thank you.
> Umberto
Is it? I am wondering who might be writing it, if it is not me....... :)
G.
> ----
> Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP
> autenticato? GRATIS solo con Email.it
>
> Sponsor:
> Cesenatico Pasini Hotels Solo per questa settimana imperdibile offerta All
> Inclusive all' Hotel Stacchini al prezzo di 410 Euro, tantissimi sconti
> anche sui bambini!!!
> Clicca qui
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
--
Gabor Csardi <address@hidden> MTA KFKI RMKI