sparseAHC: Agglomerative hierarchical clustering for sparse similarity...

Description Usage Arguments Details Value Examples

Description

Agglomerative hierarchical clustering for sparse similarity matrices.

Usage

1
2
sparseAHC(S, linkage = c("average", "single", "complete"),
  check.symmetry = TRUE)

Arguments

S

sparse similarity matrix of type dgCMatrix

linkage

linkage criteria. It determines the similarity (or originally distance) between sets of nodes. See details.

check.symmetry

logical. If TRUE, tests if the input similarity matrix is symmetric.

Details

Let A and B be two disjoint subsets of points (nodes of the graph). “Complete linkage” is min S(a,b) for a \in A and b \in B, “single linkage” is max S(a,b) for a \in A and b \in B and “Average linkage” is 1/(|A|.|B|) * sum_{a \in A} sum_{b \in B} S(a,b).

Value

dendrogram of type hclust

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library("Matrix")
library("igraph")

A <- Matrix(0, nrow = 6, ncol = 6, sparse = TRUE)
A[1,2] <- 2; A[1,5] <- 3; A[1,4] <- 2.5; A[2,5] <- 4
A[3,4] <- 2; A[3,5] <- 6; A[4,5] <- 5; A[5,6] <- 4.6
A <- A + t(A)

G <- graph.adjacency(A, mode = "undirected", weighted=TRUE)
plot(G, edge.label=E(G)$weight, vertex.label=V(G)-1)

H <- sparseAHC(A, "average", TRUE)
plot(H)

jimhester/sparseAHC documentation built on May 19, 2019, 10:33 a.m.