Docs Navigation (Stage 02)›

Pairwise k-Medoids Projection

Partitions arbitrary S(a, b) ∈ [0, 1] similarity kernels via PAM k-Medoids and QAP mesh embedding.

Key Takeaways

  • Use when items have neither tags nor fixed-length vectors—only a pairwise similarity function S(a, b) ∈ [0, 1].
  • Ideal for string edit distances, Gower trait kernels, AST/graph kernels, SQL join overlap, or biological sequence alignment.

Visual Mechanism

1. Kernel Matrix S(a, b) ∈ [0, 1]PAM Medoids2. Real Exemplar Medoids on 60° Meshm₁★m₂★m₃★
Operates directly on arbitrary pairwise similarity kernels S(a, b) ∈ [0, 1] without coordinates—selecting real exemplar medoids via PAM swaps and embedding them onto the 60° mesh.

Factory Signature

Re-exported from @simplex-viz/core, @simplex-viz/svg, and @simplex-viz/reactStage 02 Overview →
createSimilarityClusteringStrategy<TItem, TTagMeta>(options: SimilarityClusteringOptions<TItem>): SimplexClusteringStrategy<TItem, TTagMeta>

Options & Defaults

getSimilarityDefault: required

(a: TItem, b: TItem) => number

Symmetric domain similarity score clamped to [0, 1].

featuresDefault: undefined

readonly SubspaceZoomFeature<TItem>[] | undefined

Optional boolean, categorical, or numeric domain traits used to synthesize base-rate-aware, collision-free defaultLabels across all K medoid clusters.

clusterCountDefault: auto (round(√N))

number | undefined

Preferred number of medoids K.

anchorRuleDefault: 'simplex-projection'

'simplex-projection' | 'top-1'

Barycentric weighting across adjacent medoids on the planar mesh.

representativeCountDefault: 3

number

Number of top medoid/member items retained for cluster labeling.

Partitioning Around Medoids (PAM) on 60° Meshes

Pairwise k-Medoids Projection builds the symmetric N × N similarity matrix, selects K real domain items as cluster medoids via deterministic farthest-first initialization plus PAM swap refinement, embeds inter-medoid similarity onto the 60° mesh via QAP annealing, and projects every item onto its closest planar medoid triangle. Supplying features (or deriveLabel) turns medoid neighborhoods into concise, pairwise-distinct taxonomic or domain badges rather than raw exemplar IDs.

Usage Example

import {
  SimplexTopicGraph,
  createSimilarityClusteringStrategy,
} from '@simplex-viz/react';

const kernelClustering = createSimilarityClusteringStrategy<Protein>({
  getSimilarity: (a, b) => computeBlastAlignmentScore(a, b),
  clusterCount: 6,
});

<SimplexTopicGraph items={proteins} clusteringStrategy={kernelClustering} />;