igraph-help
[Top][All Lists]
Advanced

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

[igraph] betweeness centrality for a directed weighted graph


From: Jonas Richhardt
Subject: [igraph] betweeness centrality for a directed weighted graph
Date: Wed, 02 Jul 2014 11:56:50 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

Hi,

Fist of all I use the igraph package in R.
I struggle with the betweeness centrality funciton. First question is does that function resbects the weights of a graph. I think it does not. If i use the general formula to calculate the betweeness centrality with the betweeness for the single knotes my results differ form what the
betweeness centrality function returns.

#### begin code

patchmat = cbind(c(0,0,0,0,0,1),c(0,0,1,0,0,0),c(0,1,0,0,0,1),c(0,0,0,0,1,1),c(0,0,0,1,0,1),c(1,0,1,1,1,0))
for (row in seq (1:6)){  ### some sort of normalising
    patchmat[row,] <- dat.raw[row,]/sum(dat.raw[row,])
    patchmat = matrix(data = patchmat, ncol = 6, nrow = 6)
  }

graph <- graph.adjacency(as.matrix(patchmat), mode="directed", weighted=TRUE) ### here we transform the adjacency matrix into a graph-object

betweenness(graph, v=V(graph), directed = TRUE, normalized = TRUE) ### returns 0.72

### but using the general formula
6*max(betweenness(graph, v=V(graph), directed = TRUE, normalized = TRUE))-sum(betweenness(graph, v=V(graph), directed = TRUE, normalized = TRUE)) ### returns 3.6

#### end code

Please help me to understand what happens here. The results differ by a factor of 5.

Thanks in review
Jonas



reply via email to

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