-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
MWE:
minimum_weight_perfect_matching(Graph([Edge(1,2)]), Dict(Edge(1,2)=>2.0))
ERROR: InexactError: trunc(Int32, NaN)
Stacktrace:
[1] trunc
@ ./float.jl:760 [inlined]
[2] round
@ ./float.jl:359 [inlined]
[3] minimum_weight_perfect_matching(g::SimpleGraph{Int64}, w::Dict{Graphs.SimpleGraphs.SimpleEdge{Int64}, Float64}; tmaxscale::Float64)
@ GraphsMatching ~/.julia/packages/GraphsMatching/f764e/src/blossomv.jl:40
[4] minimum_weight_perfect_matching(g::SimpleGraph{Int64}, w::Dict{Graphs.SimpleGraphs.SimpleEdge{Int64}, Float64})
@ GraphsMatching ~/.julia/packages/GraphsMatching/f764e/src/blossomv.jl:33
[5] top-level scope
@ REPL[558]:1
This fails due to the rescaling of weights which assumes that there are different weights:
GraphsMatching.jl/src/blossomv.jl
Lines 34 to 41 in 7d14c0b
wnew = Dict{E, Int32}() | |
cmax = maximum(values(w)) | |
cmin = minimum(values(w)) | |
tmax = typemax(Int32) / tmaxscale # /10 is kinda arbitrary, | |
# hopefully high enough to not occur in overflow problems | |
for (e, c) in w | |
wnew[e] = round(Int32, (c-cmin) / (cmax-cmin) * tmax) | |
end |
Metadata
Metadata
Assignees
Labels
No labels