# serializeDisjointSetJson

## Call Signature

> **serializeDisjointSetJson**(`set`): [`SerializedIndexedDisjointSet`](/reference/knotkit/disjoint-set/wire/interfaces/serializedindexeddisjointset/)

Defined in: [packages/disjoint-set/src/serialization/json.ts:69](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/disjoint-set/src/serialization/json.ts#L69)

Capture the implementation kind and partition of a disjoint set. O(n \* alpha(n)) time and O(n) space.

Only the partition is captured. Labels are assigned from 0 upwards in order of first appearance, so structures with the same partition and element order serialize identically.

### Parameters

#### set

[`IndexedDisjointSet`](/reference/knotkit/disjoint-set/interfaces/indexeddisjointset/)

### Returns

[`SerializedIndexedDisjointSet`](/reference/knotkit/disjoint-set/wire/interfaces/serializedindexeddisjointset/)

## Call Signature

> **serializeDisjointSetJson**<`T`>(`set`): [`SerializedGrowableDisjointSet`](/reference/knotkit/disjoint-set/wire/interfaces/serializedgrowabledisjointset/)<`T`>

Defined in: [packages/disjoint-set/src/serialization/json.ts:70](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/disjoint-set/src/serialization/json.ts#L70)

Capture the implementation kind and partition of a disjoint set. O(n \* alpha(n)) time and O(n) space.

Only the partition is captured. Labels are assigned from 0 upwards in order of first appearance, so structures with the same partition and element order serialize identically.

### Type Parameters

#### T

`T`

### Parameters

#### set

[`GrowableDisjointSet`](/reference/knotkit/disjoint-set/interfaces/growabledisjointset/)<`T`>

### Returns

[`SerializedGrowableDisjointSet`](/reference/knotkit/disjoint-set/wire/interfaces/serializedgrowabledisjointset/)<`T`>
