-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create embeddings directly from an adjacency matrix (e.g. numpy.array or scipy.sparse)? #92
Comments
Each of the methods has a edge_f attribute which can be used to load the graph from a file containing edges, one edge per line. That is actually pretty fast and should work for your case. |
It looks like Lines 145 to 160 in 79be7fd
This function constructs the complete network in-memory as a networkx object. Creating a networkx graph is the inefficient step that is slow and memory-intensive with the STRING network. For example, Lines 58 to 65 in 5da6632
For Lines 52 to 68 in 5da6632
For Lines 74 to 80 in 5da6632
I'd love access the unified API of GEM, but with support for providing an edgelist file or scipy.sparse matrix directly as input, without having this converted to a networkx graph. It seems that several of the methods actually use more efficient data structures than the networkx graph and don't need networkx features at all. Do you have any suggestions on whether this would be possible? Even if just for one method? Currently, we've used node2vec without GEM to side-step this problem (notebook), but would love the ability to use the implementations in this package! |
I'm looking to create embeddings for the STRING protein-protein interaction database. In this notebook, I convert this network to
scipy.sparse.csr_matrix
andnumpy.array
formats. The network is big with 19,566 nodes and 11,759,454 (divide that in two for bidirectional edges).It's easy to convert the adjacency matrix to network, e.g. with
networkx.from_scipy_sparse_matrix
. But this is time consuming and the resulting networkx graph takes up a lot of memory. So my question is whether there are any embedding methods that can directly take an adjacency matrix? If so, perhaps that would be computationally be more efficient than going through networkx.Also any advice on what sort of hardware would be needed to operate on a graph of this size? Which methods are most efficient in terms of memory (and/or compute)? Thanks!
The text was updated successfully, but these errors were encountered: