networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersReturnsBackRef
biadjacency_matrix(G, row_order, column_order=None, dtype=None, weight='weight', format='csr')

Let :None:None:`G = (U, V, E)` be a bipartite graph with node sets :None:None:`U = u_{1},...,u_{r}` and :None:None:`V = v_{1},...,v_{s}`. The biadjacency matrix is the r x :None:None:`s` matrix :None:None:`B` in which :None:None:`b_{i,j} = 1` if, and only if, :None:None:`(u_i, v_j) \in E`. If the parameter :None:None:`weight` is not :None:None:`None` and matches the name of an edge attribute, its value is used instead of 1.

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.

Parameters

G : graph

A NetworkX graph

row_order : list of nodes

The rows of the matrix are ordered according to the list of nodes.

column_order : list, optional

The columns of the matrix are ordered according to the list of nodes. If column_order is None, then the ordering of columns is arbitrary.

dtype : NumPy data-type, optional

A valid NumPy dtype used to initialize the array. If None, then the NumPy default is used.

weight : string or None, optional (default='weight')

The edge data key used to provide each value in the matrix. If None, then each edge has weight 1.

format : str in {'bsr', 'csr', 'csc', 'coo', 'lil', 'dia', 'dok'}

The type of the matrix to be returned (default 'csr'). For some algorithms different implementations of sparse matrices can perform better. See for details.

Returns

M : SciPy sparse matrix

Biadjacency matrix representation of the bipartite graph G.

Returns the biadjacency matrix of the bipartite graph G.

See Also

adjacency_matrix
from_biadjacency_matrix

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.algorithms.bipartite.matrix.from_biadjacency_matrix

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/algorithms/bipartite/matrix.py#13
type: <class 'function'>
Commit: