Description Usage Arguments Examples
View source: R/add_gnm_graph.R
To an existing
graph object, add a graph built
according to the ErdosRenyi
G(n, m) model. This uses the
same constant probability when
creating the fixed number of
edges. Thus for n
nodes
there will be m
edges and,
if the loops
argument is
set as TRUE
, then random
loop edges will be part of
m
.
1 2 3 
graph 
a graph object of
class 
n 
the number of nodes comprising the generated graph. 
m 
the number of edges in the generated graph. 
loops 
a logical value
(default is 
type 
an optional string that describes the entity type for all the nodes to be added. 
label 
a boolean value where
setting to 
rel 
an optional string for providing a relationship label to all edges to be added. 
node_aes 
an optional list
of named vectors comprising node
aesthetic attributes. The helper
function 
edge_aes 
an optional list
of named vectors comprising edge
aesthetic attributes. The helper
function 
node_data 
an optional list
of named vectors comprising node
data attributes. The helper
function 
edge_data 
an optional list
of named vectors comprising edge
data attributes. The helper function

set_seed 
supplying a
value sets a random seed of the

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  # Create an undirected GNM
# graph with 100 nodes and
# 120 edges
gnm_graph <
create_graph(
directed = FALSE) %>%
add_gnm_graph(
n = 100,
m = 120)
# Get a count of nodes
gnm_graph %>%
count_nodes()
# Get a count of edges
gnm_graph %>%
count_edges()

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.