# computeRoleDrivenRanks

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

@shumoku/core · 0.4.0 · function

# computeRoleDrivenRanks

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

Role-driven depth rank, robust to UNDIRECTED inventory cables (NetBox/Zabbix arrow:none). Direction can't be trusted, so the root is chosen by role + structure (the most peripheral boundary device = WAN edge) and depth is the BFS distance over the undirected graph — not raw link from→to (which makes a node whose cable happens to point "outward" a false source, e.g. a server at the top). High fan-out / thin-link sinks are not traversed through; a second pass reaches nodes that sit behind them.

```
computeRoleDrivenRanks(graph: NetworkGraph, sinks?: ReadonlySet<string>): Map<string, number>
```

## Parameters

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

## Returns

```
Map<string, number>
```

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