This page shows how to use @foblex/flow-elk-layout to calculate a manual graph layout with ELK.js and then render the result with Foblex Flow.
The important split is:
@foblex/flow-elk-layout calculates positions with ELK.js@foblex/flow renders nodes, connections, zoom, drag, and viewport behavior[example.html] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/libs/f-examples/plugins/elk-layout/example.html [example.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/libs/f-examples/plugins/elk-layout/example.ts [example.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/libs/f-examples/plugins/elk-layout/example.scss [apply-layout.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/libs/f-examples/plugins/utils/apply-layout.ts [generate-graph.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/libs/f-examples/plugins/utils/generate-graph.ts [layout-connection-sides.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/libs/f-examples/plugins/utils/layout-connection-sides.ts [layout-controls.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/libs/f-examples/plugins/utils/layout-controls.ts
If your project already includes a custom Flow theme, you can keep schematic installation but skip style injection:
For Nx workspaces:
ng add checks @foblex/flow and the required Foblex companion packages, adds only the missing ones, and wires the default Flow theme into application styles when it is missing.
If you prefer manual installation:
You do not need to install the underlying elkjs package separately because the adapter ships it as a runtime dependency.
calculate(...) returns only calculated node positions. In a real app you merge them back into your own node model by id.
In the demo integration, non-directional ELK.js algorithms automatically switch connectors into calculate mode so anchors adapt to the actual node placement.
IFLayoutNode[] and IFLayoutConnection[].calculate(...) on ElkLayoutEngine.f-flow.direction: graph direction via EFLayoutDirectionalgorithm: ELK.js algorithm via EElkLayoutAlgorithmnodeGap: spacing between nodeslayerGap: spacing between layersdefaultNodeSize: fallback size when a node does not provide sizelayoutOptions: raw ELK.js options forwarded to the engineAvailable algorithms in the adapter:
EElkLayoutAlgorithm.FIXEDEElkLayoutAlgorithm.BOXEElkLayoutAlgorithm.RANDOMEElkLayoutAlgorithm.LAYEREDEElkLayoutAlgorithm.STRESSEElkLayoutAlgorithm.MRTREEEElkLayoutAlgorithm.RADIALEElkLayoutAlgorithm.FORCEEElkLayoutAlgorithm.DISCOEElkLayoutAlgorithm.SPORE_OVERLAPEElkLayoutAlgorithm.SPORE_COMPACTIONEElkLayoutAlgorithm.RECT_PACKINGIf layout quality matters more than minimal configuration, ELK.js is usually the better starting point than a simpler tree-only approach.