A Go library for clustering analysis based on dissimilarity (distance) matrices.
clustules provides data structures for working with dissimilarity matrices, graphs, and vertex sets, with a focus on hierarchical clustering workflows.
vertices— labeled vertex set (generic overstring | int), with bidirectional label ↔ index lookupdiss— symmetric dissimilarity matrix (Diss[T]); supports reading.matfiles in lower-triangular, upper-triangular, or square formats, with or without row labelsgraph— undirected graph (Graph[T]) built on a vertex setmodules— module/cluster structure grouping multiple graphs (work in progress)
import "github.com/FrancoisBrucker/clustules/diss"
data, _ := os.ReadFile("distances.mat")
d, err := diss.NewFromString(string(data))NewFromString accepts six formats, auto-detected from the token counts per line.
Lower-triangular with labels (like henley.mat):
Ours 0
Chat 47.2 0
Vache 27.7 30.9 0
Square without labels:
0 47.2 27.7
47.2 0 30.9
27.7 30.9 0
Go 1.25+
See LICENSE.