# placeNode

Canonical: https://docs.shumoku.dev/en/library/api/placeNode
Language: en

@shumoku/core · 0.4.0 · function

# placeNode

[Source](https://github.com/konoe-akitoshi/shumoku/blob/main/libs/@shumoku/core/src/layout/interaction.ts#L137)

\*\*Geometric\*\* placement for a single unpositioned node: find the point nearest \`initial\` that doesn't overlap any existing node or subgraph. The graph's link structure is deliberately ignored — this is the primitive for "drop the node exactly where the user clicked", "paste at cursor", "convert BOM item to diagram node at the canvas edge", i.e. user-driven placement where the surrounding topology should not influence the outcome. For \*\*structural\*\* placement (re-layout based on link flow, pin a set of nodes, arrange a selection), use \`layoutNetwork\` with its \`fixed\` / \`hints\` options instead. The two APIs stay separate because their intents differ: \`placeNode\` is O(existing obstacles) geometry, \`layoutNetwork\` is a full Sugiyama run.

```
placeNode(node: Node, graph: { nodes: Map<string, Node>; subgraphs?: Map<string, Subgraph> }, initial: { x: number; y: number }, gap?: number): { x: number; y: number }
```

## Parameters

| Parameter | Type | Description | Default |
| --- | --- | --- | --- |
| `node` | `Node` | No additional description. | `—` |
| `graph` | `{ nodes: Map<string, Node>; subgraphs?: Map<string, Subgraph> }` | No additional description. | `—` |
| `initial` | `{ x: number; y: number }` | No additional description. | `—` |
| `gap` | `number` | No additional description. | `DEFAULT_NODE_GAP` |

## Returns

```
{ x: number; y: number }
```

[`libs/@shumoku/core/src/layout/interaction.ts:137`](https://github.com/konoe-akitoshi/shumoku/blob/main/libs/@shumoku/core/src/layout/interaction.ts#L137)
