Skip to content

converting adjacency matrix into numpy is slow #111

@idc9

Description

@idc9

Converting the adjacency matrix into a numpy array using the following method is pretty slow. I tried a few other ways of doing this to no avail.

G.summary()

IGRAPH DN-- 27885 234312 --

%%time
A = np.array(G.get_adjacency().data)

CPU times: user 3min 23s, sys: 1min 18s, total: 4min 42s
Wall time: 5min 31s

.get_adjacency() took about 3.5 min and np.array(--) took about 2 minutes.

Q: is there a faster way of getting the adjacency matrix as a numpy array?

Q: why is this method so slow (just curious)?

I'm using python 2.7, OS X 10.11.6, igraph 0.7.1, and numpy 1.11.1

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