Unable to Render/Display Graph Object
If a graph object has lots of attributes, a rendering error is generated when it is displayed. The following code illustrates the problem (error text is provided below it):
g1 <- make_tree(100, children = 5, mode = "undirected") V(g1)$ThisIsAReallyReallyReallyReallyReallyReallyLongAttributeName1 <- "text" V(g1)$ThisIsAReallyReallyReallyReallyReallyReallyLongAttributeName2 <- "text" V(g1)$ThisIsAReallyReallyReallyReallyReallyReallyLongAttributeName3 <- "text" V(g1)$ThisIsAReallyReallyReallyReallyReallyReallyLongAttributeName4 <- "text" V(g1)$ThisIsAReallyReallyReallyReallyReallyReallyLongAttributeName5 <- "text" V(g1)$ThisIsAReallyReallyReallyReallyReallyReallyLongAttributeName6 <- "text" V(g1)$ThisIsAReallyReallyReallyReallyReallyReallyLongAttributeName7 <- "text" V(g1)$ThisIsAReallyReallyReallyReallyReallyReallyLongAttributeName8 <- "text" V(g1)$ThisIsAReallyReallyReallyReallyReallyReallyLongAttributeName9 <- "text" g1
RESULT ---------------------------------- ERROR while rich displaying an object: Error in seq_len(no): argument must be coercible to non-negative integer
Traceback:
- FUN(X[[i]], ...)
- tryCatch(withCallingHandlers({ . if (!mime %in% names(repr::mime2repr)) . stop("No repr_* for mimetype ", mime, " in repr::mime2repr") . rpr <- repr::mime2repr[mime] . if (is.null(rpr)) . return(NULL) . prepare_content(is.raw(rpr), rpr) . }, error = error_handler), error = outer_handler)
- tryCatchList(expr, classes, parentenv, handlers)
- tryCatchOne(expr, names, parentenv, handlers[[1L]])
- doTryCatch(return(expr), name, parentenv, handler)
- withCallingHandlers({ . if (!mime %in% names(repr::mime2repr)) . stop("No repr_* for mimetype ", mime, " in repr::mime2repr") . rpr <- repr::mime2repr[mime] . if (is.null(rpr)) . return(NULL) . prepare_content(is.raw(rpr), rpr) . }, error = error_handler)
- repr::mime2repr[mime]
- repr_text.default(obj)
- paste(capture.output(print(obj)), collapse = "\n")
- capture.output(print(obj))
- evalVis(expr)
- withVisible(eval(expr, pf))
- eval(expr, pf)
- eval(expr, pf)
- print(obj)
- print.igraph(obj)
- .print.edges.compressed(x, names = names, max.lines = max.lines - . head_lines)
- .print.edges.compressed.limit(x, edges, names, max.lines)
- head_print(fun, max_lines = max.lines)
- head_print_callback(x, max_lines, header, footer, omitted_footer, . ...)
- x("width", no = can_max)
- ends(x, edges[seq_len(no)], names = names)
- as.igraph.es(graph, na.omit(es))
- na.omit(es)
- edges[seq_len(no)]
-
[.igraph.es(edges, seq_len(no)) - lazy_eval(args, data = c(attrs, .inc = .inc, inc = inc, adj = adj,
. .from = .from, from = from, .to = .to, to = to, .igraph.from = list(.Call(C_R_igraph_mybracket,
. graph, 3L)[as.numeric(x)]), .igraph.to = list(.Call(C_R_igraph_mybracket,
. graph, 4L)[as.numeric(x)]), .igraph.graph = list(graph),
.
%--%=%--%,%->%=%->%,%<-%=%<-%)) - lapply(x, lazy_eval, data = data)
- FUN(X[[i]], ...)
- eval(x$expr, data, x$env)
- eval(x$expr, data, x$env)
Ha! I wonder if this is the same problem as in #179
Yes, I think it is. The problem appears to be that when there are a sufficient number of lines containing attribute information, the edge list header is truncated and an error is generated. It's not the number of attributes, but the number of lines needed to summarize the attributes.
#179 is fixed and so is this