()
| 3273 | const discovered = new Set<NodeIndex>() |
| 3274 | |
| 3275 | const nextMapped = () => { |
| 3276 | while (stack.length > 0) { |
| 3277 | const current = stack.pop()! |
| 3278 | |
| 3279 | if (discovered.has(current)) { |
| 3280 | continue |
| 3281 | } |
| 3282 | |
| 3283 | discovered.add(current) |
| 3284 | |
| 3285 | const nodeDataOption = graph.nodes.get(current) |
| 3286 | if (nodeDataOption === undefined) { |
| 3287 | continue |
| 3288 | } |
| 3289 | |
| 3290 | const neighbors = getTraversalNeighbors(graph, current, direction) |
| 3291 | for (let i = neighbors.length - 1; i >= 0; i--) { |
| 3292 | const neighbor = neighbors[i] |
| 3293 | if (!discovered.has(neighbor)) { |
| 3294 | stack.push(neighbor) |
| 3295 | } |
| 3296 | } |
| 3297 | |
| 3298 | return { done: false, value: f(current, nodeDataOption) } |
| 3299 | } |
| 3300 | |
| 3301 | return { done: true, value: undefined } as const |
| 3302 | } |
| 3303 | |
| 3304 | return { next: nextMapped } |
| 3305 | } |
nothing calls this directly
no test coverage detected