1.8 KiB
1.8 KiB
id, name, status, depends_on, scope, risk, impact, level
| id | name | status | depends_on | scope | risk | impact | level | ||
|---|---|---|---|---|---|---|---|---|---|
| analysis/bottlenecks | Implement bottlenecks analysis function | completed |
|
narrow | low | component | implementation |
Description
Implement bottlenecks(graph: TaskGraph): Array<{ taskId: string; score: number }> using graphology-metrics betweenness centrality. Bottleneck tasks are those on the most shortest paths between other nodes.
Acceptance Criteria
bottlenecksreturns array of{ taskId, score }objects sorted by score descending- Uses
graphology-metricsbetweenness centrality computation - Normalized scores (0.0–1.0 range)
- Tasks with score 0 are still included (they're not bottlenecks)
- Works on disconnected graphs (betweenness is 0 for disconnected components)
- Unit tests: linear chain (middle node has highest betweenness), star graph (center has highest), independent nodes (all zero)
References
- docs/architecture/api-surface.md — bottlenecks signature
- docs/architecture/build-distribution.md — graphology-metrics dependency
Notes
Graphology-metrics betweenness centrality throws on empty graphs (mnemonist FixedStack requires positive capacity). Handled by returning empty array when graph.raw.order === 0.
Summary
Implemented bottlenecks(graph: TaskGraph): BottleneckResult[] using graphology-metrics betweenness centrality with normalized: true.
- Created:
src/analysis/bottleneck.ts(bottlenecks function + BottleneckResult interface) - Modified:
test/analysis.test.ts(replaced placeholder with 20 tests covering all acceptance criteria) - Tests: 20, all passing (linear chain, star graph, independent nodes, disconnected graph, diamond, empty graph, single node, sorted output, normalized scores)