elkjs

Layout graphs in JavaScript/TypeScript using ELK JSON formats.

Updated Feb 26, 2026
One-click install
npx skills add https://github.com/brocef/skill-cefailures --skill elkjs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: elkjs
Source: https://github.com/brocef/skill-cefailures/tree/main/skills/elkjs
Command: npx skills add https://github.com/brocef/skill-cefailures --skill elkjs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Graph layout is complex and time-consuming; elkjs provides a robust JavaScript/TypeScript interface to run ELK layout algorithms and produce coordinates for nodes, ports, labels, and edges in ELK's JSON format.

Core Features & Use Cases

  • Multiple algorithms including layered, stress, mrtree, radial, force, and disco for diverse layout needs.
  • ELK JSON graph format support with nodes, ports, labels, edges, and edge sections to drive rendering and interaction.
  • Web Worker support and per-element layoutOptions to enable non-blocking layouts in web apps.

Quick Start

Invoke elk.layout on a graph object to compute node/port coordinates and edge routes.

Frequently Asked Questions about elkjs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I compute graph layouts in JavaScript using ELK JSON format?

Compute graph layouts in JavaScript using ELK JSON format by invoking the elk.layout function on a graph object. This processes nodes, ports, labels, and edges to generate precise coordinates and edge routes for diagram rendering.

What layout algorithms are available for generating diagram coordinates in TypeScript?

Available layout algorithms for generating diagram coordinates in TypeScript include layered, stress, mrtree, radial, force, and disco. These algorithms support diverse layout needs and can be configured using per-element layoutOptions or global defaults.

Can I run non-blocking graph layouts in web apps with elkjs?

You can run non-blocking graph layouts in web apps with elkjs using its built-in Web Worker support. This allows complex layout calculations for large diagrams to execute asynchronously without freezing the user interface.

How do I configure per-element layout options versus global defaults for graph rendering?

Configure per-element layout options versus global defaults for graph rendering by setting layoutOptions on individual nodes, ports, or edges within the ELK JSON structure, overriding global algorithm defaults for granular control over diagram generation.

What's the best way to inspect available layout algorithms and options before rendering a graph?

The best way to inspect available layout algorithms and options before rendering a graph is by calling knownLayoutAlgorithms() and knownLayoutOptions(). These API functions expose available configurations for robust diagram generation and debugging workflows.