Replies: 1 comment 1 reply
-
IMO, the current best way to do this is to convert your from torch_sparse import SparseTensor
adj = SparseTensor.from_edge_index(edge_index)
_, col, _ = adj[0].coo() # Will return the neighbors of node `0`
row, col, _ = adj[:10].coo() # Will return the neighbors of node `0, ..., 9` |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have problems obtaining the neighbors of a specific node.
I think one way is to convert the graph into networkx data structure and then use the API in networkx to get the neighbors. I feel this is not very efficient. Are there any methods to get the neighbors of a node efficiently? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions