Get Connected Links
getConnectedLinks(x, upstream = TRUE, version = 1, dbg = FALSE, ...)
x | data frame with each row representing a link of the network. Required columns: us_node_id, ds_node_id |
---|---|
upstream | if TRUE (upstream), if FALSE (downstream), default: TRUE |
version | 1: R-implementation, 2: C-implementation, (default: 1) |
dbg | default: FALSE |
... | additional arguments passed to |
get connected links
network <- kwb.graph::exampleNetwork(n_links = -1L) runtime.R <- vector() runtime.C1 <- vector() runtime.C2 <- vector() n <- 1 resultSize <- 2054851 queueSize <- 100*1024 elapsed <- function(exp) system.time(exp)["elapsed"] for (i in 1:n) { cat("run", i, "/", n, "\n") runtime.R[i] <- elapsed(x1 <- getConnectedLinks( network )) runtime.C1[i] <- elapsed(x2 <- getConnectedLinks( network, version = 2, resultSize = resultSize, queueSize = queueSize )) runtime.C2[i] <- elapsed(x3 <- getConnectedLinks( network, version = 3, resultSize = resultSize, queueSize = queueSize )) }#> run 1 / 1#> mean runtime with R-functions: 3.009#> mean runtime with C-functions(1): 0.748#> mean runtime with C-functions(2): 0.8runtimeData <- data.frame( version = 1:3, runtime = c(runtime.R), runtime.C1, runtime.C2 ) boxplot(runtime ~ version, data = runtimeData)