v0.4.3
We are thrilled to announce DGL v0.4.3, which provides many new features that enhance usability and efficiency.
Major Features and Improvements
- TensorFlow backend is now an official feature. Add an environment variable
USE_OFFICIAL_TFDLPACKfor switching to the official TensorFlow DLPack support from tensorflow/tensorflow#36862. - New graph sampling APIs compatible with
DGLHeteroGraph:- Redesigned
dgl.random_walkwith the support of metapaths. - A new API
dgl.random_walk_with_restartfor random walk with restart probability. - A new API
dgl.sample_neighborsfor sampling among neighbors with or without replacement. - A new API
dgl.sample_neighbors_topkfor picking K neighbors with the largest weight. - A new API
dgl.in_subgraphfor extracting all the neighbors connected by the in-edges. - A new API
dgl.out_subgraphfor extracting all the neighbors connected by the out-edges.
- Redesigned
- Accompany utilities for graph sampling:
- A new API
dgl.create_from_pathsfor creating a graph from sampled random walk traces. - A new API
dgl.compact_graphsfor converting a sampled subgraph to a smaller graph with no isolated nodes. - A new API
dgl.to_blockfor converting a sampled subgraph to a bipartite graph suitable for computation. - Reworked
dgl.to_simple_graphto support heterogeneous graph. - Reworked
dgl.remove_edgesto support heterogeneous graph.
- A new API
- When constructing a
DGLHeteroGraphto be unidirectional bipartite — there are two node types and one edge type, where all edges are from one node type to another, the following APIs are enabled:- A new API
DGLHeteroGraph.is_unibipartite - New APIs
DGLHeteroGraph.num_src_nodesandDGLHeteroGraph.num_dst_nodes - New APIs
DGLHeteroGraph.srcnodesandDGLHeteroGraph.dstnodesfor getting a view of source and destination nodes, respectively. - New APIs
DGLHeteroGraph.srcdataandDGLHeteroGraph.dstdatafor getting the data of source and destination nodes, respectively.
- A new API
- NN module changes:
- Users can now directly use
dgl.nn.SomeModuleinstead ofdgl.nn.<backend>.SomeModule. - Extend
dgl.nn.GraphConvto support asymmetric normalizer. It now also accepts an external weight matrix instead of creating its own. - Extend all the NN modules to support bipartite graph inputs which enable them for sampling-based GNN training. The input node feature argument now can be a pair of tensors.
- A new wrapper module
dgl.nn.HeteroGraphConvfor leveraging DGL NN modules on heterogeneous graphs.
- Users can now directly use
- Model examples using the new sampling APIs
- Train the GraphSAGE model by neighbor sampling and scale it to multiple GPUs (link).
- Train the Relational GCN model on heterogeneous graphs by sampling for both node classification and link prediction (link).
- Train the PinSAGE model by random walk sampling for item recommendation (link).
- Train the GCMC model by sampling for MovieLens rating prediction (link).
- Implement the variance reduction technique for neighbor sampling (link) proposed by Chen et al.
- DGL-KE
- Move to a standalone repository under awslab: https://github.com/awslabs/dgl-ke
- See the release note for more details.
- DGL-LifeSci
- Spun off into a standalone package.
- See the project page for more details.
- A new example for scene graph extraction: https://github.com/dmlc/dgl/tree/master/examples/mxnet/scenegraph
- A new API
dgl.metis_partitionfor partitioning a DGLGraph by the Metis algorithm. - New APIs
dgl.as_immutable_graphanddgl.as_heterographfor casting betweenDGLGraphandDGLHeteroGraphefficiently. - A new API
dgl.rand_graphfor constructing a random graph with specified number of nodes and edges. - A new API
dgl.random.choicefor more efficient non-uniform random choice. - Replaced
DGLHeteroGraph.__setitem__andDGLHeteroGraph.__getitem__with a more efficient implementation. dgl.data.save_graphsanddgl.data.load_graphsnow support heterogeneous graphs.- UDFs now have the access to node types and edge types.
API Breaking Changes
- The type of the norm argument in
dgl.nn.GraphConvis changed from bool to string, with"none"indicating no normalization,"both"indicating the original symmetric normalizer proposed by GCN and"right"indicating normalizing by degrees. DGLSubGraphandBatchedDGLGraphclasses are removed and merged toDGLGraph. All their methods are ported toDGLGraphtoo, so typical usages will not be affected by this change.- The multigraph flag in
dgl.DGLGraphis deprecated and will be removed in the future. - Rename the card argument in
dgl.graphanddgl.bipartitetonum_nodes.
Bug Fixes and Others
- Fix a bug in
remove_edgeswhen the graph has no edge. - Fix a bug in creating
DGLGraphfrom scipy coo matrix that has duplicate entries. - Improve the speed of sorting a COO format graph.
- Improve the speed of
dgl.to_bidirected. - Fix a bug in building DGL on MacOS using clang.
- Fix a bug in
NodeFlowwhenapply_edgesis called. - Fix a bug in the stack cross-type reducer in
DGLHeteroGraph.multi_update_all,DGLHeteroGraph.multi_pullandDGLHeteroGraph.multi_recvto make the stacking order consistent and to remove a redundant dimension. - Fix a bug in the loss function of the RGCN example.
- Fix a bug in the MXNet backend when using the new Deep NumPy feature.
- Fix a memory leak bug in the PyTorch backend when retain_graph is True.