How to apply a function to each connected component within a graph / network?

I have a large igraph object of 70,000+ vertices (nodes) and 200,000+ edges (junctions). I would like to calculate some centrality indicators, but the network is too large. I thought it was a good job to split my network into connected components (even the largest is not too big).

I was thinking about using the igraph clusters function or related methods. Can I then calculate alpha.centrality () and bonpow () on clusters? and then merge the results back into the original igraph object? (or data frame with all vertices)

I am not sure about the best approach, and it would be very interesting for me to hear any ideas that people have. Thank you very much:)

+4
source share
1 answer

You can use the decompose.graph function in igraph to get a list of connected components, then use lapply to run your function ( alpha.centrality or bonpow ) for each of the components. After running decompose.graph you can free the source graph to re-require some memory.

+4
source

All Articles