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)
| 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. |
| 206 | func (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. |
| 214 | func (g *Graph[N, E]) RemoveEdge(index EdgeIndex) { |