igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Alpha centrality with valued graphs


From: Gábor Csárdi
Subject: Re: [igraph] Alpha centrality with valued graphs
Date: Sun, 25 Jan 2009 23:15:50 +0100

How exactly is 'weighted' alpha centrality defined? Is it just that we
use the "weighted" adjacency matrix instead of the regular one. If
yes, then I've added this to the development version. Here is the
modified function, you can use it before the new igraph is released.

Best,
Gabor

alpha.centrality <- function(graph, nodes=V(graph), alpha=1,
                             loops=FALSE, exo=1, attr=NULL,
                             tol=1e-7) {
  if (!is.igraph(graph)) {
    stop("Not a graph object")
  }

  exo <- rep(exo, length=vcount(graph))
  exo <- matrix(exo, nc=1)

  d <- t(get.adjacency(graph, attr=attr))
  if (!loops) {
    diag(d) <- 0
  }
  n <- vcount(graph)
  id <- matrix(0, nrow=n, ncol=n)
  diag(id) <- 1

  ev <- solve(id-alpha*d, tol=tol) %*% exo
  ev[as.numeric(nodes)+1]
}

On Sun, Jan 25, 2009 at 8:39 PM, Brandon J Kinne <address@hidden> wrote:
> Dear all:
>
> Bonacich's 2001 paper mentions that alpha centrality can be calculated not
> only on directed, but also valued graphs. However, I can't seem to get
> igraph to consider edge weights when using alpha.centrality. Am I missing
> something here, or does igraph simply not allow valued graphs with
> alpha.centrality? I know there is other software, such as UciNet, that does
> calculate alpha centrality for valued graphs, but I'd much prefer to stay
> within the R environment. Thanks in advance for the help!
>
> Best regards,
>
> Brandon Kinne
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>



-- 
Gabor Csardi <address@hidden>     UNIL DGM




reply via email to

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