Paddle Graph Learning (PGL)¶
Paddle Graph Learning (PGL) is an efficient and flexible graph learning framework based on PaddlePaddle.
The newly released PGL supports heterogeneous graph learning on both walk based paradigm and messagepassing based paradigm by providing MetaPath sampling and Message Passing mechanism on heterogeneous graph. Furthermor, The newly released PGL also support distributed graph storage and some distributed training algorithms, such as distributed deep walk and distributed graphsage. Combined with the PaddlePaddle deep learning framework, we are able to support both graph representation learning models and graph neural networks, and thus our framework has a wide range of graphbased applications.
One of the most important benefits of graph neural networks compared to other models is the ability to use nodetonode connectivity information, but coding the communication between nodes is very cumbersome. At PGL we adopt Message Passing Paradigm similar to DGL to help to build a customize graph neural network easily. Users only need to write send
and recv
functions to easily implement a simple GCN. As shown in the following figure, for the first step the send function is defined on the edges of the graph, and the user can customize the send function \(\phi^e\) to send the message from the source to the target node. For the second step, the recv function \(\phi^v\) is responsible for aggregating \(\oplus\) messages together from different sources.
To write a sum aggregator, users only need to write the following codes.
import pgl
import paddle
import numpy as np
num_nodes = 5
edges = [(0, 1), (1, 2), (3, 4)]
feature = np.random.randn(5, 100).astype(np.float32)
g = pgl.Graph(num_nodes=num_nodes,
edges=edges,
node_feat={
"h": feature
})
g.tensor()
def send_func(src_feat, dst_feat, edge_feat):
return src_feat
def recv_func(msg):
return msg.reduce_sum(msg["h"])
msg = g.send(send_func, src_feat=g.node_feat)
ret = g.recv(recv_func, msg)
Highlight: Flexibility  Natively Support Heterogeneous Graph Learning¶
Graph can conveniently represent the relation between things in the real world, but the categories of things and the relation between things are various. Therefore, in the heterogeneous graph, we need to distinguish the node types and edge types in the graph network. PGL models heterogeneous graphs that contain multiple node types and multiple edge types, and can describe complex connections between different types.
Support meta path walk sampling on heterogeneous graph¶
Support Message Passing mechanism on heterogeneous graph¶
LargeScale: Support distributed graph storage and distributed training algorithms¶
In most cases of largescale graph learning, we need distributed graph storage and distributed training support. As shown in the following figure, PGL provided a general solution of largescale training, we adopted PaddleFleet as our distributed parameter servers, which supports large scale distributed embeddings and a lightweighted distributed storage engine so tcan easily set up a large scale distributed training algorithm with MPI clusters.
Model Zoo¶
The following graph learning models have been implemented in the framework. You can find more examples and the details here.
Model 
feature 

ERNIE SAmple aggreGatE for Text and Graph 

Graph Convolutional Neural Networks 

Graph Attention Network 

Largescale graph convolution network based on neighborhood sampling 

Unsupervised GraphSAGE 

Representation learning based on firstorder and secondorder neighbors 

Representation learning by DFS random walk 

Representation learning based on metapath 

The representation learning Combined with DFS and BFS 

Representation learning based on structural similarity 

Simplified graph convolution neural network 

The graph represents learning method with node features 

Unsupervised representation learning based on graph convolution network 

Representation Learning of Heterogeneous Graph based on MessagePassing 
The above models consists of three parts, namely, graph representation learning, graph neural network and heterogeneous graph learning, which are also divided into graph representation learning and graph neural network.
System requirements¶
PGL requires:
paddle >= 2.0.0
cython
PGL only supports Python 3
Installation¶
You can simply install it via pip.
pip install pgl
The Team¶
PGL is developed and maintained by NLP and Paddle Teams at Baidu
Email: nlpgnn[at]baidu.com
License¶
PGL uses Apache License 2.0.
Quick Start¶
The Team¶
PGL is developed and maintained by NLP and Paddle Teams at Baidu
License¶
PGL uses Apache License 2.0.