3

I like to use igraph to create and manipulate graphs, and I want to use DiagrammeR to make nice-looking visualizations of the graphs. I am having trouble converting my igraphs to the DiagrammeR format.

> library(igraph)
> library(DiagrammeR)
> g = make_empty_graph() + vertices(c("a", "b")) + edge("a", "b")
> x = from_igraph(g)
Warning messages:
1: In data.frame(from = as.integer(igraph::ends(igraph, igraph::E(igraph))[,  :
  NAs introduced by coercion
2: In data.frame(from = as.integer(igraph::ends(igraph, igraph::E(igraph))[,  :
  NAs introduced by coercion
> x
$graph_info
  graph_id     graph_name          graph_time graph_tz write_backups
1 6Z3ljgDB graph_6Z3ljgDB 2017-03-23 15:14:01     <NA>         FALSE

$nodes_df
  id type label
1  1 <NA>  <NA>
2  2 <NA>  <NA>
...

This is for drake, which is heavily reliant on igraph, and I am not willing to convert the internals to DiagrammeR.

landau
  • 5,636
  • 1
  • 22
  • 50
  • It's a bug of DiagrammeR IMO. It looks like it has problems when the graph has vertices names defined. In fact `g = make_empty_graph() + vertices(c(1, 2)) + edge(1, 2)` is correctly converted... – digEmAll Mar 23 '17 at 20:05
  • Hmm... that does not bode well for the drake package, where vertices have meaningful names. – landau Mar 23 '17 at 20:55

0 Answers0