[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [igraph] Group centrality

**From**: |
Tamas Nepusz |

**Subject**: |
Re: [igraph] Group centrality |

**Date**: |
Mon, 17 Mar 2008 13:04:26 +0100 |

Hi,

`I think that the group degree centrality and the group closeness
``centrality is not too hard to implement using existing igraph
``functions. For group degree centrality, you simply select the vertices
``that have a neighbor vertex in your group, then subtract the members
``of your group from it. E.g., if your group consists of vertices 0, 1
``and 5, then do the following:
`
group <- c(0,1,5)
group_degree <- setdiff(V(g)[nei(group)], group)

`For group closeness centrality, you can use shortest.paths to
``calculate the distances of the individual vertices from members the
``group:
`
sps <- shortest.paths(g, group)

`Now you'll have to decide how to define the distance of a vertex from
``a whole group. If you choose it to be the minimum distance, you'll
``have to apply the "min" function to columns of the matrix obtained.
``Similarly, you can use "max" or "mean". I choose "min":
`
min_dists <- apply(sps, 2, min)
I have to exclude zeros from min_dists:

`Now, the group closeness centrality is the inverse of the mean of
``min_dists:
`
group_closeness <- 1 / mean(min_dists[min_dists > 0])

`Due to my limited skills in R (I usually use igraph through its Python
``interface), I won't try implementing the group betweenness centrality
``this way, but I'm sure it can be done using regular igraph functions
``and a little bit of R programming.
`
Best,
--
Tamas