get_block {shinySbm}R Documentation

get_block generic

Description

A fct that return blocks attribution or probabilities for each nodes in a Sbm fit from the sbm package.

Usage

get_block(
  x,
  labels = "default",
  node_names = NULL,
  attribution = TRUE,
  proportion = FALSE
)

Arguments

x

Sbm model of class 'BipartiteSBM_fit', 'SimpleSBM_fit'.

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
  • "bipartite case": named list ("row","col"), row is a character vector containing names of nodes in rows, and respectively for columns

  • "unipartite case": character: node names

attribution

Boolean indicating whether or not the produced tables should contain a block attribution column. This column shows the block in which each nodes is the most likely to be.

proportion

Boolean indicating whether or not the produced tables should contain the probabilities to belong in each blocks. These columns shows for every nodes and every blocks the probabilities that the node belong to the block.

Value

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
)

my_blocks_bi <- get_block(my_sbm_bi,
  labels = c(row = "Fungus", col = "Tree"),
  node_names = node_names_bi
)
my_blocks_bi$row
my_blocks_bi$col

# 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)

my_blocks_uni <- get_block(my_sbm_uni,
  labels = c("Tree"),
  node_names = node_names_uni
)
my_blocks_uni

[Package shinySbm version 0.1.5 Index]