Skip to contents

[Deprecated] Generate bipartite graphs using the Erdős-Rényi model. Use sample_bipartite_gnm() and sample_bipartite_gnp() instead.

Usage

sample_bipartite(
  n1,
  n2,
  type = c("gnp", "gnm"),
  p,
  m,
  directed = FALSE,
  mode = c("out", "in", "all")
)

bipartite(..., type = NULL)

Arguments

n1

Integer scalar, the number of bottom vertices.

n2

Integer scalar, the number of top vertices.

type

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

Real scalar, connection probability for \(G(n,p)\) graphs. Should not be given for \(G(n,m)\) graphs.

m

Integer scalar, the number of edges for \(G(n,m)\) graphs. Should not be given for \(G(n,p)\) graphs.

directed

Logical scalar, whether to create a directed graph. See also the mode argument.

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.

...

Passed to sample_bipartite().

Value

A bipartite igraph graph.

Author

Gabor Csardi csardi.gabor@gmail.com

Examples


## empty graph
sample_bipartite(10, 5, p = 0)
#> Warning: `sample_bipartite()` was deprecated in igraph 2.2.0.
#>  Please use `sample_bipartite_gnp()` instead.
#> IGRAPH 8bd99db U--B 15 0 -- Bipartite Gnp random graph
#> + attr: name (g/c), p (g/n), type (v/l)
#> + edges from 8bd99db:

## full graph
sample_bipartite(10, 5, p = 1)
#> IGRAPH 2145ab4 U--B 15 50 -- Bipartite Gnp random graph
#> + attr: name (g/c), p (g/n), type (v/l)
#> + edges from 2145ab4:
#>  [1]  1--11  1--12  1--13  1--14  1--15  2--11  2--12  2--13  2--14  2--15
#> [11]  3--11  3--12  3--13  3--14  3--15  4--11  4--12  4--13  4--14  4--15
#> [21]  5--11  5--12  5--13  5--14  5--15  6--11  6--12  6--13  6--14  6--15
#> [31]  7--11  7--12  7--13  7--14  7--15  8--11  8--12  8--13  8--14  8--15
#> [41]  9--11  9--12  9--13  9--14  9--15 10--11 10--12 10--13 10--14 10--15

## random bipartite graph
sample_bipartite(10, 5, p = .1)
#> IGRAPH 0919784 U--B 15 8 -- Bipartite Gnp random graph
#> + attr: name (g/c), p (g/n), type (v/l)
#> + edges from 0919784:
#> [1] 4--12 5--12 1--13 2--13 7--13 2--14 3--14 5--15

## directed bipartite graph, G(n,m)
sample_bipartite(10, 5, type = "Gnm", m = 20, directed = TRUE, mode = "all")
#> Warning: `sample_bipartite()` was deprecated in igraph 2.2.0.
#>  Please use `sample_bipartite_gnm()` instead.
#> IGRAPH a1e9f78 D--B 15 20 -- Bipartite Gnm random graph
#> + attr: name (g/c), m (g/n), type (v/l)
#> + edges from a1e9f78:
#>  [1]  1->11  3->11  5->11  6->11  1->13  4->13  7->13  8->13  4->14  3->15
#> [11]  4->15 10->15 12-> 1 13-> 3 11-> 4 12-> 6 13-> 6 14-> 6 15-> 8 14->10