Return the biadjacency matrix of the bipartite graph G.
Let be a bipartite graph with node sets
and
. The biadjacency
matrix [1] is the
x
matrix
in which
if, and only if,
. If the parameter
is
not
and matches the name of an edge attribute, its value is
used instead of 1.
Parameters : | G : graph
row_order : list of nodes
column_order : list, optional
weight : string or None, optional (default=’weight’)
dtype : NumPy data type, optional
|
---|---|
Returns : | B : numpy matrix
|
See also
to_numpy_matrix, adjacency_matrix
Notes
No attempt is made to check that the input graph is bipartite.
For directed bipartite graphs only successors are considered as neighbors. To obtain an adjacency matrix with ones (or weight values) for both predecessors and successors you have to generate two biadjacency matrices where the rows of one of them are the columns of the other, and then add one to the transpose of the other.
References
[1] http://en.wikipedia.org/wiki/Adjacency_matrix#Adjacency_matrix_of_a_bipartite_graph