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

Indexing error when calling compute_ricci_curvature #30

Closed
IbtihalFerwana opened this issue Nov 23, 2021 · 2 comments
Closed

Indexing error when calling compute_ricci_curvature #30

IbtihalFerwana opened this issue Nov 23, 2021 · 2 comments

Comments

@IbtihalFerwana
Copy link

IbtihalFerwana commented Nov 23, 2021

Hello,

I'm new to using GraphRicciCurvature library,

I'm receiving an error when calling compute_ricci_curvature in this code snippet:

Gd = nx.Graph()
ricci_edge_index_ = np.array(data.edge_index)
ricci_edge_index = [(ricci_edge_index_[0, i],
                     ricci_edge_index_[1, i]) for i in
                    range(np.shape(data.edge_index)[1])]
Gd.add_edges_from(ricci_edge_index)
Gd_OT = OllivierRicci(Gd, alpha=0.5, method="Sinkhorn", verbose="INFO")
print("adding edges finished")
Gd_OT.compute_ricci_curvature()

It breaks in the last line, the trace back as follows:

multiprocessing.pool.RemoteTraceback: 
Traceback (most recent call last):
  File "/opt/miniconda3/envs/ocp-models/lib/python3.6/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/opt/miniconda3/envs/ocp-models/lib/python3.6/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "/home/.local/lib/python3.6/site-packages/GraphRicciCurvature/OllivierRicci.py", line 352, in _wrap_compute_single_edge
    return _compute_ricci_curvature_single_edge(*stuff)
  File "/home/.local/lib/python3.6/site-packages/GraphRicciCurvature/OllivierRicci.py", line 333, in _compute_ricci_curvature_single_edge
    m = _sinkhorn_distance(x, y, d)
  File "/home/.local/lib/python3.6/site-packages/GraphRicciCurvature/OllivierRicci.py", line 250, in _sinkhorn_distance
    m = ot.sinkhorn2(x, y, d, 1e-1, method='sinkhorn')[0]
IndexError: invalid index to scalar variable.

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

Traceback (most recent call last):
  File "pipelines.py", line 99, in <module>
    data_cnt)
  File "/home/TLC-GNN/baselines/TLCGNN.py", line 106, in call
    test_edges_false, name, hop = hop)
  File "/home/TLC-GNN/loaddatas.py", line 96, in compute_persistence_image
    ricci_cur = compute_ricci_curvature(data)
  File "/home/TLC-GNN/loaddatas.py", line 116, in compute_ricci_curvature
    Gd_OT.compute_ricci_curvature()
  File "/home/.local/lib/python3.6/site-packages/GraphRicciCurvature/OllivierRicci.py", line 766, in compute_ricci_curvature
    nbr_topk=self.nbr_topk)
  File "/home/.local/lib/python3.6/site-packages/GraphRicciCurvature/OllivierRicci.py", line 504, in _compute_ricci_curvature
    edge_ricci = _compute_ricci_curvature_edges(G, weight=weight, **kwargs)
  File "/home/.local/lib/python3.6/site-packages/GraphRicciCurvature/OllivierRicci.py", line 475, in _compute_ricci_curvature_edges
    for rc in result:
  File "/opt/miniconda3/envs/ocp-models/lib/python3.6/multiprocessing/pool.py", line 347, in <genexpr>
    return (item for chunk in result for item in chunk)
  File "/opt/miniconda3/envs/ocp-models/lib/python3.6/multiprocessing/pool.py", line 735, in next
    raise value
IndexError: invalid index to scalar variable.

Any thought about what could be the reason?

@saibalmars
Copy link
Owner

Hi can you provide the data.edge_index part so I can have a further look? Thanks.

@saibalmars
Copy link
Owner

Fixed in #35

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