rigraph icon indicating copy to clipboard operation
rigraph copied to clipboard

Unable to Render/Display Graph Object

Open devanssjc opened this issue 6 years ago • 2 comments

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:

  1. FUN(X[[i]], ...)
  2. 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)
  3. tryCatchList(expr, classes, parentenv, handlers)
  4. tryCatchOne(expr, names, parentenv, handlers[[1L]])
  5. doTryCatch(return(expr), name, parentenv, handler)
  6. 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)
  7. repr::mime2repr[mime]
  8. repr_text.default(obj)
  9. paste(capture.output(print(obj)), collapse = "\n")
  10. capture.output(print(obj))
  11. evalVis(expr)
  12. withVisible(eval(expr, pf))
  13. eval(expr, pf)
  14. eval(expr, pf)
  15. print(obj)
  16. print.igraph(obj)
  17. .print.edges.compressed(x, names = names, max.lines = max.lines - . head_lines)
  18. .print.edges.compressed.limit(x, edges, names, max.lines)
  19. head_print(fun, max_lines = max.lines)
  20. head_print_callback(x, max_lines, header, footer, omitted_footer, . ...)
  21. x("width", no = can_max)
  22. ends(x, edges[seq_len(no)], names = names)
  23. as.igraph.es(graph, na.omit(es))
  24. na.omit(es)
  25. edges[seq_len(no)]
  26. [.igraph.es(edges, seq_len(no))
  27. 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), . %--% = %--%, %->% = %->%, %<-% = %<-%))
  28. lapply(x, lazy_eval, data = data)
  29. FUN(X[[i]], ...)
  30. eval(x$expr, data, x$env)
  31. eval(x$expr, data, x$env)

devanssjc avatar May 26 '19 17:05 devanssjc

Ha! I wonder if this is the same problem as in #179

mbojan avatar May 27 '19 14:05 mbojan

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.

devanssjc avatar May 27 '19 15:05 devanssjc

#179 is fixed and so is this

ntamas avatar Nov 08 '22 15:11 ntamas