RemoveEdge removes the edge at the given index.
(index EdgeIndex)
| 212 | |
| 213 | // RemoveEdge removes the edge at the given index. |
| 214 | func (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. |
| 225 | func (g *Graph[N, E]) EdgeCount() int { |