Skip to content

Commit 6a92e41

Browse files
author
Vincent Landau
committed
accommodate dif weight types
1 parent 9b4a288 commit 6a92e41

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/rastergraphs.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,16 @@ function make_raster_graph(
396396

397397
sources = Vector{Int64}()
398398
destinations = Vector{Int64}()
399-
weighted && (node_weights = Vector{Float64}())
399+
400+
weighted && (weight_type = eltype(raster))
401+
402+
if weighted && (weight_type <: Integer)
403+
@info ("weight_raster eltype is $(weight_type). " *
404+
"Promoting to Float64.")
405+
weight_type = Float64
406+
end
407+
408+
weighted && (node_weights = Vector{weight_type}())
400409

401410
# Add the edges
402411
# Only need to do neighbors down or to the right for undirected graphs

0 commit comments

Comments
 (0)