( mutable: MutableGraph<N, E, T>, edgeIndices: Iterable<EdgeIndex> )
| 2859 | * @since 4.0.0 |
| 2860 | */ |
| 2861 | export const removeEdges = <N, E, T extends Kind = "directed">( |
| 2862 | mutable: MutableGraph<N, E, T>, |
| 2863 | edgeIndices: Iterable<EdgeIndex> |
| 2864 | ): void => { |
| 2865 | assertMutable(mutable) |
| 2866 | if (internal.isTransforming(mutable)) { |
| 2867 | throw new GraphError({ message: "Cannot mutate graph during a transformation" }) |
| 2868 | } |
| 2869 | const indices = internal.withTransformation(mutable, () => Array.from(edgeIndices)) |
| 2870 | const impl = getMutableImplForMutation(mutable) |
| 2871 | |
| 2872 | let removed = false |
| 2873 | for (const edgeIndex of indices) { |
| 2874 | if (removeEdgeInternal(impl, edgeIndex)) { |
| 2875 | removed = true |
| 2876 | } |
| 2877 | } |
| 2878 | |
| 2879 | if (removed) { |
| 2880 | invalidateCycleFlagOnRemoval(impl) |
| 2881 | } |
| 2882 | } |
| 2883 | |
| 2884 | /** @internal */ |
| 2885 | const removeEdgeInternal = <N, E, T extends Kind = "directed">( |
no test coverage detected