Adjacency matrix of batched graph

If I have a batched weighted graph and I run some operations on the edges (potentially removing some edges), what’s the best way to get the new batched graph with modified weights? One way I’m thinking is to unbatch, take the adjacency matrix of each graph, convert them into scipy graphs, create dgl graphs from them and finally batch them again. This sounds doable but a bit convoluted, potentially slowing things down. Is there a better approach?

Never mind, this method didn’t work for me. I needed the edge weight to carry gradients with them, but I have to detach() to convert the adjacency matrix to scipy/networkx graph. Is there another way around this?

Could you try the adj() method? It returns a PyTorch sparse tensor (which can be converted to a dense tensor).

The adjacency matrix of a batched graph would be something like a block-sparse matrix. Is that what you want?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.