Way to recursively 'split' graphs into subgraphs?

I have a BatchedDGLGraph, each graph with a set of nodes which, after some operations, I classify as 0 / 1. Is there a way to group all ‘0’, ‘1’ nodes and then split them into their own graphs? So that after each iteration, the batch size doubles (though the number of nodes remains constant).

Thanks!

Hi,

To group nodes, you can take a look on filter_nodes API. I’m not sure what you mean split them into their own graphs, could you explain more?

Thank you, I should be able to cover some ground with filter_nodes, though perhaps there’s an efficient way to do this. More info:

I have a set of nodes:
{ {a1, a2, a3}, {b1, b2, b3, b4} }

I somehow assign a binary label to each node as follows:
{ {0, 1, 0}, {1, 0, 0, 1} }

Now I’d like to “split” these batched graphs, grouped by the binary label, so that I now have twice as many graphs. So the above scenario will output:
{ {a1, a3}, {a2}, {b2, b3}, {b1, b4} }

Essentially part of a divide and conquer strategy for clustering.

It seems not a widely used operation and I don’t think we have any API could do this. You may need to do this manually.

Ok, thanks for your reply

It seems that you might need this node subgraph API. Check it out.