Skip to content

Failed to use scipy.sparse._csr.csr_matrix to init a graph. #771

Open
@Vimos

Description

@Vimos

Describe the bug
A clear and concise description of what the bug is.

Failed to use scipy.sparse._csr.csr_matrix to init a graph.

Traceback (most recent call last):
  File "/home/vimos/diffusion_for_train.py", line 78, in <module>
    x, y = diffusion_inverse_pairs(adj, seeds, args.diffusion_model)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vimos/diffusion_for_train.py", line 18, in diffusion_inverse_pairs
    G = Graph.Adjacency(adj_matrix)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vimos/anaconda3/lib/python3.11/site-packages/igraph/io/adjacency.py", line 54, in _construct_graph_from_adjacency
    return _graph_from_sparse_matrix(cls, matrix, mode=mode, loops=loops)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vimos/anaconda3/lib/python3.11/site-packages/igraph/sparse_matrix.py", line 104, in _graph_from_sparse_matrix
    edges.extend([(i, j)] * n)
                 ~~~~~~~~~^~~
TypeError: can't multiply sequence by non-int of type 'numpy.float32'

To reproduce
Steps or minimal example code to reproduce the problem.

If you are confident that the issue is not in the Python interface but in the
C core of igraph, please add it to the main igraph repo
instead.

If you are unsure, feel free to add your issue here - we will transfer it to
the main igraph repo if the root cause is
in the C core of igraph.

Version information
Which version of python-igraph are you using and where did you obtain it?

git+https://github.com/igraph/python-igraph@develop

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions