Skip to content
Discussion options

You must be logged in to vote
  1. You might want to look at torch.split which helps you to split the edge weights into a list of individual edge weights for each graph. You can use degree(batch[edge_index[0]], dtype=torch.long).tolist() as split_size argument.
  2. You can only apply the sampling for the "lower triangular part" of the edge indices via:
    mask = edge_index[0] < edge_index[1]
    edge_index = edge_index[mask]
    and convert the resulting graph to an undirected one (via to_undirected) after sampling is done.
  3. Yes, gradients can only flow through the edge weights of an edge, not the actual index. This should be fixable by passing edge_weight[mask] to the GNN layer as well (which is, e.g., supported for GraphConv).

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@GiuseppeSerra93
Comment options

@rusty1s
Comment options

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