Optimize the runtime: change the weight of edges in an igraph takes long time. Is there a way to optimize it?
问题 I am searching for a set of edges in an igraph built from an osmar object and would like to change the weight of these. Since my graph is quite big, this task takes quite a long time. Since I run this function in a loop the runtime grows even bigger. Is there a way I could optimize this? Here is the code: library(osmar) library(igraph) library(tidyr) library(dplyr) ### Get data ---- src <- osmsource_api(url = "https://api.openstreetmap.org/api/0.6/") muc_bbox <- center_bbox(11.575278, 48