Learn R Programming

stCEG (version 0.1.0)

create_reduced_CEG: Create a Reduced Chain Event Graph (CEG)

Description

This function generates a reduced version of a Chain Event Graph (CEG) based on a set of starting labels. It extracts connected nodes and edges from the input CEG object, and visualizes the result using the visNetwork package.

Usage

create_reduced_CEG(
  ceg_object,
  start_labels,
  level_separation = 1200,
  node_distance = 300
)

Value

A visNetwork object representing the reduced CEG, with interactive visualization features, such as node selection, highlighting of edges, and layout manipulation.

Arguments

ceg_object

A list containing the Chain Event Graph (CEG) data, including nodes and edges. The ceg_object must have the structure ceg_object$ceg$x$nodes and ceg_object$ceg$x$edges.

start_labels

A character vector containing the labels of the nodes from which the floret extraction should start.

level_separation

A numeric value determining the separation between levels in the hierarchical layout. Default is 1200.

node_distance

A numeric value controlling the distance between nodes in the hierarchical layout. Default is 300.

Examples

Run this code
data <- homicides
event_tree <- create_event_tree(data, columns = c(1,2,4,5), "both")
coloured_tree <- ahc_colouring(event_tree)

tree_priors <- specify_priors(coloured_tree, prior_type = "Uniform", ask_edit = FALSE)
staged_tree <- staged_tree_prior(coloured_tree, tree_priors)
ceg <- create_ceg(staged_tree, view_table = TRUE)
create_reduced_CEG(ceg, "Adult")


Run the code above in your browser using DataLab