[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] R-implementations of games
From: |
Gábor Csárdi |
Subject: |
Re: [igraph] R-implementations of games |
Date: |
Thu, 4 Feb 2010 00:30:42 +0100 |
On Wed, Feb 3, 2010 at 4:55 PM, Arthur Kaiser <address@hidden> wrote:
> Hi,
> @Tamas. Thanks. I want to do it right this way.
>
> @Gabor
>
> How can I get and use an edge list matrix? Can you give me a code example,
> please?
On handling matrices? Perhaps read 'Introduction to R', it is on the R
homepage. It is pretty easy, actually:
M <- matrix(0, ncol=number.of.edges, nrow=2)
edges.so.far <- 0
for (i in 2:no.of.vertices) {
newedges <- ... # According to your criteria
if (length(newedges) != 0) {
M[ , (edges.so.far+1):(edges.so.far+newedges)] <- newedges
edges.so.far <- edges.so.far + length(newedges)
}
}
g <- graph(M)
> I'm actualy thinking about an aging.prefatt.game with a random part:
>
> P[i] ~ (c k[i]^alpha) (d l[i]^beta) (e r[i]^gamma)
>
>
> The combine which I´m referring is shown in this example:
[...]
I think this would easier and faster with just using the matrix approach.
[...]
--
Gabor Csardi <address@hidden> UNIL DGM