( mutable: MutableGraph<N, E, T>, f: (data: E) => E )
| 2234 | * @since 3.18.0 |
| 2235 | */ |
| 2236 | export const mapEdges = <N, E, T extends Kind = "directed">( |
| 2237 | mutable: MutableGraph<N, E, T>, |
| 2238 | f: (data: E) => E |
| 2239 | ): void => { |
| 2240 | const impl = getMutableImplForMutation(mutable) |
| 2241 | internal.withTransformation(mutable, () => { |
| 2242 | // Transform existing edge data in place |
| 2243 | for (const [index, edgeData] of impl.edges) { |
| 2244 | const newData = f(edgeData.data) |
| 2245 | impl.edges.set(index, { |
| 2246 | source: edgeData.source, |
| 2247 | target: edgeData.target, |
| 2248 | data: newData |
| 2249 | }) |
| 2250 | } |
| 2251 | }) |
| 2252 | } |
| 2253 | |
| 2254 | /** |
| 2255 | * Swaps source and target nodes for every edge in a mutable graph. |
nothing calls this directly
no test coverage detected