VHRanger / CSRGraph

A tiny library for large graphs
MIT License
111 stars 17 forks source link

Value error while reading into csr graph #3

Closed janvekarnaveed closed 4 years ago

janvekarnaveed commented 4 years ago

G = cg.read_edgelist("sample.edgelist", sep='\t') this leads to the following error - ~/anaconda3/envs/python3/lib/python3.6/site-packages/csrgraph/graph.py in init(self, data, nodenames, copy, threads) 107 raise ValueError(f""" 108 Out of bounds node: {max_idx}, nnodes: {self.nnodes} --> 109 """) 110 # Manage threading through Numba hack 111 if type(threads) is not int:

ValueError: Out of bounds node: 170625, nnodes: 146040

VHRanger commented 4 years ago

I'll be available to fix it next week.

In the mean time, can you supply the sample edgelist so I can use it when reproducing the bug? Thanks

janvekarnaveed commented 4 years ago

That'll be great if this issue can be fixed. sample_edgelist_0712.txt gives out of bounds error and largenumbererror.txt gives the following error -

ValueError Traceback (most recent call last)

in 1 import csrgraph as cg 2 ----> 3 G = cg.read_edgelist("seller_edgelist_0712.edgelist", sep=',', header=None) ~/anaconda3/envs/python3/lib/python3.6/site-packages/csrgraph/graph.py in read_edgelist(f, sep, header, **readcsvkwargs) 457 SRC: {elist.src.max()}, {elist.src.min()} 458 DST: {elist.dst.max()}, {elist.dst.min()} --> 459 """) 460 elist.src = elist.src.astype(np.uint32) 461 elist.dst = elist.dst.astype(np.uint32) ValueError: Invalid uint32 value in node IDs. Max/min : SRC: 333333333, 11111111111 DST: 444444444, 2222222222 [largenumbererror.txt](https://github.com/VHRanger/CSRGraph/files/4926737/largenumbererror.txt) [sample_edgelist_0712.txt](https://github.com/VHRanger/CSRGraph/files/4926718/sample_edgelist_0712.txt)
VHRanger commented 4 years ago

Hi,

I made some changes and fixed some bugs. The two error cases you provided should work and are in the unit tests now.

Please pull the current repo (not the pip version, which doesn't have the changes yet) to confirm it fixes the problem on your actual real world usecase.

Thanks!

janvekarnaveed commented 4 years ago

I can confirm that changes made worked. I was able to read the edgelist in CSR graph object. Thank you so much!