# Class ClusteringMatrixBuilder

java.lang.Object
ch.usi.inf.sape.hac.ClusteringMatrixBuilder

All Implemented Interfaces:
  `ClusteringBuilder`

public final class ClusteringMatrixBuilder extends Object implements ClusteringBuilder
A ClusteringMatrixBuilder builds a matrix in which each row represents a step in the clustering and each column represents an observation or cluster. In the first step (row 0), each column represents an observation. In the last step, each column refers to the same cluster. Each step represents a copy of the step above, with two clusters merged into one.

## Constructor Summary

Constructors
Constructor
Description
`ClusteringMatrixBuilder(int nObservations)`

## Method Summary

Modifier and Type
Method
Description
`int[][]`
`getClustering()`
`void`
`merge(int i, int j, double dissimilarity)`
Merge two clusters.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ClusteringMatrixBuilder

public ClusteringMatrixBuilder(int nObservations)

## Method Details

### merge

public void merge(int i, int j, double dissimilarity)
Description copied from interface: `ClusteringBuilder`
Merge two clusters.

Specified by:
  `merge` in interface `ClusteringBuilder`
Parameters:
  `i` - the smaller of the two cluster indices
  `j` - the larger of the two cluster indices
  `dissimilarity` - between the two merged clusters

### getClustering

public int[][] getClustering()