[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] number of links between two vertex in a directed graph
From: |
Gábor Csárdi |
Subject: |
Re: [igraph] number of links between two vertex in a directed graph |
Date: |
Wed, 17 Mar 2010 09:44:26 +0100 |
Hi, this is probably the fastest way:
no.links <- function(g, from, to) sum(neighbors(g, from)==to)
E.g.:
g <- graph( c(1015, 1017, 959, 959, 991, 991, 1015, 1017, 1015, 1017,
3368, 3368) )
no.links(g, 1015, 1017)
Gabor
On Wed, Mar 17, 2010 at 6:25 AM, Khanh Nguyen <address@hidden> wrote:
> Hi,
>
> How can I get the number of links between two vertex in a directed graph?
>
> For instance...
>
>> head(E(graph.facebook.walls))
> Edge sequence:
>
> [1] 1015 -> 1017
> [2] 959 -> 959
> [3] 991 -> 991
> [4] 1015 -> 1017
> [5] 1015 -> 1017
> [6] 3368 -> 3368
>
> in this case, the number of links between 1015 - 1017 is at least 3....
>
> Thanks..
>
> -k
>
> On Tue, Mar 2, 2010 at 4:05 PM, Aaron Alexander-Bloch
> <address@hidden> wrote:
>> Hi - Thanks in advance for any help.
>>
>> I'm trying to apply spinglass.community in the R package to dense weighted
>> networks and have some trouble interpreting the modularity value in my
>> results. I'm assuming that $modularity is the value of the Hamiltonian as in
>> the Reichardt/Bornholdt paper. As I'm keeping the gamma parameter at 1 and
>> using the 'config' model, my understanding is that the Hamiltonian is the
>> same as Newman's modularity, at least for binary graphs. But I'm not clear
>> on how these concepts are related for weighted graphs. If I separately get
>> the modularity value of the partition that spinglass gives me, it is
>> different from the modularity value given by spinglass directly. So my
>> question is how should the modularity value given by spinglass be
>> interpreted for weighted graphs?
>>
>> In a related question, is there any plan to implement the "weighted version"
>> of this method as in Heimo (2008)
>>
>> http://iopscience.iop.org/1742-5468/2008/08/P08007/
>>
>> Thanks very much!
>> Aaron
>>
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>>
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>
--
Gabor Csardi <address@hidden> UNIL DGM