Get the neighborhood of a node #7090
Answered
by
EdisonLeeeee
manuel-dileo
asked this question in
Q&A
-
Is there an easy way to get the neighborhood of a node from the edge_index on a graph with millions of nodes? |
Beta Was this translation helpful? Give feedback.
Answered by
EdisonLeeeee
Mar 31, 2023
Replies: 2 comments 1 reply
-
Ok, edge_index[1, edge_index[0] == node_idx] works well (I found this line of code in an answer on common neighbors). Maybe adding a method "neighbors" in torch_geometric.utils could be useful to find the solution to this problem fast? I can open a pull request on it |
Beta Was this translation helpful? Give feedback.
0 replies
-
You can also take a look at torch_geometric.utils.k_hop_subgraph |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
manuel-dileo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can also take a look at torch_geometric.utils.k_hop_subgraph