Description Usage Arguments Details Value Author(s) See Also Examples
These functions can be used to generate lists of pNode
and
pEdge
objects from an object of class graph
. These
lists can then be sent to Graphviz to initialize and layout the graph
for plotting.
1 2 3 | buildNodeList(graph, nodeAttrs = list(), subGList=list(), defAttrs=list())
buildEdgeList(graph, recipEdges=c("combined", "distinct"),
edgeAttrs = list(), subGList=list(), defAttrs=list())
|
graph |
An object of class |
nodeAttrs |
A list of attributes for specific nodes |
edgeAttrs |
A list of attributes for specific edges |
subGList |
A list of any subgraphs to be used in Graphviz |
recipEdges |
How to deal with reciprocated edges |
defAttrs |
A list of attributes used to specify defaults. |
These functions will take either the nodes or the edges of the
specified graph and generate a list of either pNode
or
pEdge
objects.
The recipEdges
argument can be used to specify how to handle
reciprocal edges. The default value, combined
will combine any
reciprocated edges into a single edge (and if the graph is directed,
will by default place an arrowhead on both ends of the edge), while
the other option is distinct
which will draw to separate
edges. Note that in the case of an undirected graph, every edge of a
graphNEL
is going to be reciprocal due to implementation issues.
The nodeAttrs
and edgeAttrs
attribute lists are to be
used for cases where one wants to set an attribute on a node or an
edge that is not the default. In both cases, these are lists with the
names of the elements corresponding to a particular attribute and the
elements containing a named vector - the names of the vector are names
of either node or edge objects and the values in the vector are the
values for this attribute.
Note that with the edgeAttrs
list, the name of the edges are in
a particular format where an edge between x and y is named x~y
.
Note that even in an undirected graph that x~y
is not the same
as y~x
- the name must be in the same order that the edge was
defined as having.
The subGraph
argument can be used to specify a list of
subgraphs that one wants to use for this plot. The buildXXXList
functions will determine if a particular node or edge is in one of the
subgraphs and note that in the object.
The defAttrs
list is a list used to specify any default values
that one wishes to use. The element names corresponde to the
attribute and the value is the default for that particular attribute.
If there is no default specified in defAttrs
for an attribute
declared in nodeAttrs
or edgeAttrs
, then the latter must
have a value for every node or edge in the graph. Otherwise, if a
default is supplied, that value is used for any node or edge not
explicitly defined for a particular attribute.
A list of class pNode
or pEdge
objects.
Jeff Gentry
agopen
, plot.graph
,
pNode
,pEdge
1 2 3 4 5 6 7 | set.seed(123)
V <- letters[1:10]
M <- 1:4
g1 <- randomGraph(V, M, .2)
z <- buildEdgeList(g1)
x <- buildNodeList(g1)
|
Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, sd, var, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, basename, cbind, colMeans, colSums, colnames,
dirname, do.call, duplicated, eval, evalq, get, grep, grepl,
intersect, is.unsorted, lapply, lengths, mapply, match, mget,
order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind,
rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply,
union, unique, unsplit, which, which.max, which.min
Loading required package: grid
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.