# spanning

function in `@dioramajs/data/graph`

```ts
import { spanning } from '@dioramajs/data/graph'
```

A spanning tree by breadth from node 0, then from the first node of each other part: the
parent and depth of every node, and the roots of the parts.

```ts
function spanning(
  n: number,
  edges: readonly GraphEdge[],
): { depth: Int32Array; parent: Int32Array; roots: number[] }
```

| Parameter | Type | Description |
| --- | --- | --- |
| `n` | `number` |  |
| `edges` | `readonly GraphEdge[]` |  |

Defined in [packages/data/src/graph.ts](https://github.com/MasterKurosava/diorama/blob/main/packages/data/src/graph.ts#L207).
