Generate bipartite graphs using the Erdos-Renyi model

create_bipartite(
  n_type1,
  n_type2,
  strategy = c("gnp", "gnm"),
  p,
  m,
  directed = FALSE,
  mode = c("out", "in", "all"),
  graph = c("igraph", "network")
)

Arguments

n_type1

integer, number of vertices of the first type

n_type2

integer, number of vertices of the first type

strategy

Character scalar, the type of the graph, ‘gnp’ creates a $G(n,p)$ graph, ‘gnm’ creates a $G(n,m)$ graph. See details below.

p

probability for $G(n,p)$ graphs. Should not be given for $G(n,m)$ graphs.

m

integer, the number of edges for $G(n,p)$ graphs. Should not be given for $G(n,p)$ graphs.

directed

logical, whether to create a directed graph

mode

Character scalar, specifies how to direct the edges in directed graphs. If it is ‘out’, then directed edges point from bottom vertices to top vertices. If it is ‘in’, edges point from top vertices to bottom vertices. ‘out’ and ‘in’ do not generate mutual edges. If this argument is ‘all’, then each edge direction is considered independently and mutual edges might be generated. This argument is ignored for undirected graphs.

graph

character, the type of graph to be generated: igraph or network

Value

a graph of class network or igraph

Details

Generate a random bipartite network, either as a igraph or network object.

When using strategy 'gnp', a bipartite network is generated where each edge has probability 'p' of occuring. This means that consecutive runs of the algorithm will usually result in graphs with different numbers of edges.

When using strategy 'gnm', a bipartite network is generated with exactly 'm' edges. This means that consecutive runs of the algorithm will result in graphs with the same number of edges (but will occur between different vertices).

The generation is done through the sample_bipartite function.