Converting NodeFlow to a flat DGLGraph

Hello,

Awesome library, thank you for the good work!

I have a question about working with the Sampler. In particular, it doesn’t seem obvious how I can get a flat graph from NodeFlow. I’m looking to create a subgraph from a set of vertices, and then feed that subgraph into a GCN or the likes. I think the way to do that is to use the neighborhood sampler, but it returns a NodeFlow, and it’s not clear in the documentation how I can get a regular DGLGraph from it.

Thanks!

Thank you for your question. You can’t convert a NodeFlow to a DGLGraph directly because NodeFlow represents data/computation dependency and there is a notion of layers/blocks in NodeFlow. That being said, I think it’s possible to extend the current NodeFlow API that construct a DGLGraph from a block of edges (the edges between two consecutive layers). A block of edges forms a bipartite graph (nodes in a layer only connect with the nodes in the other layer). Currently, DGLGraph doesn’t support a bipartite graph. If you want to do it now, you might need to hack a little bit. A good news is that we’ll support bipartite graphs very soon, by the end of August. Once DGL supports bipartite graphs, you can get a block of edges with block_adjacency_matrix and construct a DGLGraph with the edges.