get_network_structure: Get network structre

View source: R/map_utilities.R

get_network_structureR Documentation

Get network structre

Description

Create a Bayesian network graph

Usage

get_network_structure(maplist, nodes, obs, nonlinear_ind = TRUE)

Arguments

maplist

A list of mapping objects

nodes

A vector with the node name associated to the variables. Several variables can belong to the same node.

obs

A vector of observed values. Unobserved values are represented by NA.

nonlinear_ind

Should non-linear interactions between nodes be indicated by dashed lines.

Value

Return an igraph graph object

Examples

## Not run: 
  library(igraph)
  params1 <- list(
    mapname = "mylinearmap1",
    maptype = "linearinterpol_map",
    src_idx = 1:3,
    tar_idx = 4:6,
    src_x = c(1,5,10),
    tar_x = c(4,5,6)
  )
  params2 <- list(
    mapname = "mylinearmap2",
    maptype = "linearinterpol_map",
    src_idx = 4:6,
    tar_idx = 7:9,
    src_x = c(4,5,7),
    tar_x = c(4.5, 5, 5.5)
  )
  compparams <- list(
    mapname = "mycompmap",
    maptype = "compound_map",
    maps = list(params1, params2)
  )

  mymap1 <- create_map(params1)
  mymap2 <- create_map(params2)

  mymap <- create_map(compparams)
  maplist <- mymap$getMaps()
  nodes <- c(rep("mynode1", 3),
             rep("mynode2", 3),
             rep("obsnode", 3))
  obs <- rep(NA, 9)

  grph <- get_network_structure(maplist, nodes, obs)
  plot(grph)

## End(Not run)


gschnabel/nucdataBaynet documentation built on Feb. 3, 2023, 4:13 a.m.