by Andrie de Vries
In a previous post, I used page rank and community structure to create a plot of CRAN. This plot used vibrant colours to allow us to see some of the underlying structure of CRAN.
However, much of this structure was still obfuscated by the amount of detail. Concretely, a large number of dots (packages) made it difficult to easily see the community structure.
Some more investigation followed, and I discovered a few beautiful functions in the igraph package that allows you to contract and simplify a graph:
- The function contract.vertices() merges several vertices into one. By computing the community structure, one can control how this merging happens. At conclusion of the contraction, two vertices can have multiple edges.
- The equivalent step for edges is simplify(). A simplified graph contains only a single edge between two nodes. The simplification step can compute summary statistics for the combined edges, for example the sum of edge weights.
Here is the code: