R: Hierarchichal Clustering of Link Communities

getClusterRelatedness {linkcomm} | R Documentation

## Hierarchichal Clustering of Link Communities

### Description

This function hierarchically clusters the link communities themselves and returns an object of class `hclust`.

### Usage

    getClusterRelatedness(x, clusterids = 1:x$numbers[3], hcmethod = "ward.D",
            cluster = TRUE, plot = TRUE, cutat = NULL, col = TRUE,
            pal = brewer.pal(11, "Spectral"), labels = FALSE, plotcut = TRUE,
            right = TRUE, verbose = TRUE, ...)

### Arguments

`x` | An object of class `linkcomm`.
`clusterids` | An integer vector of community IDs. Defaults to all communities.
`hcmethod` | A character string naming the hierarchical clustering method to use. Can be one of `"ward.D"`, `"ward.D2"`, `"single"`, `"complete"`, `"average"`, `"mcquitty"`, `"median"`, or `"centroid"`. Defaults to `"ward.D"`.
`cluster` | Logical, whether to cluster the communities. If FALSE, the function returns the upper triangular dissimilarity matrix as a vector. Defaults to TRUE.
`plot` | Logical, whether to plot the cluster dendrogram.
`cutat` | A numerical value at which to cut the dendrogram. If NULL, the dendrogram is not cut and meta-communities are not returned. Defaults to NULL.
`col` | Logical, whether to colour the dendrogram. Defaults to TRUE.
`pal` | A character vector describing a colour palette to be used for colouring the meta-communites in the dendrogram plot. Defaults to `brewer.pal(11, "Spectral")`.
`labels` | Logical, whether to add labels to the dendrogram plot.
`plotcut` | Logical, whether to display a horizontal line where the dendrogram is cut. Defaults to TRUE.
`right` | Logical, whether to orient the dendrogram to the right. Defaults to TRUE.
`verbose` | Logical, whether to display the progress of the calculation on the screen. Defaults to TRUE.
`...` | Additional arguments to be passed to `plot`.

### Details

Extracting meta-communities allows the user to explore community relatedness and structure at higher levels. Community relatedness is calculated using the Jaccard coefficient and the number of nodes that community i and j share:

S(i,j)=|intersect(i,j)|/|union(i,j)|

### Value

Either a numerical vector (the upper triangular dissimilarity matrix - if `cluster = FALSE`), a list of integer vectors (the meta-communities - if `cutat` is not NULL), or an object of class `hclust` (if `cluster` is TRUE and `cutat` is NULL).

### Author(s)

Alex T. Kalinka alex.t.kalinka@gmail.com

### References

Kalinka, A.T. and Tomancak, P. (2011). linkcomm: an R package for the generation, visualization, and analysis of link communities in networks of arbitrary size and type. Bioinformatics 27, 2011-2012.

### See Also

`meta.communities`, `cutDendrogramAt`, `hclust`

### Examples

    ## Generate graph and extract link communities.
    g <- swiss[,3:4]
    lc <- getLinkCommunities(g)

    ## Cluster the link communities.
    getClusterRelatedness(lc)

    ## Cluster the link communities, cut the dendrogram, and return the meta-communities.
    getClusterRelatedness(lc, cutat = 1)

[Package linkcomm version 1.0-14 Index]