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

Method RemoveEdge

internal/graph/graph.go:214–222  ·  view source on GitHub ↗

RemoveEdge removes the edge at the given index.

(index EdgeIndex)

Source from the content-addressed store, hash-verified

212
213// RemoveEdge removes the edge at the given index.
214func (g *Graph[N, E]) RemoveEdge(index EdgeIndex) {
215 edge, ok := g.edges[index]
216 if !ok {
217 return
218 }
219 g.adjacency[edge.Source] = removeFromSlice(g.adjacency[edge.Source], index)
220 g.reverseAdjacency[edge.Target] = removeFromSlice(g.reverseAdjacency[edge.Target], index)
221 delete(g.edges, index)
222}
223
224// EdgeCount returns the number of edges in the graph.
225func (g *Graph[N, E]) EdgeCount() int {

Callers 2

FilterEdgesMethod · 0.95
TestEdgeOperationsFunction · 0.80

Calls 1

removeFromSliceFunction · 0.85

Tested by 1

TestEdgeOperationsFunction · 0.64