igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] betweeness centrality for a directed weighted graph


From: Gábor Csárdi
Subject: Re: [igraph] betweeness centrality for a directed weighted graph
Date: Wed, 2 Jul 2014 06:56:05 -0400

Hi,

On Wed, Jul 2, 2014 at 5:56 AM, Jonas Richhardt <address@hidden> wrote:
> 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)
>   }

Error: object 'dat.raw' not found

>
> 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

I am not sure why you expect 6 times the maximum betweenness to be
exactly equal to the sum all betweenness scores. What is the result
that you expect here and why?

Gabor

>
> #### 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
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help



reply via email to

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