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

_______________________________________________
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to