I wanted to implement some graph deep learning algorithm and I was confused about which one should I use? DGL or Pytorch Geometric? I specifically want to make it easier to load data and sampling from the graph. Is this library lower level compared to DGL or is it a higher-level and easier?
The short answer is that you may want to try out both and see which one do you prefer. It's hard for me to give an unbiased opinion on that. Both libraries provide similar features, and it basically comes down to user preferences. In terms of performance, they are also similar (some GNNs are a bit faster on PyG and some are a bit slower). However, DGL has a better memory management for GNNs that can be expressed as a sparse matrix multiplication, but PyG will soon catch up.
I personally feel that DGL is designed as a low-level graph library, but most of its core is hidden behind a C++ API and hard to modify. Most of its high-level support is outsourced to its examples. PyG provides both low-level (in the form of utility functions, message passing interfaces, sampling interfaces, and GNN implementations) and high-level APIs (in the form of models).
DGL has great sampling support. PyG recently also added better support for sampling via NeighborSampler, GraphSAINT and ClusterGCN.
In terms of data handling, it boils down to the question whether you like networkx or not. DGL has a similar graph interface to networkx, where as PyG provides all data as pure PyTorch tensors.
This is a very good and unbiased opinion I think. After working with both of them for almost two weeks I think PyG is better suited for me because it is more high-level and pythonic compared to DGL. I am very excited to see more features will be added to this great library!
Most helpful comment
The short answer is that you may want to try out both and see which one do you prefer. It's hard for me to give an unbiased opinion on that. Both libraries provide similar features, and it basically comes down to user preferences. In terms of performance, they are also similar (some GNNs are a bit faster on PyG and some are a bit slower). However, DGL has a better memory management for GNNs that can be expressed as a sparse matrix multiplication, but PyG will soon catch up.
I personally feel that DGL is designed as a low-level graph library, but most of its core is hidden behind a C++ API and hard to modify. Most of its high-level support is outsourced to its examples. PyG provides both low-level (in the form of utility functions, message passing interfaces, sampling interfaces, and GNN implementations) and high-level APIs (in the form of models).
DGL has great sampling support. PyG recently also added better support for sampling via
NeighborSampler,GraphSAINTandClusterGCN.In terms of data handling, it boils down to the question whether you like
networkxor not. DGL has a similar graph interface tonetworkx, where as PyG provides all data as pure PyTorch tensors.