DAGTeam-class: Consumer classes for directed acyclic graph evaluation

Description Usage Arguments Constructors Methods Internal Class Fields and Methods Author(s) See Also Examples

Description

A Consumer to route incoming tasks through nodes connected as a directed acyclic graph.

Usage

1
2
3
4
5
6
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().

Author(s)

Martin Morgan [email protected]

See Also

Team applies a single function across multiple threads..

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)
reset(strm)

Streamer documentation built on May 2, 2018, 3:13 a.m.