Skip to content

topologicalH1

function topologicalH1(
hdIn,
ldIn,
opts?): MetricResult & {
hdDiagram: Diagram;
ldDiagram: Diagram;
};

Defined in: metrics/topology.ts:413

Do the projection’s loops match the data’s?

The only measure here that sees a hole. Unrolling a circular manifold into an arc preserves every neighbourhood, every distance rank and every cluster — so trustworthiness, stress and Steadiness & Cohesiveness all stay high — while the loop it was built around is gone. This notices.

  • Needs: high-dimensional data and projection. No labels.
  • Range: [0, ∞), lower is better; 0 means the same loops at the same scales. With the default normalisation, values are in [0, 1].
  • Cost: expensive — it enumerates triangles, so roughly O(N³) and steeper in practice. maxPoints defaults to 200 and refuses beyond it; subsample both spaces on the same indices for larger data.
ParameterType
hdInPointsInput
ldInPointsInput
optsTopologyH1Options

MetricResult & { hdDiagram: Diagram; ldDiagram: Diagram; }

Rieck & Leitte, Computer Graphics Forum 34 (2015) https://doi.org/10.1111/cgf.12655

import { topologicalH1 } from "@saehrimnir/sickle";
// O(N³)-ish: `maxPoints` (default 200) is a guard that throws rather than
// subsamples, so subsample yourself for larger inputs.
const t = topologicalH1(circlePoints, arcPoints);
t.value; // 0.4068 — a loop present in the data but not in the drawing
t.localKind; // "none" — H1 does not decompose per point
t.hdDiagram; // [[0.1256, 1.7526]] — the loop that was lost
topologicalH1(circlePoints, arcPoints, { normalize: false }); // raw units