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_TFDLPACK
for switching to the official TensorFlow DLPack support from tensorflow/tensorflow#36862. - New graph sampling APIs compatible with
DGLHeteroGraph
:- Redesigned
dgl.random_walk
with the support of metapaths. - A new API
dgl.random_walk_with_restart
for random walk with restart probability. - A new API
dgl.sample_neighbors
for sampling among neighbors with or without replacement. - A new API
dgl.sample_neighbors_topk
for picking K neighbors with the largest weight. - A new API
dgl.in_subgraph
for extracting all the neighbors connected by the in-edges. - A new API
dgl.out_subgraph
for extracting all the neighbors connected by the out-edges.
- Redesigned
- Accompany utilities for graph sampling:
- A new API
dgl.create_from_paths
for creating a graph from sampled random walk traces. - A new API
dgl.compact_graphs
for converting a sampled subgraph to a smaller graph with no isolated nodes. - A new API
dgl.to_block
for converting a sampled subgraph to a bipartite graph suitable for computation. - Reworked
dgl.to_simple_graph
to support heterogeneous graph. - Reworked
dgl.remove_edges
to support heterogeneous graph.
- A new API
- When constructing a
DGLHeteroGraph
to 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_nodes
andDGLHeteroGraph.num_dst_nodes
- New APIs
DGLHeteroGraph.srcnodes
andDGLHeteroGraph.dstnodes
for getting a view of source and destination nodes, respectively. - New APIs
DGLHeteroGraph.srcdata
andDGLHeteroGraph.dstdata
for getting the data of source and destination nodes, respectively.
- A new API
- NN module changes:
- Users can now directly use
dgl.nn.SomeModule
instead ofdgl.nn.<backend>.SomeModule
. - Extend
dgl.nn.GraphConv
to 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.HeteroGraphConv
for 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_partition
for partitioning a DGLGraph by the Metis algorithm. - New APIs
dgl.as_immutable_graph
anddgl.as_heterograph
for casting betweenDGLGraph
andDGLHeteroGraph
efficiently. - A new API
dgl.rand_graph
for constructing a random graph with specified number of nodes and edges. - A new API
dgl.random.choice
for more efficient non-uniform random choice. - Replaced
DGLHeteroGraph.__setitem__
andDGLHeteroGraph.__getitem__
with a more efficient implementation. dgl.data.save_graphs
anddgl.data.load_graphs
now 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.GraphConv
is 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. DGLSubGraph
andBatchedDGLGraph
classes are removed and merged toDGLGraph
. All their methods are ported toDGLGraph
too, so typical usages will not be affected by this change.- The multigraph flag in
dgl.DGLGraph
is deprecated and will be removed in the future. - Rename the card argument in
dgl.graph
anddgl.bipartite
tonum_nodes
.
Bug Fixes and Others
- Fix a bug in
remove_edges
when the graph has no edge. - Fix a bug in creating
DGLGraph
from 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
NodeFlow
whenapply_edges
is called. - Fix a bug in the stack cross-type reducer in
DGLHeteroGraph.multi_update_all
,DGLHeteroGraph.multi_pull
andDGLHeteroGraph.multi_recv
to 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.