From 9c74610c525a398bbe0a02025d1c4015887399fb Mon Sep 17 00:00:00 2001 From: Jan Kocka Date: Mon, 9 Dec 2024 16:10:28 +0000 Subject: [PATCH] switched from ? == zero(...) to iszero(?) for Num compatibility --- src/simpleweighteddigraph.jl | 3 +-- src/simpleweightedgraph.jl | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) 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