MCPcopy Create free account
hub / github.com/Effect-TS/tsgo / UpdateEdge

Method UpdateEdge

internal/graph/graph.go:206–211  ·  view source on GitHub ↗

UpdateEdge applies fn to the data of the edge at the given index. If the edge does not exist, this is a no-op.

(index EdgeIndex, fn func(E) E)

Source from the content-addressed store, hash-verified

204// UpdateEdge applies fn to the data of the edge at the given index.
205// If the edge does not exist, this is a no-op.
206func (g *Graph[N, E]) UpdateEdge(index EdgeIndex, fn func(E) E) {
207 if edge, ok := g.edges[index]; ok {
208 edge.Data = fn(edge.Data)
209 g.edges[index] = edge
210 }
211}
212
213// RemoveEdge removes the edge at the given index.
214func (g *Graph[N, E]) RemoveEdge(index EdgeIndex) {

Callers 1

TestEdgeOperationsFunction · 0.80

Calls 1

fnFunction · 0.50

Tested by 1

TestEdgeOperationsFunction · 0.64