(nodes: readonly GraphNode[])
| 229 | } |
| 230 | |
| 231 | function sharedDirectory(nodes: readonly GraphNode[]): string { |
| 232 | const paths = nodes.flatMap(node => node.file_path ? [node.file_path.replace(/\\/g, '/').split('/').slice(0, -1)] : []); |
| 233 | if (!paths.length) return 'Relationship group'; |
| 234 | const common = [...paths[0]!]; |
| 235 | for (const path of paths.slice(1)) { |
| 236 | let length = 0; |
| 237 | while (length < common.length && common[length] === path[length]) length++; |
| 238 | common.length = length; |
| 239 | } |
| 240 | return common.join('/') || 'Relationship group'; |
| 241 | } |
| 242 | |
| 243 | /** Pure deterministic multilevel cloud layout. Fixed iteration budgets keep |
| 244 | * work O(N + E) per pass; metadata/source paths only label the graph-derived |
no outgoing calls
no test coverage detected