igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] betweenness centrality for weighted graphs


From: Gábor Csárdi
Subject: Re: [igraph] betweenness centrality for weighted graphs
Date: Thu, 31 Mar 2011 15:56:15 -0400

Here is a binary R package:

http://win-builder.r-project.org/Ww11pPkAtXvs/

The package examples do not work on 64-bit windows, btw. FYI.
Hopefully betweenness works fine.

Best,
Gabor

On Tue, Mar 29, 2011 at 5:09 PM, T.O. Richardson
<address@hidden> wrote:
> Hi List,
> Please see correspondence below for the calculation of weighted betweenness
> in igraph.
>
>
> On Tue, Mar 29, 2011 at 9:11 AM, T.O. Richardson
> <address@hidden> wrote:
>>
>> Hi Gábor & Tamas,
>> I have a query about igraph in R.
>> I have a dynamic undirected weighted graph and would like to calculate the
>> betweenness centrality for each vertex at each time-point.
>> However, the betweenness function in igraph version 0.5.5-2 does not seem
>
> to
>>
>> take into account the edge weights.
>>
>> My code is:
>> actors <- data.frame(name=ants))
>> relations <- data.frame(from=fromm, to=too )
>> net <-graph.data.frame(relations, directed=FALSE, vertices=actors)
>> E(net)$weight <- weights
>> betweenness(net, V(net), directed=FALSE)
>>
>> The resulting betweenness from the above is identical irrespective of
>> whether you add the weights to the edges, or not.
>>
>> I looked at the CRAN changelog, where it states (i think) that the file
>> "interfaces/R/igraph/R/structural.properties.R" has been modified (on
>> 2009-08-02 14:04:01) to include edge weighting.
>> If I try to simply cut & paste the code (that should take weights into
>> account) for the betweenness function from the CRAN change-log (see
>
> below),
>>
>> then I get the error 'could not find function "as.igraph.vs" ' . I can't
>> interpret the C code in the changelog, so i am abit lost..
>>
>> Many Thanks,
>> Tom Richardson
>>
>>
>> ## code from the CRAN igraph change-log:
>> betweenness <- function(graph, v=V(graph), directed=TRUE, weights=NULL,
>>                       verbose=igraph.par("verbose")) {
>>                       nobigint=TRUE,
>
> verbose=igraph.par("verbose")) {
>>
>>  if (!is.igraph(graph)) {
>>    stop("Not a graph object")
>>  }
>>  on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
>>  .Call("R_igraph_betweenness", graph, as.igraph.vs(graph, v),
>>       as.logical(directed), weights, as.logical(verbose),
>>       as.logical(directed), weights, as.logical(nobigint),
>>       as.logical(verbose),
>>        PACKAGE="igraph")
>> }
>>
>
>
>
>
> Dear Tom,
>
> please send these kind of questions to the igraph-help mailing list,
> see http://igraph.sf.net. Thanks!
>
> As for your question, indeed, weighted betweenness is only implemented
> in the 0.6 development version. Copying the R code from 0.6 does not
> help, because the implementation is in C.
>
> You can download the 0.6 version from
> http://code.google.com/p/igraph/downloads/list
> Go for igraph_nightly_0.6-2410-20110328.tar.gz, because the newest
> version does not work properly.
> This is an R source package, which works on Linux or OSX (if you can
> compile C/C++ programs on OSX). If you need a windows package, then I
> can send you one.
>
> Best,
> Gabor
>
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>



-- 
Gabor Csardi <address@hidden>     MTA KFKI RMKI



reply via email to

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