A simple undirected graph with 5 nodes and 6 edges. The graph has been rendered with graphviz in the Linux command line, and with R packages Rgraphviz, and gridGraphviz in R.
In all cases the graph is explicitly declared with ellipse shaped nodes. The dot file edges are declared in alphabetical order as this is the (assumed) default for how Rgraphviz will pass edges internally to graphviz.
Dot file for graphviz:
|
R code for Rgraphviz and gridGraphviz: # load Rgraphviz library library(Rgraphviz) # define nodes and edges nodes <- c("a", "b", "c", "d", "e") edgeList <- list(a=list(edges=c("b", "c", "e")), b=list(edges=c("a", "c")), c=list(edges=c("a", "b", "d", "e")), d=list(edges=c("c")), e=list(edges=c("a", "c"))) # create graph object graph <- new("graphNEL", nodes = nodes, edgeL = edgeList, edgemode = "undirected") |
graphviz |
Rgraphviz |
gridGraphviz (old) |
gridGraphviz (new) |
|
# create Ragraph object rag <- agopen(graph, "", attrs=list(node=list(shape="ellipse"))) #plot plot(rag) |
library(gridGraphviz) # create Ragraph object rag <- agopen(graph, "", attrs=list(node=list(shape="ellipse"))) #plot grid.graph(rag) ## Warning: Unsupported node shape; using 'box' ## Warning: Unsupported node shape; using 'box' ## Warning: Unsupported node shape; using 'box' ## Warning: Unsupported node shape; using 'box' ## Warning: Unsupported node shape; using 'box' |
library(gridGraphviz) # create Ragraph object rag <- agopenTrue(graph, "", attrs=list(node=list(shape="ellipse"))) #plot grid.graph(rag) |
gridGraphviz (old) fails to produce ellipse shaped nodes, and produces "extra edges" which extend, in all cases, to the origin.