@Jakob wrote:
Hi,
i would like to remove multiple edges from a SimpleWeightedDiGraph based on their weight.
However, naively looping over edges as in the example below does not yield the desired result, presumably because the internal ordering of the edges is changed when an edge is removed.
using LightGraphs, SimpleWeightedGraphs g = SimpleWeightedDiGraph([1, 2, 3], [2, 3, 1], [1.0, 6.0, 4.0]) c = 5.0 for e in edges(g) if weight(e) < c rem_edge!(g, e) end end julia> ne(g) 3
Does anyone have an efficient solution for this?
Best
Jakob
Posts: 1
Participants: 1