mst.cluster: mst.cluster

Description Usage Arguments Value Examples

View source: R/mstclustering.R

Description

Run clustering using MST. Before calling this function, remove some edges from the MST, for example the k-1 heaviest.

Usage

1
mst.cluster(child.list.mst, m, k)

Arguments

child.list.mst

The return value of the gen.child.list.mst() function with k-1 edges removed.

m

Number of nodes.

k

The number of clusters.

Value

A vector whose k-th element is the cluster the k-th point belongs to.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
iris.clean <- iris[,-5]
iris.dist <- as.matrix(dist(iris.clean))
iris.edge.list <- gen.edge.list(iris.dist)
m <- nrow(iris.dist)
iris.mst.edge.list <- kruskal(iris.edge.list, m)
k <- 3
n.edges <- nrow(iris.mst.edge.list)
iris.mst.edge.list <- iris.mst.edge.list[1:(n.edges - (k - 1)),]
iris.child.list.mst <- gen.child.list.mst(iris.mst.edge.list, m)
iris.clust.mst <- mst.cluster(iris.child.list.mst, m, k)

mstclustering documentation built on Feb. 8, 2022, 9:06 a.m.