MCPcopy Create free account
hub / github.com/Effect-TS/effect / removeEdges

Function removeEdges

packages/effect/src/Graph.ts:2861–2882  ·  view source on GitHub ↗
(
  mutable: MutableGraph<N, E, T>,
  edgeIndices: Iterable<EdgeIndex>
)

Source from the content-addressed store, hash-verified

2859 * @since 4.0.0
2860 */
2861export 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 */
2885const removeEdgeInternal = <N, E, T extends Kind = "directed">(

Callers 2

filterMapEdgesFunction · 0.85
filterEdgesFunction · 0.85

Calls 5

assertMutableFunction · 0.85
removeEdgeInternalFunction · 0.85
fromMethod · 0.80

Tested by

no test coverage detected