Skip to content
Discussion options

You must be logged in to vote

So the add_self_loops function adds edges from each node to itself. Such a thing might be useful if you want to say pass a message from a node to itself , like lets say you have a graph with no self loops then a layer like GATConv will pay attention to only a nodes neighbors, but with add_self_loops it can pay some "attention" to itself too.

Now coming to the test case. add_self_loops doesn't check for existing self loops it simply appends all possible self loops to the edge_index so the expected output expected = [[0, 1, 0, 0, 1], [1, 0, 0, 0, 1]], the first three edges (0,1), (1,0), (0,0) are already present and the self loops (0,0), (1,1) are added the self loop (0,0) gets repeated.

On…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@quy-ng
Comment options

@alexrutherford
Comment options

@wsad1
Comment options

wsad1 Nov 3, 2021
Maintainer

@rusty1s
Comment options

Answer selected by quy-ng
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants