# deriveMappingFromGraph

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

@shumoku/core · 0.4.0 · function

# deriveMappingFromGraph

[Source](https://github.com/konoe-akitoshi/shumoku/blob/main/libs/@shumoku/core/src/observation/metrics-binding.ts#L57)

Derive a legacy \`MetricsMapping\` from a resolved graph's bindings. - Node host binding → \`mapping.nodes\[node.id\]\`. - Link interface binding lives on a \`NodePort\`; we attribute it to the link whose endpoint references that port, keyed \`link.id || link-${i}\` to match the rest of the server (server.ts / topologies.ts). Pure; never mutates the input.

```
deriveMappingFromGraph(graph: NetworkGraph, activeSourceIds?: ReadonlySet<string>): MetricsMapping
```

## Parameters

| Parameter | Type | Description | Default |
| --- | --- | --- | --- |
| `graph` | `NetworkGraph` | No additional description. | `—` |
| `activeSourceIds` | `ReadonlySet<string>` | No additional description. | `—` |

## Returns

```
MetricsMapping
```

[`libs/@shumoku/core/src/observation/metrics-binding.ts:57`](https://github.com/konoe-akitoshi/shumoku/blob/main/libs/@shumoku/core/src/observation/metrics-binding.ts#L57)
