new.cluster.map: Cluster mapper

View source: R/yogitools.R

new.cluster.mapR Documentation

Cluster mapper

Description

Constructor for an object supporting simple connected-component-clustering

Usage

new.cluster.map(n)

Arguments

n

The number of elements to cluster.

Details

The process starts with n objects, each in their own cluster. Whenever a link is between two objects is reported, their clusters are merged. Contains the following functions:

  • addLink(i,j): Creates a new link between items i and j. Whenever a link is created, the clusters encompassing the two objects are merged.

  • getClusters(): Returns a list of lists representing the clusters

  • getIdxOf(i): Returns the cluster index of a given object.

Value

the mapper object

Examples

cmap <- new.cluster.map(10)
cmap$addLink(1,5)
cmap$addLink(3,5)
cmap$addLink(1,5)
cmap$getClusters()

jweile/yogitools documentation built on May 11, 2023, 7:42 p.m.