NodeSet: R6 class representing a set of nodes (defined by 'tag', see...

Description Details Active bindings Methods

Description

R6 class representing a set of nodes (defined by 'tag', see helpers).

R6 class representing a set of nodes (defined by 'tag', see helpers).

Details

The set is composed of nodes, nodes are inserted and then tracked by id. Identical nodes (name and attributes) have their children merged on insert.

Active bindings

size

number of distinct nodes in the set

ids

of all nodes in the set.

child_ids

list of ids of all node children

attributes

list of attributes of all nodes

data

list of data of all nodes

dump

all data/attributes from all nodes as lists

Methods

Public methods


Method new()

Used as NodeSet$new(...) create a new node set

Usage
NodeSet$new(...)
Arguments
...

nodes to be inserted into the set

Returns

a 'NodeSet' object.


Method insert()

insert a new node into the set, if it is identical (name and attributes) as a current member, merge it into that member so that all children are preserved.

Usage
NodeSet$insert(x)
Arguments
x

node to insert

Returns

TRUE iff the new node was not identical to any other node (set size increases).


Method link()

insert a new edge into the set, if it is identical to a current link, merge it into that link

Usage
NodeSet$link(from, to, f = NULL)
Arguments
from

id of originating node

to

id of target node

f

transfer function implementing the edge

Returns

id of edge


Method clear()

clear the current nodes from the set

Usage
NodeSet$clear()

Method get()

get a node from the set

Usage
NodeSet$get(x)
Arguments
id

hash of the node

Returns

node with the 'id', or NULL if missing


Method pop()

pop the set, return the remaining node or error if multiple nodes remain

Usage
NodeSet$pop()

Method filter()

return a subset node set with only a subset of nodes.

Usage
NodeSet$filter(...)
Arguments
...

expression (matches 'dplyr::filter' used to subset

Returns

subset of nodes


Method mutate()

modify nodes returns modified nodes *also* modifies original

Usage
NodeSet$mutate(..., .which = "data")
Arguments
...

expression (matches 'dplyr::mutate') used to modify

Returns

modified nodes


Method build()

apply a process (a list of transitions) to all nodes in the set until no new nodes are created.

Usage
NodeSet$build(process)
Arguments
process

the process to apply

Returns

the final count of nodes


Method modify()

apply a process (a list of transitions) to all nodes in the set once. Does not create new nodes.

Usage
NodeSet$modify(process)
Arguments
process

the process to apply

Returns

the final count of nodes


Method clone()

The objects of this class are cloneable with this method.

Usage
NodeSet$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


sakrejda/smgr documentation built on Sept. 1, 2020, 10:03 a.m.