serialize: Serializes the simplex tree.

Description Usage Arguments Details See Also Examples

View source: R/simplex_tree.R

Description

Provides a compressed serialization interface for the simplex tree.

Usage

1

Arguments

st

a simplex tree.

Details

The serialize/deserialize commands can be used to compress/uncompress the complex into smaller form amenable for e.g. storing on disk (see saveRDS) or saving for later use. The serialization.

See Also

Other serialization: deserialize()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
st <- simplex_tree(list(1:5, 7:9))
st2 <- deserialize(serialize(st))
all.equal(as.list(preorder(st)), as.list(preorder(st2)))
# TRUE 

set.seed(1234)
R <- rips(dist(replicate(2, rnorm(100))), eps = pnorm(0.10), dim = 2)
print(R$n_simplices)
# 100 384 851

## Approx. size of the full complex 
print(utils::object.size(as.list(preorder(R))), units = "Kb")
# 106.4 Kb

## Approx. size of serialized version 
print(utils::object.size(serialize(R)), units = "Kb")
# 5.4 Kb
## You can save these to disk via e.g. saveRDS(serialize(R), ...)

simplextree documentation built on Sept. 13, 2020, 5:06 p.m.