VHRanger / nodevectors

Fastest network node embeddings in the west

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

G.mat got an asymmetric sparse matrix

garyhsu29 opened this issue · comments

Hello! Thanks for the great great work!
I encountered an issue while using nodevectors to train the prone embeddings:
I ran
G = cg.read_edgelist("..", directed=True, sep=',')
g2v = ProNE()
g2v.fit(G)

and I got:

ValueError Traceback (most recent call last)
Input In [34], in <cell line: 2>()
1 g2v = ProNE()
----> 2 g2v.fit(G)

File ~/miniforge3/envs/alphaA/lib/python3.8/site-packages/nodevectors/prone.py:82, in ProNE.fit(self, graph)
78 G = cg.csrgraph(graph)
79 features_matrix = self.pre_factorization(G.mat,
80 self.n_components,
81 self.exponent)
---> 82 vectors = ProNE.chebyshev_gaussian(
83 G.mat, features_matrix, self.n_components,
84 step=self.step, mu=self.mu, theta=self.theta)
85 self.model = dict(zip(G.nodes(), vectors))

File ~/miniforge3/envs/alphaA/lib/python3.8/site-packages/nodevectors/prone.py:154, in ProNE.chebyshev_gaussian(G, a, n_components, step, mu, theta)
151 return a
152 print(G.shape)
--> 154 A = sparse.eye(nnodes) + G
155 DA = preprocessing.normalize(A, norm='l1')
156 # L is graph laplacian

File ~/miniforge3/envs/alphaA/lib/python3.8/site-packages/scipy/sparse/base.py:414, in spmatrix.add(self, other)
412 elif isspmatrix(other):
413 if other.shape != self.shape:
--> 414 raise ValueError("inconsistent shapes")
415 return self._add_sparse(other)
416 elif isdense(other):

ValueError: inconsistent shapes

I further check the error and it showed that the G.mat is an asymmetric sparse matrix with shape (830421x830420)
Could you please give me any clue on this?