tc_combine_edge_weights.Rd
Combine the edge weights of two or more travelcost graphs
tc_combine_edge_weights(..., fun = "*")
... | : two or more |
---|---|
fun | function or string: the function (or function name) to be used to combine the edge weights. The function must operate on sparse matrices as returned by |
A tc_graph
object, which is the first object in ...
but with edge weights modified
tc_build_graph()
, tc_combine_edge_weights()
my_raster <- raster::raster(ext = raster::extent(c(152.75, 155.25, -56.25, -54.25)), res = c(0.5, 0.5), crs = "+proj=longlat") g <- tc_build_graph(my_raster) ## set random edge weights g1 <- tc_set_edge_weights(g, values = runif(sum(tc_adj_matrix(g) > 0))) g2 <- tc_set_edge_weights(g, values = runif(sum(tc_adj_matrix(g) > 0))) ## sum of those two g3 <- tc_combine_edge_weights(g1, g2, fun = "+")