Skip to content

dfsPackGrid2

dfsPackGrid2<T>(items, columnCount, options): GridPackResult<T>

Defined in: grid-pack-dfs.ts:73

Packs items into a W-column grid using depth-first search with backtracking.

Items are placed in reading order (left-to-right, top-to-bottom) starting at the first empty cell. The caller controls candidate ordering through the classify weight function. When the node budget is exceeded, the algorithm preserves state at the deepest reached point, drills a hole to fill the remainder of the frontier row, and restarts the DFS from the next row.

Items not placed by the DFS are absent from result.place. The caller is responsible for placing them (tail placement) using result.grid.

T extends GridPackItem

T[]

number

GridPackOptions<T>

GridPackResult<T>