Import it from @grafloria/engine.
Subgraph layout computation utilities
tsclass SubgraphLayoutManager
Methods
static buildGroupTree(groups: GroupInfo[]): GroupTreeNode[](static) — Build hierarchical tree of groupsstatic getGroupsAtDepth(roots: GroupTreeNode[], depth: number): GroupInfo[](static) — Get all groups at a specific depth levelstatic getMaxDepth(roots: GroupTreeNode[]): number(static) — Get maximum depth of group treestatic getNodesInGroup( groupId: string, group: GroupInfo, allNodes: Array<{ id: string; [key: string]: any }>, options: SubgraphLayoutOptions ): Array<{ id: string; [key: string]: any }>(static) — Filter nodes by group membershipstatic getLinksInGroup( group: GroupInfo, allLinks: Array<{ sourceNodeId: string; targetNodeId: string; [key: string]: any }>, options: SubgraphLayoutOptions ): Array<{ sourceNodeId: string; targetNodeId: string; [key: string]: any }>(static) — Filter links within a groupstatic calculateGroupSize( group: GroupInfo, nodePositions: Map<string, { x: number; y: number }>, nodeSizes: Map<string, { width: number; height: number }>, options: SubgraphLayoutOptions ): { width: number; height: number }(static) — Calculate group size based on its contentstatic getGroupPadding( group: GroupInfo, options: SubgraphLayoutOptions ): { top: number; right: number; bottom: number; left: number }(static) — Get effective padding for a groupstatic positionGroups( groups: GroupInfo[], groupSizes: Map<string, { width: number; height: number }>, options: SubgraphLayoutOptions ): Map<string, { x: number; y: number }>(static) — Position groups relative to each otherstatic translateToGroupCoordinates( nodePositions: Map<string, { x: number; y: number }>, group: GroupInfo, groupPosition: { x: number; y: number }, options: SubgraphLayoutOptions ): Map<string, { x: number; y: number }>(static) — Translate node positions to group-local coordinatesstatic async layoutGroup( group: GroupInfo, allNodes: Array<{ id: string; [key: string]: any }>, allLinks: Array<{ sourceNodeId: string; targetNodeId: string; [key: string]: any }>, nodeSizes: Map<string, { width: number; height: number }>, layoutAdapter: any, options: SubgraphLayoutOptions ): Promise<{ nodePositions: Map<string, { x: number; y: number }>; bounds: { x: number; y: number; width: number; height: number }; }>(static) — Apply layout to a single groupstatic async computeSubgraphLayout( groups: GroupInfo[], allNodes: Array<{ id: string; [key: string]: any }>, allLinks: Array<{ sourceNodeId: string; targetNodeId: string; [key: string]: any }>, nodeSizes: Map<string, { width: number; height: number }>, layoutAdapter: any, options: SubgraphLayoutOptions ): Promise<SubgraphLayoutResult>(static) — Main subgraph layout computation
Was this page helpful?