Skip to content

Instantly share code, notes, and snippets.

@jakosz
Created February 11, 2014 12:47
Show Gist options
  • Save jakosz/8934238 to your computer and use it in GitHub Desktop.
Save jakosz/8934238 to your computer and use it in GitHub Desktop.
# Measuers execution times for given combinations of n, p.or.m and wh (image size)
test_erdos <-
function(n, p.or.m, wh, file) {
res = data.frame(game = 0, nodes = 0, edges = 0, side.px = 0, igraph = 0, seg = 0, seg.mc = 0, composite = 0)[-1, ]
for (i in n) {
for (j in p.or.m) {
g = erdos.renyi.game(n = i, p.or.m = j)
for (px in wh) {
cTest = test_times(g, px, px)
res = rbind(res,
data.frame(game = 'erdos.renyi',
nodes = i,
edges = length(E(g)),
side.px = px,
igraph = as.vector(cTest$tig[3]),
seg = as.vector(cTest$tse[3]),
seg.mc = as.vector(cTest$tmc[3]),
composite = cTest$imt))
write.csv(res, file, row.names = FALSE)
Sys.sleep(3)
}
rm(g); gc()
}
}
return(res)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment