| title | API reference |
|---|---|
| description | Exports from @statelyai/layout and its package entry points |
Import these exports from @statelyai/layout.
| Export | Description |
|---|---|
getLayout |
Runs a registered or inline algorithm. |
getLayoutAlgorithm |
Returns a registered algorithm by ID. |
registerLayoutAlgorithm |
Adds or replaces a registered algorithm. |
| Export | Options type |
|---|---|
getBoxLayout |
BoxLayoutOptions |
getFixedLayout |
FixedLayoutOptions |
getLayeredLayout |
LayeredLayoutOptions |
getRandomLayout |
RandomLayoutOptions |
getRectanglePackingLayout |
RectanglePackingLayoutOptions |
getSporeCompactionLayout |
SporeLayoutOptions |
getSporeOverlapRemovalLayout |
SporeLayoutOptions |
| Export | ID |
|---|---|
boxAlgorithm |
box |
fixedAlgorithm |
fixed |
layeredAlgorithm |
layered |
randomAlgorithm |
random |
rectanglePackingAlgorithm |
rectpacking |
sporeCompactionAlgorithm |
sporeCompaction |
sporeOverlapRemovalAlgorithm |
sporeOverlap |
| Type | Description |
|---|---|
AnyGraph |
A graph with all data parameters set to unknown. |
LayoutAlgorithm |
Contract implemented by an algorithm. |
LayoutCapabilities |
Features declared by an algorithm. |
LayoutDiagnostic |
Structured layout message. |
LayoutDirection |
up, down, left, or right. |
LayoutExecutionContext |
Scope, cancellation, diagnostics, and timing. |
LayoutMetrics |
Overall timing and graph counts. |
LayoutPhaseMetrics |
Timing for one named phase. |
LayoutRequest |
Input to getLayout. |
LayoutResult |
Output from getLayout. |
LayoutScope |
Full, incremental, partial, or route-only scope. |
| Export | Description |
|---|---|
breakCyclesWithDepthFirstSearch |
Produces an acyclic orientation. |
assignLayersByLongestPath |
Assigns a layer to each node. |
minimizeCrossingsWithBarycenter |
Creates a crossing minimizer. |
placeNodesInLayers |
Produces node rectangles. |
routeEdgesOrthogonally |
Produces orthogonal edge routes. |
| Type | Description |
|---|---|
AcyclicOrientation |
Reversed edge IDs selected during cycle breaking. |
CrossingMinimizer |
Crossing minimization function. |
CycleBreaker |
Cycle-breaking function. |
EdgeRouter |
Edge-routing function. |
EdgeRoutes |
Route points keyed by edge ID. |
LayerAssigner |
Layer-assignment function. |
LayerAssignment |
Layer numbers keyed by node ID. |
LayeredLayoutOptions |
Options for layered layout. |
LayeredPhaseInput |
Common input supplied to layered phases. |
LayeredSpacing |
Node and layer spacing. |
LayeredStrategies |
Optional phase replacements. |
LayoutPadding |
Top, right, bottom, and left padding. |
LayerOrder |
Ordered node IDs grouped by layer. |
NodePlacement |
Node rectangles keyed by node ID. |
NodePlacer |
Node-placement function. |
NodeSize |
Node width and height. |
The layered entry point also exports:
- Cycle breakers:
breakCyclesByModelOrder,breakCyclesByStronglyConnectedConnectivity,breakCyclesByStronglyConnectedNodeType,breakCyclesGreedily,breakCyclesGreedilyByModelOrder,breakCyclesInteractively,breakCyclesWithModelOrderDepthFirstSearch, andbreakCyclesWithModelOrderBreadthFirstSearch. - Layer assigners:
assignLayersByLongestPathToSink,assignLayersByBreadthFirstModelOrder,assignLayersByDepthFirstModelOrder,assignLayersInteractively,assignLayersWithCoffmanGraham,assignLayersWithNetworkSimplex,assignLayersWithMinWidth, andassignLayersWithStretchWidth. - Crossing minimizers:
minimizeCrossingsWithMedian,minimizeCrossingsInteractively, andminimizeCrossingsWithModelOrder. - Node placers:
placeNodesInteractively,placeNodesWithBrandesKoepf,placeNodesWithLinearSegments, andplaceNodesWithNetworkSimplex. - Edge routers:
routeEdgesWithPolylinesandrouteEdgesWithSplines.
minimizeCrossingsWithBarycenter and minimizeCrossingsWithMedian accept an optional sweep count. The default is 7.
LayeredAdvancedOptions contains ELK layered option names without vendor prefixes. elkLayeredOptionDefinitions contains option names, ELK IDs, value types, and targets. elkLayeredEnumValues contains valid enum values.
toElkLayeredOptions(options) converts direction, padding, spacing, and advanced settings to ELK option IDs. fromElkLayeredOptionId(id) converts an ELK option ID to its simplified public name.
class LayoutError extends Error {
readonly code: string;
}getLayout uses UNKNOWN_ALGORITHM and INVALID_GRAPH codes.
class UnsupportedLayoutError extends LayoutError {}The error code is UNSUPPORTED_LAYOUT.
@statelyai/layout/layered exports the layered layout function, algorithm,
strategy functions, and layered types listed above. It does not export the
general registry or the other built-in algorithms.
@statelyai/layout/elkjs has a default ELK class export and these type
exports:
ElkConstructorArgumentsElkCommonDescriptionElkEdgeElkEdgeSectionElkGraphElementElkIdElkLabelElkLayoutAlgorithmDescriptionElkLayoutArgumentsElkLayoutCategoryDescriptionElkLayoutOptionDescriptionElkLoggingElkNodeElkPointElkPortElkShapeLaidOutElkNode