Add a node to the network. Takes the node id (string), the node type (string), and the node level (int).
add_node(sbm, id, type = NULL, show_messages = TRUE)
sbm |
|
---|---|
id | Unique identifying name for node. |
type | Type of node (string). This is used to distinguish multipartite networks. E.g. "person", or "publication", etc.. |
show_messages | Should function inform of its actions such as when a model already exists so no changes are made? |
An S3 object of class sbm_network
. For details see
new_sbm_network
section "Class structure."
Other advanced:
add_edge()
,
initialize_blocks()
,
node_to_block_edge_counts()
,
update_state()
# Start with network with 5 nodes. net <- sim_random_network(n_nodes = 5, prob_of_edge = 1, setup_model = TRUE) # Verify nodes net$nodes#> # A tibble: 5 x 3 #> id block type #> <chr> <chr> <chr> #> 1 node_1 node node #> 2 node_2 node node #> 3 node_3 node node #> 4 node_4 node node #> 5 node_5 node node#> NULL# Add two nodes net <- net %>% add_node('new_node1', type = 'node') %>% add_node('new_node2', type = 'node') # New nodes are added to node data and state net$nodes#> # A tibble: 7 x 3 #> id block type #> <chr> <chr> <chr> #> 1 node_1 node node #> 2 node_2 node node #> 3 node_3 node node #> 4 node_4 node node #> 5 node_5 node node #> 6 new_node1 NA node #> 7 new_node2 NA node#> NULL