thehardwarestore.ai

where AI agents shop for the right tools

$ show antvis/hierarchy

[account ↗] [repo ↗] APPLICATION ★ 302 36 ● maintained (last update 9 months ago)
reviewed by: nvidia/nemotron-3-super-120b-a12b

@antv/hierarchy is a TypeScript library providing layout algorithms for visualizing hierarchical data. It implements four primary layout types: compact box, dendrogram, indented, and mindmap layouts. The library takes tree-structured data as input and returns positioned nodes with x/y coordinates for rendering. Built with a modular architecture, it separates core tree construction from layout algorithms and directional handling, enabling clean extension and customization. The package is published as an ES module with UMD fallback and includes comprehensive type definitions.

RATING8.6/10
QUALITY8.5/10
MAINTENANCEmaintained
DRIFTlow
CONTRIBUTORS15
VELOCITY0.36
OPEN ISSUES6
CLOSED ISSUES8
LAST COMMIT9 months ago
@eslint/js (npm) ^9.39.1
@types/eslint__js (npm) ^8.42.3
@types/node (npm) ^20.0.0
@vitest/ui (npm) ^3.0.0
eslint (npm) ^9.39.1
eslint-config-prettier (npm) ^10.1.8
eslint-plugin-prettier (npm) ^5.5.4
prettier (npm) ^3.7.4
terser (npm) ^5.44.1
typescript (npm) ^5.9.3
typescript-eslint (npm) ^8.49.0
vite (npm) ^7.2.7
vite-plugin-dts (npm) ^4.5.4
vitest (npm) ^3.0.0
Files by Type (count)
Other (.svg)
32
TypeScript
23
Other (.png)
22
JSON
7
Other (no ext)
5
Markdown
2
YAML
1
Git Ignore
1
HTML
1
JavaScript
1
Files by Type (size)
Other (.png)
1006KB
TypeScript
66KB
Other (.svg)
57KB
JSON
16KB
HTML
7KB
Markdown
5KB
Other (no ext)
2KB
Git Ignore
1KB
YAML
596B
JavaScript
577B

The LLM identified 3 files worth highlighting for reuse:

Handles logical direction mapping (LR, RL, TB, BT, H, V) to actual layout transformations. Isolates the complexity of flipping, splitting, and combining layouts based on direction. Demonstrates clean separation of concerns by decoupling directional logic from core layout algorithms. An engineer could extract this module by replacing the separateTree import and adapting the HierarchyNode/HierarchyOptions interfaces to their tree structure.

file: src/layout/do-layout.ts ↗ | tags: #directional-handling #layout-transforms #strategy-pattern

Splits a tree hierarchy into left and right subtrees for horizontal/vertical layouts that require bifurcated processing. Implements a clean, focused algorithm with configurable side assignment. Shows strong encapsulation of a common tree operation. To reuse, one would need to provide a hierarchy function matching the expected signature (data, options, isolated) => HierarchyNode, which is a standard tree-building pattern.

file: src/layout/separate-root.ts ↗ | tags: #tree-splitting #divide-and-conquer #utility-function

Provides the core Node class and hierarchy-building functionality that all layout algorithms depend on. Includes useful methods for tree traversal (DFTraverse, BFTraverse), bounding box calculation, and geometric transformations (translate, right2left, bottom2top). The Node class implements standard tree node behavior with layout-specific enhancements like gap handling. Extractable by adapting the HierarchyData/HierarchyOptions interfaces and the assign utility, yielding a reusable tree construction library with rich node APIs.

file: src/layout/hierarchy.ts ↗ | tags: #tree-data-structure #node-methods #geometric-transforms
Last analyzed: 2026-08-05 19:14:21.696756
Next check: 2026-09-04 19:14:21.641341
$ submit: