JSPM

@antv/layout

2.0.0-beta.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 176074
  • Score
    100M100P100Q174160F
  • License MIT

graph layout algorithm

Package Exports

  • @antv/layout
  • @antv/layout/lib/_virtual/_cloneBuffer.js
  • @antv/layout/lib/_virtual/_cloneBuffer.js.map
  • @antv/layout/lib/_virtual/_commonjs-dynamic-modules.js
  • @antv/layout/lib/_virtual/_commonjs-dynamic-modules.js.map
  • @antv/layout/lib/_virtual/_commonjsHelpers.js
  • @antv/layout/lib/_virtual/_commonjsHelpers.js.map
  • @antv/layout/lib/_virtual/_nodeUtil.js
  • @antv/layout/lib/_virtual/_nodeUtil.js.map
  • @antv/layout/lib/_virtual/index.js
  • @antv/layout/lib/_virtual/index.js.map
  • @antv/layout/lib/_virtual/index2.js
  • @antv/layout/lib/_virtual/index2.js.map
  • @antv/layout/lib/_virtual/index3.js
  • @antv/layout/lib/_virtual/index3.js.map
  • @antv/layout/lib/_virtual/isBuffer.js
  • @antv/layout/lib/_virtual/isBuffer.js.map
  • @antv/layout/lib/_virtual/matrix.js
  • @antv/layout/lib/_virtual/matrix.js.map
  • @antv/layout/lib/_virtual/matrix2.js
  • @antv/layout/lib/_virtual/matrix2.js.map
  • @antv/layout/lib/algorithm/antv-dagre/acyclic.js
  • @antv/layout/lib/algorithm/antv-dagre/acyclic.js.map
  • @antv/layout/lib/algorithm/antv-dagre/add-border-segments.js
  • @antv/layout/lib/algorithm/antv-dagre/add-border-segments.js.map
  • @antv/layout/lib/algorithm/antv-dagre/coordinate-system.js
  • @antv/layout/lib/algorithm/antv-dagre/coordinate-system.js.map
  • @antv/layout/lib/algorithm/antv-dagre/data/list.js
  • @antv/layout/lib/algorithm/antv-dagre/data/list.js.map
  • @antv/layout/lib/algorithm/antv-dagre/graph.js
  • @antv/layout/lib/algorithm/antv-dagre/graph.js.map
  • @antv/layout/lib/algorithm/antv-dagre/greedy-fas.js
  • @antv/layout/lib/algorithm/antv-dagre/greedy-fas.js.map
  • @antv/layout/lib/algorithm/antv-dagre/index.d.ts
  • @antv/layout/lib/algorithm/antv-dagre/index.js
  • @antv/layout/lib/algorithm/antv-dagre/index.js.map
  • @antv/layout/lib/algorithm/antv-dagre/layout.js
  • @antv/layout/lib/algorithm/antv-dagre/layout.js.map
  • @antv/layout/lib/algorithm/antv-dagre/nesting-graph.js
  • @antv/layout/lib/algorithm/antv-dagre/nesting-graph.js.map
  • @antv/layout/lib/algorithm/antv-dagre/normalize.js
  • @antv/layout/lib/algorithm/antv-dagre/normalize.js.map
  • @antv/layout/lib/algorithm/antv-dagre/order/add-subgraph-constraints.js
  • @antv/layout/lib/algorithm/antv-dagre/order/add-subgraph-constraints.js.map
  • @antv/layout/lib/algorithm/antv-dagre/order/barycenter.js
  • @antv/layout/lib/algorithm/antv-dagre/order/barycenter.js.map
  • @antv/layout/lib/algorithm/antv-dagre/order/build-layer-graph.js
  • @antv/layout/lib/algorithm/antv-dagre/order/build-layer-graph.js.map
  • @antv/layout/lib/algorithm/antv-dagre/order/cross-count.js
  • @antv/layout/lib/algorithm/antv-dagre/order/cross-count.js.map
  • @antv/layout/lib/algorithm/antv-dagre/order/index.js
  • @antv/layout/lib/algorithm/antv-dagre/order/index.js.map
  • @antv/layout/lib/algorithm/antv-dagre/order/init-data-order.js
  • @antv/layout/lib/algorithm/antv-dagre/order/init-data-order.js.map
  • @antv/layout/lib/algorithm/antv-dagre/order/init-order.js
  • @antv/layout/lib/algorithm/antv-dagre/order/init-order.js.map
  • @antv/layout/lib/algorithm/antv-dagre/order/resolve-conflicts.js
  • @antv/layout/lib/algorithm/antv-dagre/order/resolve-conflicts.js.map
  • @antv/layout/lib/algorithm/antv-dagre/order/sort-subgraph.js
  • @antv/layout/lib/algorithm/antv-dagre/order/sort-subgraph.js.map
  • @antv/layout/lib/algorithm/antv-dagre/order/sort.js
  • @antv/layout/lib/algorithm/antv-dagre/order/sort.js.map
  • @antv/layout/lib/algorithm/antv-dagre/parent-dummy-chains.js
  • @antv/layout/lib/algorithm/antv-dagre/parent-dummy-chains.js.map
  • @antv/layout/lib/algorithm/antv-dagre/position/bk.js
  • @antv/layout/lib/algorithm/antv-dagre/position/bk.js.map
  • @antv/layout/lib/algorithm/antv-dagre/position/index.js
  • @antv/layout/lib/algorithm/antv-dagre/position/index.js.map
  • @antv/layout/lib/algorithm/antv-dagre/rank/feasible-tree.js
  • @antv/layout/lib/algorithm/antv-dagre/rank/feasible-tree.js.map
  • @antv/layout/lib/algorithm/antv-dagre/rank/index.js
  • @antv/layout/lib/algorithm/antv-dagre/rank/index.js.map
  • @antv/layout/lib/algorithm/antv-dagre/rank/network-simplex.js
  • @antv/layout/lib/algorithm/antv-dagre/rank/network-simplex.js.map
  • @antv/layout/lib/algorithm/antv-dagre/rank/util.js
  • @antv/layout/lib/algorithm/antv-dagre/rank/util.js.map
  • @antv/layout/lib/algorithm/antv-dagre/types.d.ts
  • @antv/layout/lib/algorithm/antv-dagre/util.js
  • @antv/layout/lib/algorithm/antv-dagre/util.js.map
  • @antv/layout/lib/algorithm/base-layout.d.ts
  • @antv/layout/lib/algorithm/base-layout.js
  • @antv/layout/lib/algorithm/base-layout.js.map
  • @antv/layout/lib/algorithm/base-simulation.d.ts
  • @antv/layout/lib/algorithm/base-simulation.js
  • @antv/layout/lib/algorithm/base-simulation.js.map
  • @antv/layout/lib/algorithm/circular/index.d.ts
  • @antv/layout/lib/algorithm/circular/index.js
  • @antv/layout/lib/algorithm/circular/index.js.map
  • @antv/layout/lib/algorithm/circular/types.d.ts
  • @antv/layout/lib/algorithm/combo-combined/index.d.ts
  • @antv/layout/lib/algorithm/combo-combined/index.js
  • @antv/layout/lib/algorithm/combo-combined/index.js.map
  • @antv/layout/lib/algorithm/combo-combined/types.d.ts
  • @antv/layout/lib/algorithm/concentric/index.d.ts
  • @antv/layout/lib/algorithm/concentric/index.js
  • @antv/layout/lib/algorithm/concentric/index.js.map
  • @antv/layout/lib/algorithm/concentric/types.d.ts
  • @antv/layout/lib/algorithm/d3-force-3d/index.d.ts
  • @antv/layout/lib/algorithm/d3-force-3d/index.js
  • @antv/layout/lib/algorithm/d3-force-3d/index.js.map
  • @antv/layout/lib/algorithm/d3-force-3d/types.d.ts
  • @antv/layout/lib/algorithm/d3-force/force-in-a-box.js
  • @antv/layout/lib/algorithm/d3-force/force-in-a-box.js.map
  • @antv/layout/lib/algorithm/d3-force/index.d.ts
  • @antv/layout/lib/algorithm/d3-force/index.js
  • @antv/layout/lib/algorithm/d3-force/index.js.map
  • @antv/layout/lib/algorithm/d3-force/types.d.ts
  • @antv/layout/lib/algorithm/dagre/index.d.ts
  • @antv/layout/lib/algorithm/dagre/index.js
  • @antv/layout/lib/algorithm/dagre/index.js.map
  • @antv/layout/lib/algorithm/dagre/types.d.ts
  • @antv/layout/lib/algorithm/force-atlas2/body.js
  • @antv/layout/lib/algorithm/force-atlas2/body.js.map
  • @antv/layout/lib/algorithm/force-atlas2/index.d.ts
  • @antv/layout/lib/algorithm/force-atlas2/index.js
  • @antv/layout/lib/algorithm/force-atlas2/index.js.map
  • @antv/layout/lib/algorithm/force-atlas2/quad-tree.js
  • @antv/layout/lib/algorithm/force-atlas2/quad-tree.js.map
  • @antv/layout/lib/algorithm/force-atlas2/quad.js
  • @antv/layout/lib/algorithm/force-atlas2/quad.js.map
  • @antv/layout/lib/algorithm/force-atlas2/simulation.d.ts
  • @antv/layout/lib/algorithm/force-atlas2/simulation.js
  • @antv/layout/lib/algorithm/force-atlas2/simulation.js.map
  • @antv/layout/lib/algorithm/force-atlas2/types.d.ts
  • @antv/layout/lib/algorithm/force/attractive.js
  • @antv/layout/lib/algorithm/force/attractive.js.map
  • @antv/layout/lib/algorithm/force/centripetal.js
  • @antv/layout/lib/algorithm/force/centripetal.js.map
  • @antv/layout/lib/algorithm/force/collide.js
  • @antv/layout/lib/algorithm/force/collide.js.map
  • @antv/layout/lib/algorithm/force/gravity.js
  • @antv/layout/lib/algorithm/force/gravity.js.map
  • @antv/layout/lib/algorithm/force/index.d.ts
  • @antv/layout/lib/algorithm/force/index.js
  • @antv/layout/lib/algorithm/force/index.js.map
  • @antv/layout/lib/algorithm/force/repulsive.js
  • @antv/layout/lib/algorithm/force/repulsive.js.map
  • @antv/layout/lib/algorithm/force/simulation.d.ts
  • @antv/layout/lib/algorithm/force/simulation.js
  • @antv/layout/lib/algorithm/force/simulation.js.map
  • @antv/layout/lib/algorithm/force/types.d.ts
  • @antv/layout/lib/algorithm/fruchterman/index.d.ts
  • @antv/layout/lib/algorithm/fruchterman/index.js
  • @antv/layout/lib/algorithm/fruchterman/index.js.map
  • @antv/layout/lib/algorithm/fruchterman/simulation.js
  • @antv/layout/lib/algorithm/fruchterman/simulation.js.map
  • @antv/layout/lib/algorithm/fruchterman/types.d.ts
  • @antv/layout/lib/algorithm/grid/index.d.ts
  • @antv/layout/lib/algorithm/grid/index.js
  • @antv/layout/lib/algorithm/grid/index.js.map
  • @antv/layout/lib/algorithm/grid/types.d.ts
  • @antv/layout/lib/algorithm/mds/index.d.ts
  • @antv/layout/lib/algorithm/mds/index.js
  • @antv/layout/lib/algorithm/mds/index.js.map
  • @antv/layout/lib/algorithm/mds/types.d.ts
  • @antv/layout/lib/algorithm/radial/index.d.ts
  • @antv/layout/lib/algorithm/radial/index.js
  • @antv/layout/lib/algorithm/radial/index.js.map
  • @antv/layout/lib/algorithm/radial/radial-nonoverlap-force.js
  • @antv/layout/lib/algorithm/radial/radial-nonoverlap-force.js.map
  • @antv/layout/lib/algorithm/radial/types.d.ts
  • @antv/layout/lib/algorithm/random/index.d.ts
  • @antv/layout/lib/algorithm/random/index.js
  • @antv/layout/lib/algorithm/random/index.js.map
  • @antv/layout/lib/algorithm/random/types.d.ts
  • @antv/layout/lib/algorithm/types.d.ts
  • @antv/layout/lib/index.d.ts
  • @antv/layout/lib/index.js
  • @antv/layout/lib/index.js.map
  • @antv/layout/lib/model/data.d.ts
  • @antv/layout/lib/model/data.js
  • @antv/layout/lib/model/data.js.map
  • @antv/layout/lib/registry.d.ts
  • @antv/layout/lib/registry.js
  • @antv/layout/lib/registry.js.map
  • @antv/layout/lib/runtime/context.d.ts
  • @antv/layout/lib/runtime/context.js
  • @antv/layout/lib/runtime/context.js.map
  • @antv/layout/lib/runtime/supervisor.d.ts
  • @antv/layout/lib/runtime/supervisor.js
  • @antv/layout/lib/runtime/supervisor.js.map
  • @antv/layout/lib/types/common.d.ts
  • @antv/layout/lib/types/data.d.ts
  • @antv/layout/lib/types/edge-label.d.ts
  • @antv/layout/lib/types/force.d.ts
  • @antv/layout/lib/types/id.d.ts
  • @antv/layout/lib/types/point.d.ts
  • @antv/layout/lib/types/position.d.ts
  • @antv/layout/lib/types/size.d.ts
  • @antv/layout/lib/util/array.d.ts
  • @antv/layout/lib/util/array.js
  • @antv/layout/lib/util/array.js.map
  • @antv/layout/lib/util/common.d.ts
  • @antv/layout/lib/util/common.js
  • @antv/layout/lib/util/common.js.map
  • @antv/layout/lib/util/format.js
  • @antv/layout/lib/util/format.js.map
  • @antv/layout/lib/util/math.d.ts
  • @antv/layout/lib/util/math.js
  • @antv/layout/lib/util/math.js.map
  • @antv/layout/lib/util/object.d.ts
  • @antv/layout/lib/util/object.js
  • @antv/layout/lib/util/object.js.map
  • @antv/layout/lib/util/order.d.ts
  • @antv/layout/lib/util/order.js
  • @antv/layout/lib/util/order.js.map
  • @antv/layout/lib/util/point.d.ts
  • @antv/layout/lib/util/point.js
  • @antv/layout/lib/util/point.js.map
  • @antv/layout/lib/util/size.d.ts
  • @antv/layout/lib/util/size.js
  • @antv/layout/lib/util/size.js.map
  • @antv/layout/lib/util/viewport.d.ts
  • @antv/layout/lib/util/viewport.js
  • @antv/layout/lib/util/viewport.js.map
  • @antv/layout/lib/worker.js
  • @antv/layout/lib/worker.js.map
  • @antv/layout/worker

Readme

AntV Layout

Basic layout algorithms for visualization

Build Status Coverage npm Version npm Download npm License

AntV Layout Preview

@antv/layout is a collection of basic layout algorithms. It ships with a wide range of layouts, unifies graph data and layout APIs, and turns graph structures into renderable coordinates.

✨ Highlights

  • Coverage: common graph layouts (force, dagre, radial, grid, combo)
  • Built for visualization: real-world scenarios and workflows
  • Performance: fast defaults + optional WebWorker offloading
  • Integration: easy to plug into your rendering pipeline
  • TypeScript & docs: typed APIs with complete documentation

🧩 Layouts

Layout Preview Description
Force ForceAtlas2 ForceAtlas2 Force-directed layout for large graphs with acceleration options (e.g. Barnes–Hut).
Force Force Force Highly configurable force model for fine-grained tuning and process control.
Force Fruchterman Fruchterman Classic force-directed layout for small/medium graphs with balanced distribution.
Force D3Force D3Force d3-force style simulation wrapper for composing link/manyBody/collide forces.
Force D3Force3D D3Force3D 3D force layout based on d3-force-3d with z-axis forces and z output.
Hierarchy Dagre Dagre Layered directed layout for DAGs, workflows, and dependency graphs.
Hierarchy AntVDagre AntVDagre Production-oriented hierarchical layout with spacing, alignment, and path info.
Radial Circular Circular Place nodes on a circle (or spiral) with ordering, angle, and radius controls.
Radial Concentric Concentric Layer nodes by an importance score (default: degree), pulling higher scores inward.
Radial Radial Radial Focus-centered rings based on shortest-path distance for relationship exploration.
Regular Grid Grid Stable grid placement for predictable layouts like cards, lists, and matrices.
Others MDS MDS Multidimensional scaling to match ideal distances and produce a balanced global structure.
Combo ComboCombined ComboCombined Composite layout for combos/subgraphs with per-level strategies and consistent bounds/spacing.

πŸš€ Installation

npm install @antv/layout

πŸ“ Quick Start

import { CircularLayout } from '@antv/layout';

const data = {
  nodes: [{ id: 'node1' }, { id: 'node2' }, { id: 'node3' }],
  edges: [
    { source: 'node1', target: 'node2' },
    { source: 'node2', target: 'node3' },
  ],
};

async function run() {
  const layout = new CircularLayout({ center: [200, 200], radius: 150 });

  await layout.execute(data);

  layout.forEachNode((node) => {
    console.log(node.id, node.x, node.y);
  });
}

run();

🧡 Worker support

Set enableWorker: true to run layouts in a WebWorker when supported. See the docs for worker setup and layout configuration details.

🀝 Contributing

Contributions are welcome. See CONTRIBUTING.md for guidelines and local workflows.

πŸ“„ License

MIT licensed. See LICENSE for details.