igraph-help
[Top][All Lists]

## Re: [igraph] closeness centrality question

 From: Gábor Csárdi Subject: Re: [igraph] closeness centrality question Date: Wed, 10 Dec 2008 18:41:12 +0100

```This seems to be correct for me, i.e.

> g <- graph.formula(0--1--2, 3--4)
> closeness(g)
[1] 0.3076923 0.3333333 0.3076923 0.2500000 0.2500000
> shortest.paths(g)
[,1] [,2] [,3] [,4] [,5]
[1,]    0    1    2  Inf  Inf
[2,]    1    0    1  Inf  Inf
[3,]    2    1    0  Inf  Inf
[4,]  Inf  Inf  Inf    0    1
[5,]  Inf  Inf  Inf    1    0
> 4/(1+2+5+5)
[1] 0.3076923
> 4/(1+1+5+5)
[1] 0.3333333
> 4/(5+5+5+1)
[1] 0.25

According to the formula in ?closeness, I assume that is right.

Best,
Gabor

On Wed, Dec 10, 2008 at 6:26 PM, Alvaro Graves Fuenzalida
> Hi, I'm working with closeness centrality but there is something I don't get
> if it's correcto or not:
>
> If I have the following graph
>
> 0---1---2
>
> the centrality is
>
> 0 -> 0.666667
> 1 -> 1.000000
> 2 -> 0.666667
>
> which makes sense. However if I add another unconnected edge 3---4 then I
> have
>
> 0 -> 0.307692
> 1 -> 0.333333
> 2 -> 0.307692
> 3 -> 0.250000
> 4 -> 0.250000
>
>
> According to the documetation "If the graph is not connected, and there is
> no path between two vertices, the number of vertices is used instead the
> length of the geodesic", but still the numbers don't fit. Can somebody tell
> me if there is a mistake or I misunderstood something?
>
>
>
>
> _______________________________________________
> igraph-help mailing list
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>

--