prune_nodes: Prune nodes based on given percentage

Description Usage Arguments See Also Examples

View source: R/prune_nodes.R

Description

Prune nodes based on given percentage

Usage

1
2
3
4
5
6
prune_nodes(
  p,
  percentage = 0.2,
  max = -1,
  rank = c("amount", "in_degree", "out_degree")
)

Arguments

p

process map object created by create_pmap_graph() function

percentage

how many percentage of the nodes should be pruned.

max

set max number of nodes to keep. If max >= 0, the percentage parameter will be ignored. if max < 0 then max will be ignored and percentage will be used to prune.

rank

how to rank the nodes. amount means ranking the nodes by amount column (default); in_degree means ranking the nodes by in_degree; out_degree means ranking the nodes by out_degree;

See Also

prune_edges

Examples

1
2
3
4
5
6
7
library(dplyr)
p <- generate_eventlog() %>% create_pmap(target_categories = c("target"))
DiagrammeR::count_nodes(p)
# [1] 10
p <- prune_nodes(p, percentage = 0.5)
DiagrammeR::count_nodes(p)
# [1] 5

twang2218/pmv documentation built on Nov. 6, 2021, 11:16 p.m.