In response to this tweet
@riannone @abresler @timelyportfolio this popped into my head last week, how hard would it be to dump an igraph or graphNEL into diagrammeR?
— Tim Triche, Jr. (@timtriche) February 24, 2015
I made this little Gist. It illustrates one way to git an igraph
into DiagrammeR
using grViz
. One way to use igraph
with mermaid
can be seen in this Gist R ( igraph + DiagrammeR + pipeR +htmltools ) + JS ( mermaid.js + d3.js + dagre-d3.js ).
Full attribute customization will probably not be possible with these two methods. For this full set of functionality, Rich Iannone’s work with a data.frame
(think get.data.frame
from igraph
) will provide some amazing results.
library(igraph)
library(DiagrammeR)
tf <- tempfile()
write.graph(
graph.famous("Tetrahedron")
,tf
,format="dot"
)
grViz(
readLines(tf)
)
library(htmltools)
html_print(tagList(
lapply(
c("neato","circo","twopi")
,function(engine){ grViz( readLines(tf) , engine = engine ) }
)
))
unlink(tf)