R: Consumer classes for directed acyclic graph evaluation
DAGTeam
R Documentation
Consumer classes for directed acyclic graph evaluation
Description
A Consumer to route incoming tasks through nodes
connected as a directed acyclic graph.
Usage
DAGParam(x, ...)
DAGTeam(..., dagParam = DAGParam(), teamParam = MulticoreParam(1L))
## S3 method for class 'DAGTeam'
plot(x, y, ...)
Arguments
x
A matrix or data.frame with columns ‘From’,
‘To’, or a graphNEL object (from the graph package)
describing a directed acyclic graph.
...
For DAGTeam, named FunctionConsumer
instances, one for each node in the graph. The
FunctionConsumer corresponding to the first node in the graph
must accept one argument; remaining FunctionConsumer
instances must have as input arguments the names of the nodes from
which the inputs derive, as in the example below.
For DAGParam when x is a data.frame or matrix,
data.frame columns W, V or additional arguments
W, V as described in ftM2graphNEL.
dagParam
A DAGParam instance, with all nodes referenced
in the graph represented by FunctionConsumer instances
in ....
teamParam
A ParallelParam instance, such as generated by
MulticoreParam(). Currently ignored (all calculations are
performed on a single thread).
y
Unused.
Constructors
Use DAGParam and DAGTeam to construct instances of these
classes, with ParallelParam instances created by, e.g.,
MulticoreParam.
Methods
See Consumer Methods.
Internal Class Fields and Methods
Internal fields of this class are are described with, e.g.,
getRefClass("MulticoreTeam")$fields.
Internal methods of this class are described with
getRefClass("MulticoreTeam")$methods() and
getRefClass("MulticoreTeam")$help().
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(Streamer)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/Streamer/DAGTeam-class.Rd_%03d_medium.png", width=480, height=480)
> ### Name: DAGTeam
> ### Title: Consumer classes for directed acyclic graph evaluation
> ### Aliases: DAGTeam-class DAGParam-class DAGTeam DAGParam
> ### DAGParam,missing-method DAGParam,graphNEL-method
> ### DAGParam,matrix-method DAGParam,data.frame-method plot.DAGParam
> ### plot.DAGTeam
> ### Keywords: classes
>
> ### ** Examples
>
> df <- data.frame(From = c("A", "A", "B", "C"),
+ To = c("B", "C", "D", "D"),
+ stringsAsFactors=FALSE)
> dagParam <- DAGParam(df)
> dteam <- DAGTeam(A=FunctionConsumer(function(y) y),
+ B=FunctionConsumer(function(A) -A),
+ C=FunctionConsumer(function(A) 1 / A),
+ D=FunctionConsumer(function(B, C) B + C),
+ dagParam=dagParam)
>
> plot(dteam)
>
> strm <- Stream(Seq(to=10), dteam)
> sapply(strm, c)
[1] 0.000000 -1.500000 -2.666667 -3.750000 -4.800000 -5.833333 -6.857143
[8] -7.875000 -8.888889 -9.900000
> reset(strm)
>
>
>
>
>
>
> dev.off()
null device
1
>