mbojan / rgraph6

Encoding graphs in graph6, sparse6, and digraph6 formats
https://mbojan.github.io/rgraph6/
GNU General Public License v3.0
12 stars 3 forks source link

as_elist_sparse6() trips on empty graphs #29

Closed mbojan closed 2 years ago

mbojan commented 2 years ago

Follow-up on #27:

s6 <- sapply(0:10,function(i) rgraph6::as_sparse6(igraph::graph.empty(n=i,directed = FALSE)))
edgelist_from_sparse6(s6)
## Error in rep(what, l - length(x)) : invalid 'times' argument

with

traceback()
## 8: expand_to_length(d2b(x), l = 6, what = 0, where = "start") at from_sparse6.R#70
## 7: FUN(X[[i]], ...)
## 6: lapply(X = X, FUN = FUN, ...)
## 5: sapply(as.numeric(rg) - 63, function(x) expand_to_length(d2b(x), 
##        l = 6, what = 0, where = "start")) at from_sparse6.R#70
## 4: FUN(X[[i]], ...)
## 3: lapply(s6, as_elist_sparse6)
## 2: structure(lapply(s6, as_elist_sparse6), names = s6) at from_sparse6.R#39
## 1: edgelist_from_sparse6(s6)