how can I get the isolated nodes in a graph? #4130
Answered
by
rusty1s
BodyCSoulN
asked this question in
Q&A
-
Hi, thanks for your great job. Because I have a graph stored in a neo4j database. I can't find a isolated node in neo4j. I don't know what went wrong? |
Beta Was this translation helpful? Give feedback.
Answered by
rusty1s
Feb 25, 2022
Replies: 1 comment
-
How about unique = data.edge_index.view(-1).unique()
mask = torch.ones(data.num_nodes, dtype=torch.bool)
mask[unique] = False
print(mask.nonzero()) # The indices of all isolated nodes. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
BodyCSoulN
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How about