Turns a graph dataframe (from gfpop) into a list that can be read by visNetwork

graphdf_to_visNetwork(
  graphdf,
  edgeSep = "_",
  showNull = TRUE,
  label_columns = c("type", "penalty"),
  label_collapse = " | ",
  edge_ids = c()
)

Arguments

graphdf

A graph object (in the form of a dataframe) from gfpop Must have the following columns:

  • "state1"

  • "state2"

  • "type"

  • "parameter"

  • "penalty"

  • "K"

  • "a"

  • "min"

  • "max"

edgeSep

A character seperating the nodes in an edge label

showNull

(Boolean) hide null edges?

label_columns

(character) An array of columns to use to make edge labels

label_collapse

the character separating edge columns in this label

edge_ids

An array of ids, one for each edge in the graphdf

Value

a list that can be read by visNetwork

Examples

graphdf_to_visNetwork(gfpop::graph(type = "std"), edge_ids = 1:2)
#> $nodes
#>     id label size start   end shape color.background color.border shadow
#> 1: Std   Std   40 FALSE FALSE   dot        lightblue    lightblue  FALSE
#> 
#> $edges
#>    id    label  to from type parameter penalty   K a  min  max
#> 1:  1 null | 0 Std  Std null         1       0 Inf 0 None None
#> 2:  2  std | 0 Std  Std  std         0       0 Inf 0 None None
#>    selfReference.angle selfReference.size hidden color
#> 1:            3.141593                 40  FALSE black
#> 2:            6.283185                 40  FALSE black
#>