( mutable: MutableGraph<N, E, T>, edgeIndex: EdgeIndex, f: (data: E) => E )
| 2120 | * @since 3.18.0 |
| 2121 | */ |
| 2122 | export const updateEdge = <N, E, T extends Kind = "directed">( |
| 2123 | mutable: MutableGraph<N, E, T>, |
| 2124 | edgeIndex: EdgeIndex, |
| 2125 | f: (data: E) => E |
| 2126 | ): void => { |
| 2127 | const impl = getMutableImplForMutation(mutable) |
| 2128 | internal.withTransformation(mutable, () => { |
| 2129 | if (!impl.edges.has(edgeIndex)) { |
| 2130 | return |
| 2131 | } |
| 2132 | |
| 2133 | const currentEdge = impl.edges.get(edgeIndex)! |
| 2134 | const newData = f(currentEdge.data) |
| 2135 | impl.edges.set(edgeIndex, { |
| 2136 | source: currentEdge.source, |
| 2137 | target: currentEdge.target, |
| 2138 | data: newData |
| 2139 | }) |
| 2140 | }) |
| 2141 | } |
| 2142 | |
| 2143 | /** |
| 2144 | * Transforms every node's data in a mutable graph in place using the provided |
nothing calls this directly
no test coverage detected