[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Cayley Tree
From: |
Gábor Csárdi |
Subject: |
Re: [igraph] Cayley Tree |
Date: |
Sun, 29 Nov 2009 15:12:05 +0100 |
I think it actually should be graph.tree(coord+1, coord,
mode="undir"). So the correct function is
cayley.tree <- function(coord, depth) {
if (depth==0) return(graph.empty(1))
if (depth==1) return(graph.tree(coord+1, coord, mode="undir"))
d <- coord-1
n1 <- (d^(depth+1)-1) / (d-1)
n2 <- (d^depth -1)/ (d-1)
g <- graph.tree(n1, d, mode="undir") %du% graph.tree(n2, d, mode="undir")
add.edges(g, c(0, n1))
}
and similarly for the Python version. Best,
Gabor
On Mon, Nov 23, 2009 at 1:00 PM, Tamas Nepusz <address@hidden> wrote:
>> I am not sure about this:
>>
>> if depth == 1:
>> return Graph.Tree(4, 3)
> Indeed, it should be Graph.Tree(coord, coord-1) and a similar correction
> should also be made in the R variant.
>
> --
> Tamas
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>
--
Gabor Csardi <address@hidden> UNIL DGM
- [igraph] Cayley Tree, Marco, 2009/11/17
- Re: [igraph] Cayley Tree, Tamas Nepusz, 2009/11/18
- Re: [igraph] Cayley Tree, Marco, 2009/11/18
- Re: [igraph] Cayley Tree, Gábor Csárdi, 2009/11/18
- Re: [igraph] Cayley Tree, Tamas Nepusz, 2009/11/18
- Re: [igraph] Cayley Tree, Marco, 2009/11/18
- Re: [igraph] Cayley Tree, Tamas Nepusz, 2009/11/23
- Re: [igraph] Cayley Tree,
Gábor Csárdi <=