Skip to content

get_adjacency_sparse broken with scipy 1.13 and empty graphs #871

@flying-sheep

Description

@flying-sheep

Describe the bug

get_adjacency_sparse does sparse.csr_matrix((weights, list(zip(*edges))), shape=(N, N))

Since scipy 1.13, the constructor apparently expects edge tuples of length 2, and with an empty graph, zip(*edges) becomes ().

To reproduce

Call get_adjacency_sparse with scipy 1.13+ installed and you will see

ValueError: mismatching number of index arrays for shape; got 0, expected 2

Version information
1.0.0 from PyPI

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions