eye(m, n=None, k=0, dtype=<class 'float'>, format=None)
Returns a sparse (m x n) matrix where the kth diagonal is all ones and everything else is zeros.
Number of rows in the matrix.
Number of columns. Default: m
.
Diagonal to place ones on. Default: 0 (main diagonal).
Data type of the matrix.
Sparse format of the result, e.g., format="csr", etc.
Sparse matrix with ones on diagonal
>>> from scipy import sparse
... sparse.eye(3).toarray() array([[ 1., 0., 0.], [ 0., 1., 0.], [ 0., 0., 1.]])
>>> sparse.eye(3, dtype=np.int8) <3x3 sparse matrix of type '<class 'numpy.int8'>' with 3 stored elements (1 diagonals) in DIAgonal format>See :
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.convert_matrix.from_scipy_sparse_array
networkx.convert_matrix.from_scipy_sparse_matrix
scipy.sparse._construct.eye
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