complete_bipartite_graph

complete_bipartite_graph(n1, n2, create_using=None)[source]

Returns the complete bipartite graph K_{n_1,n_2}.

The graph is composed of two partitions with nodes 0 to (n1 - 1) in the first and nodes n1 to (n1 + n2 - 1) in the second. Each node in the first is connected to each node in the second.

Parameters
n1integer

Number of nodes for node set A.

n2integer

Number of nodes for node set B.

create_usingNetworkX graph instance, optional

Return graph of this type.

Notes

Node labels are the integers 0 to n_1 + n_2 - 1.

The nodes are assigned the attribute ‘bipartite’ with the value 0 or 1 to indicate which bipartite set the node belongs to.

This function is not imported in the main namespace. To use it use nx.bipartite.complete_bipartite_graph