I found that DropNode() transformation interface has been included in the 0.8.x dgl version, but I did not found any detailed practical examples in dgl coding base about how to use this interface in graph augmentation, even the example code: dgl/model.py at 195f99362d883f8b6d131b70a7868a537e55b786 · dmlc/dgl · GitHub here used the customized drop node function, I just want to know is there any examples of dgl.DropNode() like in GraphCL: GitHub - Shen-Lab/GraphCL: [NeurIPS 2020] "Graph Contrastive Learning with Augmentations" by Yuning You, Tianlong Chen, Yongduo Sui, Ting Chen, Zhangyang Wang, Yang Shen?
The doc page DropNode — DGL 0.8.2post1 documentation contains a usage example. The example you referred to only masks out features of some nodes while the DropNode
transform will actually remove the node (and its features) from a graph. I don’t think there is currently an example in DGL. cc @mufeili
Thank your for reply, More Question: Except the sample in the documentation, Is there any code in DGL used this DropNode interface?? I just want to see more examples in DGL about how to use this function, do you know any examples implemented in DGL used this interface? I cant find it so I am asking for more advice.
If DropNode isn’t used anywhere, what about other augmentations?
Maybe describe your question directly here? So we can see how to provide help.
I believe the issue is, current DropNode() implementation applies to graph class, dgl/module.py at 230b886ec55b9927bc806848e30c3a9b33bbcd6e · dmlc/dgl · GitHub
Though when we trying to implement a contrastive learning model, the data coming out of the DataLoader implementation is “block”, always Bipartite graph. The data format we are handling isn’t graph object.
What is the best way to apply DropNode() ( or any other transforms) to block from DataLoader? To do the conversion by ourselves seems non-trivial.
With some code tracing. Now I am guessing maybe the right way to use the augmentation API, is to first convert between blocks and graph, such as: g = dgl.block_to_graph(block) and dgl.create_block() ;
Does this make sense to use the augmentation API in this way? asking b/c I tested the convert API a bit, didn’t work. Not sure if I didn’t used the designed way.
Traceback (most recent call last):
File “views_fn.py”, line 48, in
g = dgl.block_to_graph(blocks)
File “/home/tiger/anaconda3/envs/lib/python3.7/site-packages/dgl/convert.py”, line 613, in block_to_graph
new_types = [ntype + ‘_src’ for ntype in block.srctypes] +
AttributeError: ‘list’ object has no attribute ‘srctypes’
Dropping nodes on block graphs does not seem to be a well-defined operation. For example, consider a message passing path 0->1 (block 0), 1->2 (block 1), 2->3 (block 2, 3 is the seed node). Dropping node 2 will break the message passing operation. Also, Block graph is more than just bipartite. It retains the destination nodes of layer l in the block graph of layer l-1, so that it can fetch self features. Dropping nodes will also break this property.
In general, I feel dropping nodes does not work really well with neighbor sampling. Perhaps you should look at subgraph sampling algorithms such as ClusterGCN, GraphSAINT, etc.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.