Can NodeFlow support conv layer class?

DGL provides some very useful APIs to build well known conv layers as described in Conv Layers.

Is there a plan to support NodeFlow with those APIs?

One problem with NodeFlow is that it’s difficult to get the updated self activations for each layer. I mean the h(k, u) when computing h(k+1, u) = W ( aggr(h(k,v)) , h(k,u)). This is because each node in the NodeFlow layer is a separate copy of the original node, therefore h(k,u) is not updated if they are not in the previous layer. I tried to use the -add_self_loop option in the NeighborhoodSampler, but then I have to distinguish the self loop edge from other edges. Please correct me if I am wrong.

Mark

I’m ccing @BarclayII and @zhengda1936 who might know better about the plan for NodeFlow.

You can update the self activations as follows:

"""
Assume nf is a node flow sampled and say we want to copy the features from 
the l-th layer to the (l+1)-th layer.
"""
# The indices of nodes in the (l+1)-th layer in the nodeflow
dst_indices_in_nodeflow = nf.layer_nid(l+1)
dst_indices_in_parent = nf.map_to_parent_nid(dst_indices_in_nodeflow)
src_indices_in_nodeflow = nf.map_from_parent_nid(l, dst_indices_in_parent)
src_indices_in_src_layer = src_indices_in_nodeflow - nf._layer_offsets[l]
# Assume h of shape (N, M) is the node features of the l-th layer
nf.layers[l+1].data['h'] = h[src_indices_in_src_layer, :]

hi Mufeili,
Thanks for your replay. The question is not all the nodes in (l+1)-th layer actually exist in l-th layer, right? If I force a self_loop in neighborhood sampling, I also would have to create an extra edge from (l+1) to (l) layer that is not desirable.

Mark

You are right about that.

Another possibility is to perform first nf.copy_to_parent and then nf.copy_from_parent. Unfortunately this will overwrite the features in the original graph, and might be troublesome for future nodeflows…

I guess currently have self loops added and handle them separately is the only feasible workaround.

problem is that h(l,i) on l-th layer is not even computed if node i is not in l-th layer, so copy_to_parent won’t work either. I think the solution is to make NeighborSampler optionally sample all the nodes of (l+1)-th layer on l-th layer without adding self loop edge.

I asked the DGL team the same question a couple days ago and the answer is yes. They told me that Conv layer class would support biparitite graph soon and a block in nodeflow is aslo a biparitite graph.