( mutable: MutableGraph<N, E, T>, f: (data: N) => N )
| 1862 | * @since 3.18.0 |
| 1863 | */ |
| 1864 | export const mapNodes = <N, E, T extends Kind = "directed">( |
| 1865 | mutable: MutableGraph<N, E, T>, |
| 1866 | f: (data: N) => N |
| 1867 | ): void => { |
| 1868 | assertMutable(mutable) |
| 1869 | const impl = graphImpl(mutable) |
| 1870 | |
| 1871 | // Transform existing node data in place |
| 1872 | for (const [index, data] of impl.nodes) { |
| 1873 | const newData = f(data) |
| 1874 | impl.nodes.set(index, newData) |
| 1875 | } |
| 1876 | } |
| 1877 | |
| 1878 | /** |
| 1879 | * Transforms all edge data in a mutable graph using the provided mapping function. |
nothing calls this directly
no test coverage detected