visSbm {shinySbm}R Documentation

visSbm

Description

A fct that plot a visNetwork plot of a adjacency matrix or an Sbm fit from the sbm package.

Usage

visSbm(
  x,
  labels = "default",
  node_names = NULL,
  directed = "default",
  settings = list()
)

Arguments

x

Sbm model of class 'BipartiteSBM_fit', 'SimpleSBM_fit' or simple numeric 'matrix'.

labels

labels for nodes. If it's simple sbm it should be a single character ("default" -> c("nodes")). If sbm is bipartite a named character (names are row and col) ("default" -> c(row = 'row', col = 'col')).

node_names

if NULL do nothing specific, but list of nodes are given the graph get interactive and nodes names are showed by clicking on a block. In bipartite case a named list:

  • "row": character: node names in rows

  • "col": character: node names in columns

In unipartite case a single character vector containing the nodes names (Default = NULL).

directed

Boolean indicating whether or not the network is directed by default, a asymmetrical matrix will be seen as directed.

settings

list of settings

Details

List of parameters

Value

a visNetwork visual of the x object

Examples


# my_sbm_bi <- sbm::estimateBipartiteSBM(sbm::fungusTreeNetwork$fungus_tree,
#                                        model = 'bernoulli')
my_sbm_bi <- FungusTreeNetwork$sbmResults$fungus_tree

node_names_bi <- list(
  row = FungusTreeNetwork$networks$fungus_names,
  col = FungusTreeNetwork$networks$tree_names
)

visSbm(my_sbm_bi,
  labels = c(row = "Fungus", col = "Tree"),
  node_names = node_names_bi,
  settings = list(
    arrows = TRUE,
    arrow_start = "Fungus",
    node_color = c(row = "pink", col = "green"),
    node_shape = c(row = "dot", col = "square")
  )
)


# my_sbm_uni <- sbm::estimateSimpleSBM(sbm::fungusTreeNetwork$tree_tree,
#                                      model = "poisson")
my_sbm_uni <- FungusTreeNetwork$sbmResults$tree_tree

node_names_uni <- list(FungusTreeNetwork$networks$tree_names)

visSbm(my_sbm_uni,
  labels = c("Tree"),
  node_names = node_names_uni,
  settings = list(
    edge_threshold = 0.01,
    edge_color = "grey",
    node_color = c("violet")
  )
)


[Package shinySbm version 0.1.5 Index]