Note

This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.

rustworkx.directed_random_bipartite_graph#

directed_random_bipartite_graph(num_l_nodes, num_r_nodes, probability, /, seed=None)#

Generate a directed random bipartite graph.

A bipartite graph is a graph whose nodes can be divided into two disjoint sets, informally called “left nodes” and “right nodes”, so that every edge connects some left node and some right node.

Given a number n of left nodes, a number m of right nodes, and a probability p, the algorithm creates a graph with n + m nodes. For all the n * m possible directed edges from a left node to a right node, each edge is created independently with probability p.

Parameters:
  • num_l_nodes (int) – The number of “left” nodes in the random bipartite graph.

  • num_r_nodes (int) – The number of “right” nodes in the random bipartite graph.

  • probability (float) – The probability of creating an edge between two nodes as a float.

  • seed (int) – An optional seed to use for the random number generator.

Returns:

A PyDiGraph object

Return type:

PyDiGraph