Connects two nodes in network (at level 0) by their ids (string).
add_edge( sbm, from_node, to_node, from_node_type = NULL, to_node_type = NULL, show_messages = TRUE, type_warning = TRUE )
sbm |
|
---|---|
from_node | Id of first node in edge |
to_node | Id of second node in edge |
from_node_type | Type of |
to_node_type | Type of |
show_messages | Should function inform of its actions such as when a model already exists so no changes are made? |
type_warning | If node types are not specified the model will issue a
warning and use the first node in networks type for both. To hide this
warning for unipartite networks set this to |
An S3 object of class sbm_network
. For details see
new_sbm_network
section "Class structure."
Other advanced:
add_node()
,
initialize_blocks()
,
node_to_block_edge_counts()
,
update_state()
# Start with network with 5 nodes all fully connected net <- sim_random_network(n_nodes = 5, prob_of_edge = 1) # Fully connected network will have 10 edges attr(net, 'n_edges')#> [1] 10# Add a new edge between two non-yet-seen nodes net <- net %>% add_edge('new_from_node', 'new_to_node')#>#>#> [1] 7#> [1] 11# adding an edge between two nodes already in the network net <- net %>% add_edge('new_from_node', 'new_to_node') # Another edge will be added attr(net, 'n_edges')#> [1] 12