[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[igraph] EDGE betweenness centrality for specific origins and destinatio
From: |
Aisan Kazerani |
Subject: |
[igraph] EDGE betweenness centrality for specific origins and destinations |
Date: |
Wed, 06 May 2009 14:52:29 +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. Do you think I would
be able to compute EDGE betweenness centrality for the same case?
Here is the code in case you need that:
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
}
Thank you very much again...
Cheers,
Aisan
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [igraph] EDGE betweenness centrality for specific origins and destinations,
Aisan Kazerani <=