igraph-help
[Top][All Lists]
Advanced

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

[igraph] Edge betweenness centrality for specific Origin-Destination


From: Aisan Kazerani
Subject: [igraph] Edge betweenness centrality for specific Origin-Destination
Date: Tue, 05 May 2009 14:13:23 +1000 (EST)
User-agent: SquirrelMail/1.4.8

Dear Gabor,

Thanks for your helpful guide. I managed to compute betweenness centrality
for specific origin and destination with your code:

bw.fromto <- function(graph, source, targets=V(graph)) {
  bw <- numeric(vcount(graph))
  paths <- get.all.shortest.paths(graph, source, targets)
  last <- sapply(paths, tail, 1)
  freq <- table(last)[ as.character(last) ]
  red.paths <- sapply(paths, function(x) x[c(-1,-length(x))])
  for (i in seq_along(red.paths)) {
     bw[ red.paths[[i]]+1] <- bw[ red.paths[[i]] + 1] + 1/freq[i]
  }
  bw
}
Do you think I would be able to compute edge betweenness centrality for
the same case?

Thank you very much again...

Cheers,
Aisan





reply via email to

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