( graph: Graph<N, E, T> | MutableGraph<N, E, T> )
| 5660 | * @since 3.18.0 |
| 5661 | */ |
| 5662 | export const nodes = <N, E, T extends Kind = "directed">( |
| 5663 | graph: Graph<N, E, T> | MutableGraph<N, E, T> |
| 5664 | ): NodeWalker<N> => |
| 5665 | new Walker((f) => ({ |
| 5666 | [Symbol.iterator]() { |
| 5667 | const nodeMap = graphImpl(graph).nodes |
| 5668 | const iterator = nodeMap.entries() |
| 5669 | |
| 5670 | return { |
| 5671 | next() { |
| 5672 | const result = iterator.next() |
| 5673 | if (result.done) { |
| 5674 | return { done: true, value: undefined } |
| 5675 | } |
| 5676 | const [nodeIndex, nodeData] = result.value |
| 5677 | return { done: false, value: f(nodeIndex, nodeData) } |
| 5678 | } |
| 5679 | } |
| 5680 | } |
| 5681 | })) |
| 5682 | |
| 5683 | /** |
| 5684 | * Creates an iterator over all edge indices in the graph. |
nothing calls this directly
no outgoing calls
no test coverage detected