MCPcopy Index your code
hub / github.com/simstudioai/sim / groupByLayer

Function groupByLayer

apps/sim/lib/workflows/autolayout/core.ts:189–200  ·  view source on GitHub ↗
(nodes: Map<string, GraphNode>)

Source from the content-addressed store, hash-verified

187 * Groups nodes by their layer number
188 */
189export function groupByLayer(nodes: Map<string, GraphNode>): Map<number, GraphNode[]> {
190 const layers = new Map<number, GraphNode[]>()
191
192 for (const node of nodes.values()) {
193 if (!layers.has(node.layer)) {
194 layers.set(node.layer, [])
195 }
196 layers.get(node.layer)!.push(node)
197 }
198
199 return layers
200}
201
202/**
203 * Resolves vertical overlaps between nodes in the same layer.

Callers 1

layoutBlocksCoreFunction · 0.85

Calls 3

setMethod · 0.65
getMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected