Skip to content

igraph.Layout should accept 2D numpy arrays #564

@iosonofabio

Description

@iosonofabio

Describe the bug
igraph.Layout should accept 2D numpy arrays.

To reproduce

import numpy as np
import igraph as ig

ig.Layout(np.arange(6).reshape((3, 2)))
--> ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

What work is to convert the array to list first:

mylist = list(np.arange(6).reshape((3, 2)))
ig.Layout(mylist)
--> <Layout with 3 vertices and 2 dimensions>

Version information
0.9.11 - happy to test develop if nobody recalls fixing this

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