Getting started with TopoLoom

TopoLoom is a planar graph layout and orthogonal drawing library for JavaScript and TypeScript. Install it, then use the kernel as a topology engine first and feed its outputs into geometry pipelines.

pnpm add @khalidsaidi/topoloom
# or npm i @khalidsaidi/topoloom

Minimal planarity check:

import { graph, planarity } from '@khalidsaidi/topoloom';

const g = graph.fromEdgeList([
  ['a', 'b'],
  ['b', 'c'],
  ['c', 'a'],
]);

const result = planarity.testPlanarity(g);
if (result.planar) {
  console.log('planar', result.embedding); // rotation system
} else {
  console.log('witness', result.witness); // K5 or K3,3 subdivision
}

Next steps: convert rotation systems into half-edge structures, build BC/SPQR decompositions to choose embeddings, use the dual graph for routing and edge insertion, and feed topology into straight-line or orthogonal (topology-shape-metrics) layout.

Home · Benchmarks · GitHub · npm