Docs Navigation (Core Strategies)›

02. Clustering & Planar Simplex Projection

Deep dive into Soft-Simplex interior spreading, Jaccard QAP annealing, multi-modal embeddings, NNLS barycentric projection, and PAM k-Medoids.

  • Core Strategies
  • 7 min read
  • Updated 2026-11-19

Key Takeaways

  • SimplexClusteringStrategy decouples data representation cleanly: tag strategies set requiresTags: true, while embedding and similarity strategies set requiresTags: false.
  • Quadratic Assignment Problem (QAP) simulated annealing places related clusters on adjacent mesh vertices so shared items land on planar edges and triangles.
  • Soft-Simplex strategies distribute multi-cluster items smoothly across triangle interiors while leaving single-cluster items free in a 360-degree halo.

Stage 2 (SimplexClusteringStrategy) solves three coupled mathematical problems:

  1. Partitioning: Grouping domain items into K coherent topic clusters or medoids/centroids.
  2. Planar Mesh Embedding (QAP): Assigning those K clusters to the K vertices of the 60° simplex mesh so pairwise cluster affinity aligns with 1-hop mesh adjacency (preserving identities across updates via the Hungarian algorithm).
  3. Barycentric Simplex Anchoring: Mapping every item onto its covering vertex (1-simplex), shared edge (2-simplex), or triangle face (3-simplex) with normalized weights ∑ w_i = 1.

Jaccard Annealing / Planar NNLS

Snaps items onto discrete vertices, shared edges, or centroids

C1C2C3

Soft-Simplex Clustering / Projection

Continuous interior spread + free 360° single-cluster halo

C1C2C3
Left: Discrete Explaining-Away / sparse NNLS snaps items onto exact vertices, 2-cluster edges, or 3-cluster centroids. Right: Soft-Simplex blends continuous affinity across the best covering triangle while keeping single-cluster items unconstrained in a 360° halo.

Strategy Decision Matrix

Soft-Simplex Tag Clustering
Discrete tags · requiresTags: true

createSoftSimplexTagClusteringStrategy(config?)

Recommended for rich tagged corpora. Combines load-balanced QAP with continuous interior spreading (triangleSpread: 0.45) while keeping single-cluster items unconstrained in a 360° vertex halo.

Open strategy reference →

Jaccard Annealing Clustering· Default
Discrete tags · requiresTags: true

createJaccardAnnealingClusteringStrategy(config?)

Regularized Jaccard tag partitioning + QAP Simulated Annealing + planar hitting-set completion for crisp snapping onto vertices, shared 2-cluster edges, and 3-cluster centroids.

Open strategy reference →

Incremental Tag Anchoring
Streaming tags · requiresTags: true

createIncrementalAnchorClusteringStrategy(config?)

Freezes existing vertex topics and UIDs on update(), routing newly arriving tags and items to their closest existing anchors without global reshuffling.

Open strategy reference →

Soft-Simplex Embedding Projection
1 or M vectors · requiresTags: false

createSoftSimplexEmbeddingClusteringStrategy(config)

Recommended for embeddings. Combines weighted multi-modal Spherical/L2 k-Means++ with load-balanced QAP and temperature-scaled interior 2-simplex projection.

Open strategy reference →

Planar NNLS Embedding Projection
1 or M vectors · requiresTags: false

createEmbeddingClusteringStrategy(config)

Spherical/Euclidean k-Means++ + QAP + closed-form Non-Negative Least Squares (NNLS) projection onto planar mesh triangles.

Open strategy reference →

Pairwise k-Medoids Projection
Kernel S(a, b) · requiresTags: false

createSimilarityClusteringStrategy(config)

PAM k-Medoids + QAP mesh embedding + simplex projection for arbitrary pairwise similarity functions without explicit feature vectors.

Open strategy reference →

Parameter Effect: triangleSpread (0.00 vs. 0.45 vs. 0.90)

Raising triangleSpread smoothly distributes multi-cluster items across the covering 2-simplex triangle interior while keeping single-cluster items unconstrained in an outer 360° vertex halo:

triangleSpread: 0.00

Crisp snapping onto vertices, edge midpoints & centroid

C1C2C3

triangleSpread: 0.45 (Default)

Balanced interior area + free 360° single-tag halo

C1C2C3

triangleSpread: 0.90

Broad diffusion toward central triangle barycenter

