Optionally, one can also construct a distance matrix at this stage, where the number in the "i"-th row "j"-th column is the distance between the "i"-th and "j"-th elements. Then, as clustering progresses, rows and columns are merged as the clusters are merged and the distances updated. This is a common way to implement this type of clustering, and has the benefit of caching distances between clusters. A simple agglomerative clustering algorithm is described in the single-linkage clustering page; it can easily be adapted to different types of linkage (see below).