Render a laid out graph object
Description
This method uses the renderInfo
slot of a graph object to
render it on a plotting device. The graph must have been laid out
using the layoutGraph
function before.
Usage
1 2  ## S4 method for signature 'graph'
renderGraph(x, ..., drawNodes="renderNodes", drawEdges=renderEdges, graph.pars=list())

Arguments
x 
An object derived from class 
drawNodes 
A function that is used for the node rendering. The
details of its API are still undecided, so far the input to the
function is the (laid out) graph object. Defaults to

drawEdges 
A function that is used for the edge
rendering. Defaults to 
graph.pars 
A list of rendering parameters to use as
defaults. Parameters that have been explicitely set using

... 
further arguments 
Details
This method can render graph objects that have previously been laid
out using the function layoutGraph
. The details for user
defined node drawing remain to be decided.
Value
An object derived from class graph
with information about the
coordinates of the nodes in the coordinate system of the plotting
device added to the renderInfo
slot.
Author(s)
Florian Hahne
See Also
layoutGraph
,
link[graph:renderInfoclass]{nodeRenderInfo}
,
link[graph:renderInfoclass]{edgeRenderInfo}
,
link[graph:renderInfoclass]{graphRenderInfo}
,
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30  set.seed(123)
V < letters[1:5]
M < 1:2
g1 < randomGraph(V, M, 0.5)
edgemode(g1) < "directed"
x < layoutGraph(g1)
renderGraph(x)
## one of Graphviz's additional layout algorithms
x < layoutGraph(g1, layoutType="neato")
renderGraph(x)
## some tweaks to Graphviz's node and edge attributes,
## including a userdefined arrowhead and node shape functions.
myArrows < function(x, ...)
{
for(i in 1:4)
points(x,cex=i)
}
myNode < function(x, col, fill, ...)
symbols(x=mean(x[,1]), y=mean(x[,2]), thermometers=cbind(.5, 1,
runif(1)), inches=0.5,
fg=col, bg=fill, add=TRUE)
eAtt < list(arrowhead=c("a~b"=myArrows, "b~d"="odiamond", "d~e"="tee"))
nAtt < list(shape=c(d="box", c="ellipse", a=myNode))
edgemode(g1) < "directed"
x < layoutGraph(g1, edgeAttrs=eAtt, nodeAttrs=nAtt, layoutType="neato")
renderGraph(x)
