drop_static: Drop

Description Usage Arguments Details Value Examples

Description

Drop nodes or edges.

Usage

1
2
3
sg_drop_nodes(sg, data, ids, delay, cumsum = TRUE)

sg_drop_edges(sg, data, ids, delay, cumsum = TRUE, refresh = FALSE)

Arguments

sg

An object of class sigmajsas intatiated by sigmajs.

data

Data.frame (or list) of nodes or edges.

ids

Ids of elements to drop.

delay

Column name containing delay in milliseconds.

cumsum

Whether to compute the cumulative sum of the delay.

refresh

Whether to refresh the graph after node is dropped, required to take effect, if you are running force the algorithm is killed and restarted at every iteration.

Details

The delay helps for build dynamic visualisations where nodes and edges do not disappear all at the same time. How the delay works depends on the cumsum parameter. if TRUE the function computes the cumulative sum of the delay to effectively drop each row one after the other: delay is thus applied at each row (number of seconds to wait before the row is dropped *since the previous row*). If FALSE this is the number of milliseconds to wait before the node or edge is dropped to the visualisation; delay is used as passed to the function.

Value

A modified version of the sg object.

Examples

1
2
3
4
5
6
7
8
9
nodes <- sg_make_nodes(75)

# nodes to drop
nodes2 <- nodes[sample(nrow(nodes), 50), ]
nodes2$delay <- runif(nrow(nodes2), 1000, 3000)

sigmajs() %>% 
  sg_nodes(nodes, id, size, color) %>% 
  sg_drop_nodes(nodes2, id, delay, cumsum = FALSE)

sigmajs documentation built on July 8, 2020, 5:16 p.m.