graph.proto: Create a graph of proto objects

Description Usage Arguments Details Value Note Examples

Description

Creates a graph of the parent/child relationships among a set of proto objects.

Usage

1
graph.proto(e, g = new("graphNEL", edgemode = "directed"), child.to.parent = TRUE)

Arguments

e

A proto object or an environment whose proto objects will be graphed.

g

A graph to add the edges and nodes to. Defaults to an empty graph.

child.to.parent

If TRUE then arrows are drawn from child to parent; otherwise, from parent to child.

Details

This function is used to create a graph in the sense of the "graph" package out of the parent child relationships of proto objects. All "proto" objects in "e" and their immediate parents are placed in the graph.

The objects are labelled using their "..Name" component. If there is no "..Name" component then their variable name in "e" is used. In the case of a parent that is not in "e", an internally generated name will be used if the parent has no "..Name" component. If two "proto" objects to be graphed have the same name the result is undefined.

Value

Produces an object of class "graph" that can subsequently be plotted.

Note

graph.proto makes use of the Rgraphviz package in the BioConductor repository and so Rgraphviz must be installed and loaded. On Linux one gotcha is that you may need to add the graphviz shared library, e.g. to add the directory containing the .so files, to your linker path via: export LD_LIBRARY_PATH=/path/to/graphviz/libs.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
a <- proto()
b <- a$proto()
g <- graph.proto()
plot(g)
g <- graph.proto(child.to.parent = FALSE) # change arrow heads
plot(g)
g <- graph.proto(g = new("graphNEL")) # undirected
plot(g)
g <- graph.proto()
attrs <- list(node = list(fillcolor = "lightgreen"), 
              edge = list(color = "cyan"),
      	graph = list(rankdir = "BT"))
plot(graph.proto(), attrs = attrs) # specify plot attributes

## End(Not run)

ggrothendieck/proto documentation built on May 17, 2019, 4:17 a.m.