C1C2C3
Left: triangleSpread = 0.00 (or discrete Jaccard / NNLS anchoring) snaps shared items strictly onto edges and triangle centroids. Center: default triangleSpread = 0.45 spreads bridge items evenly across the 2-simplex face while preserving a 360° halo around C1. Right: triangleSpread = 0.90 diffuses interior weights broadly toward the center.

Tag Rules: Planar Hitting-Set & Explaining-Away

In tagged collections, two subtle edge cases arise when projecting hypergraph tag overlaps onto a 2D planar triangulation:

  • sharedTagRule: 'planar-hitting-set' (Default): If a bridge tag co-occurs across clusters that cannot all touch on a planar graph, a weighted hitting-set pass promotes minimal bridge coverage onto shared mesh edges so cross-cutting items remain geometrically faithfully tethered.
  • anchorRule: 'explaining-away' (Default): Ranks incident clusters by specificity and prunes redundant secondary matches once an item’s tags are explained, preventing generic tags from dragging every node toward the canvas center.

Closed-Form Planar NNLS Projection for Embeddings

For untagged vector embeddings x ∈ ℝ^d, createEmbeddingClusteringStrategy evaluates every candidate vertex, mesh edge, and mesh triangle τ = (c₁, c₂, c₃) and solves the exact constrained least-squares projection onto the 2-simplex Δ²:

minimize   || x − (w₁·μ₁ + w₂·μ₂ + w₃·μ₃) ||₂²
subject to w₁, w₂, w₃ ≥ 0  and  w₁ + w₂ + w₃ = 1

Selecting the planar simplex τ* with minimal reconstruction residual guarantees that every embedded item lands inside a true planar mesh triangle rather than across non-adjacent clusters.

Base-Rate-Aware Discriminative Cluster Labeling (features & peerClusters)

When clustering untagged embeddings or pairwise similarity kernels, naively naming each cluster after its most frequent category often produces duplicate badges whenever a single class dominates the corpus (for example, 77% of classic feature films carrying "Drama" as a primary genre, or two penguin clusters sharing the same species).

SimplexViz solves this directly inside Stage 2 and exposes the underlying primitives for custom deriveClusterMeta callbacks:

  1. Built-In features Option on Embedding & Similarity Strategies: Passing features: SubspaceZoomFeature<TItem>[] to createSoftSimplexEmbeddingClusteringStrategy, createEmbeddingClusteringStrategy, or createSimilarityClusteringStrategy invokes assignDiscriminativeClusterLabels across all K sibling clusters—scoring numeric features by standardized z-score separation (|z_k|), boolean/categorical facets by specificity lift above corpus base rates, and shared taxonomic groups by intra-group secondary contrast (such as Adélie · Male vs. Adélie · Female).
  2. Sibling Context in deriveClusterMeta: Every ClusterDerivationContext<TItem, TTagMeta> receives allItems and peerClusters: readonly PeerClusterContext<TItem, TTagMeta>[], enabling custom domain meta builders to call resolveDiscriminativeClusterLabel(ctx, { features }) or disambiguatePeerClusterTitle(ctx, getBaseTitle, getQualifier) with guaranteed pairwise uniqueness across the mesh.

Path-Independent Chronological Pinning (createFinalSeededClusteringStrategy)

When stepping chronologically (0 → N) through a growing corpus or applying interactive filters, running a clustering strategy from scratch on early sparse frames can cause clusters to jump vertices or rename themselves from frame to frame. Wrap any Stage 2 strategy—tag, embedding, similarity, or custom—with createFinalSeededClusteringStrategy:

import {
  createFinalSeededClusteringStrategy,
  createSoftSimplexEmbeddingClusteringStrategy,
} from '@simplex-viz/core';

const pinnedClustering = createFinalSeededClusteringStrategy(
  createSoftSimplexEmbeddingClusteringStrategy({ getEmbedding: (d) => d.vec }),
  { seedItems: fullCorpus },
);
  • Computes and pins the canonical full-corpus clusters, vertex assignments, UIDs, and OKLab colors once on initialization (or re-seeds cleanly whenever the viewport/mesh changes cluster count K).
  • Projects every chronological or filtered subset onto those pinned anchors with zero cluster hopping and path-independent parity at the final frame.
  • Enabled automatically whenever timeline is active with autoFinalSeed: true (the default). To disable automatic pinning and let clusters re-form dynamically at every timeline step, pass timeline={{ ..., autoFinalSeed: false }}.