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

NetworkKit attribute issue causes ORC to fail #21

Closed
aksimhal opened this issue Dec 28, 2020 · 2 comments · Fixed by #22
Closed

NetworkKit attribute issue causes ORC to fail #21

aksimhal opened this issue Dec 28, 2020 · 2 comments · Fixed by #22

Comments

@aksimhal
Copy link

Hello!

Thanks for assembling this module! I'm trying to run the tutorial notebook (https://github.com/saibalmars/GraphRicciCurvature/blob/master/notebooks/tutorial.ipynb) and it threw an error on the 6th cell: orc.compute_ricci_curvature(). The issue listed was AttributeError: 'networkit.graph.Graph' object has no attribute 'neighbors'. When I looked at the NetworkKit documentation, it seems that neighbors is a deprecated field starting in version 6.0 https://networkit.github.io/news.html (current version is 8.0). I was also able to replicate the issue by running the notebook in the Google Collab link listed at the top of the notebook.

I've attached the full error log as well for your convenience. Let me know if there's anything else you'd like to see from my end.

Thanks!
Anish

RemoteTraceback                           Traceback (most recent call last)
RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/Users/[username]/anaconda3/envs/neuro/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/Users/[username]/anaconda3/envs/neuro/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "/Users/[username]/[folder]/GraphRicciCurvature/GraphRicciCurvature/OllivierRicci.py", line 354, in _wrap_compute_single_edge
    return _compute_ricci_curvature_single_edge(*stuff)
  File "/Users/[username]/[folder]/GraphRicciCurvature/GraphRicciCurvature/OllivierRicci.py", line 342, in _compute_ricci_curvature_single_edge
    x, y, d = _distribute_densities(source, target)
  File "/Users/[username]/[folder]/GraphRicciCurvature/GraphRicciCurvature/OllivierRicci.py", line 138, in _distribute_densities
    x, source_topknbr = _get_single_node_neighbors_distributions(source, "successors")
  File "/Users/[username]/[folder]/GraphRicciCurvature/GraphRicciCurvature/OllivierRicci.py", line 79, in _get_single_node_neighbors_distributions
    neighbors = _Gk.neighbors(node)
AttributeError: 'networkit.graph.Graph' object has no attribute 'neighbors'
"""

The above exception was the direct cause of the following exception:

AttributeError                            Traceback (most recent call last)
<ipython-input-6-b39f42f3b911> in <module>
----> 1 orc.compute_ricci_curvature()

~[username]/[folder]/GraphRicciCurvature/GraphRicciCurvature/OllivierRicci.py in compute_ricci_curvature(self)
    762                                           proc=self.proc, chunksize=self.chunksize, cache_maxsize=self.cache_maxsize,
    763                                           shortest_path=self.shortest_path,
--> 764                                           nbr_topk=self.nbr_topk)
    765         return self.G
    766 

~[username]/[folder]/GraphRicciCurvature/GraphRicciCurvature/OllivierRicci.py in _compute_ricci_curvature(G, weight, **kwargs)
    502 
    503     # compute Ricci curvature for all edges
--> 504     edge_ricci = _compute_ricci_curvature_edges(G, weight=weight, **kwargs)
    505 
    506     # Assign edge Ricci curvature from result to graph G

~[username]/[folder]/GraphRicciCurvature/GraphRicciCurvature/OllivierRicci.py in _compute_ricci_curvature_edges(G, weight, edge_list, alpha, method, base, exp_power, proc, chunksize, cache_maxsize, shortest_path, nbr_topk)
    473     # Convert edge index from nk back to nx for final output
    474     output = {}
--> 475     for rc in result:
    476         for k in list(rc.keys()):
    477             output[(nk2nx_ndict[k[0]], nk2nx_ndict[k[1]])] = rc[k]

~/anaconda3/envs/neuro/lib/python3.7/multiprocessing/pool.py in <genexpr>(.0)
    352                     result._set_length
    353                 ))
--> 354             return (item for chunk in result for item in chunk)
    355 
    356     def apply_async(self, func, args=(), kwds={}, callback=None,

~/anaconda3/envs/neuro/lib/python3.7/multiprocessing/pool.py in next(self, timeout)
    746         if success:
    747             return value
--> 748         raise value
    749 
    750     __next__ = next                    # XXX

AttributeError: 'networkit.graph.Graph' object has no attribute 'neighbors'```
@saibalmars
Copy link
Owner

Hi, thanks for bringing this up, it should be fixed in #22.

@aksimhal
Copy link
Author

Thanks so much!

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

Successfully merging a pull request may close this issue.

2 participants