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

Fix key output of networkx edge getter: #3646

Merged
merged 5 commits into from Dec 8, 2021

Conversation

max-zipfl-fzi
Copy link
Contributor

Removed the key output, which resulted in a three-dimensional tensor, when using MultiDiGraphs.
Three-dimensional edge tuples could not be converted into the required [2,-1] COO format.

Example:
Right:
print(list(G.edges(keys=False)))
[(2, 1), (5, 4), (5, 4), (5, 4), (6, 1), (7, 1)]

Wrong:
print(list(G.edges))
[(2, 1, 0), (5, 4, 0), (5, 4, 1), (5, 4, 2), (6, 1, 0), (7, 1, 0)]

Wrong:
print(torch.LongTensor(list(G.edges)))
tensor([[2, 1, 0],
[5, 4, 0],
[5, 4, 1],
[5, 4, 2],
[6, 1, 0],
[7, 1, 0]])
Right:
print(torch.LongTensor(list(G.edges(keys=False))).t().contiguous())
tensor([[2, 5, 5, 5, 6, 7],
[1, 4, 4, 4, 1, 1]])`

Removed the key output, which resulted in a three dimensional tensor, when using MultiDiGraphs.
Three dimensional edge tuples could not be converted into the required [2,-1] COO format.
Copy link
Member

@rusty1s rusty1s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like CI is failing. Can you ensure that all tests in test_convert.py still work?

@max-zipfl-fzi
Copy link
Contributor Author

max-zipfl-fzi commented Dec 7, 2021

I forget to check non multi-graphs:
Will add a check, whether a key should be removed or if it is not present in the first place.

Check: networkx graphtype
@codecov-commenter
Copy link

codecov-commenter commented Dec 7, 2021

Codecov Report

Merging #3646 (6ff72a7) into master (8630831) will decrease coverage by 0.02%.
The diff coverage is 75.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3646      +/-   ##
==========================================
- Coverage   81.50%   81.47%   -0.03%     
==========================================
  Files         294      294              
  Lines       14757    14734      -23     
==========================================
- Hits        12028    12005      -23     
  Misses       2729     2729              
Impacted Files Coverage Δ
torch_geometric/utils/convert.py 85.82% <75.00%> (-0.47%) ⬇️
torch_geometric/data/temporal.py 28.57% <0.00%> (-2.68%) ⬇️
torch_geometric/graphgym/optimizer.py 72.22% <0.00%> (-1.47%) ⬇️
torch_geometric/transforms/gdc.py 78.75% <0.00%> (-0.22%) ⬇️
torch_geometric/graphgym/models/layer.py 71.59% <0.00%> (-0.17%) ⬇️
torch_geometric/data/storage.py 80.89% <0.00%> (-0.08%) ⬇️
torch_geometric/loader/graph_saint.py 97.97% <0.00%> (-0.05%) ⬇️
torch_geometric/nn/conv/rgcn_conv.py 98.51% <0.00%> (-0.03%) ⬇️
torch_geometric/nn/models/gnn_explainer.py 96.72% <0.00%> (-0.02%) ⬇️
torch_geometric/deprecation.py 100.00% <0.00%> (ø)
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8630831...6ff72a7. Read the comment docs.

max-zipfl-fzi and others added 3 commits December 8, 2021 08:58
@rusty1s rusty1s merged commit 560df33 into pyg-team:master Dec 8, 2021
@rusty1s
Copy link
Member

rusty1s commented Dec 8, 2021

Super. Thank you :)

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 this pull request may close these issues.

None yet

3 participants