Skip to content
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

Node2Vec IndexError: list index out of range #19

Closed
janvekarnaveed opened this issue Jul 29, 2020 · 2 comments
Closed

Node2Vec IndexError: list index out of range #19

janvekarnaveed opened this issue Jul 29, 2020 · 2 comments

Comments

@janvekarnaveed
Copy link

janvekarnaveed commented Jul 29, 2020

Hi,

After the fix of VHRanger/CSRGraph#3. I was successfully able to load my dataset in CSRGraph. But when I ran the following command, I get an error -
from nodevectors import Node2Vec
g2v = Node2Vec()
g2v.fit(G)

Error - ---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
in
3 # way faster than other node2vec implementations
4 # Graph edge weights are handled automatically
----> 5 g2v.fit(G)

~/SageMaker/CSRGraph/nodevectors/nodevectors/node2vec.py in fit(self, nxGraph)
93 node_names = list(nxGraph)
94 G = cg.csrgraph(nxGraph, threads=self.threads)
---> 95 if type(node_names[0]) not in [int, str, np.int32, np.uint32,
96 np.int64, np.uint64]:
97 raise ValueError("Graph node names must be int or str!")

IndexError: list index out of range

Ids in my datafile are int64 datatype. Interestingly when I run the following command. I can execute successfully.
from nodevectors import GGVec
ggvec_model = GGVec()
embeddings = ggvec_model.fit_transform(G)

@VHRanger
Copy link
Owner

OK, thanks a lot for filing the issue, I'll look into it later today.

I need to make all the code here differentiate between graph node ID and node name.

The code used to assume ID and name were the same, which is why we had all these constraints on what you could put in an edgelist file.

I'll have it fixed here and add some tests to make sure the interaction between the two packages is good.

@VHRanger
Copy link
Owner

VHRanger commented Aug 3, 2020

Try the latest release. It should be fixed and tested.

Just update nodevectors on pip (which should upgrade csrgraphs to 0.1.20 as well).

If you run into more problems please file more issues! There might be some intermittent segfault bug which I may have to chase down now.

Thanks for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants