diff --git a/src/simpleweighteddigraph.jl b/src/simpleweighteddigraph.jl index 7c41c26..e160f9b 100644 --- a/src/simpleweighteddigraph.jl +++ b/src/simpleweighteddigraph.jl @@ -163,10 +163,9 @@ Graphs.inneighbors(g::SimpleWeightedDiGraph, v::Integer) = g.weights[v, :].nzind # add_edge! will overwrite weights. function Graphs.add_edge!(g::SimpleWeightedDiGraph, e::SimpleWeightedGraphEdge) T = eltype(g) - U = weighttype(g) s_, d_, w = Tuple(e) - if w == zero(U) + if iszero(w) @warn "Note: adding edges with a zero weight to this graph type has no effect." maxlog = 1 _id = :swd_add_edge_zero return false diff --git a/src/simpleweightedgraph.jl b/src/simpleweightedgraph.jl index bfc990e..c6018f6 100644 --- a/src/simpleweightedgraph.jl +++ b/src/simpleweightedgraph.jl @@ -175,10 +175,9 @@ Graphs.inneighbors(g::SimpleWeightedGraph, x...) = outneighbors(g, x...) # add_edge! will overwrite weights. function Graphs.add_edge!(g::SimpleWeightedGraph, e::SimpleWeightedGraphEdge) T = eltype(g) - U = weighttype(g) s_, d_, w = Tuple(e) - if w == zero(U) + if iszero(w) @warn "Note: adding edges with a zero weight to this graph type has no effect." maxlog = 1 _id = :swg_add_edge_zero return false