graph LR
random_walk["random_walk"]
node2vec_walk["node2vec_walk"]
NodeWiseNeighborSampler["NodeWiseNeighborSampler"]
traverse["traverse"]
graphsage_sample["graphsage_sample"]
edge_hash["edge_hash"]
node2vec_walk -- "utilizes" --> random_walk
graphsage_sample -- "uses" --> edge_hash
The pgl.sampling subsystem is dedicated to providing various graph traversal and sampling mechanisms essential for graph neural networks. It encompasses algorithms for generating both unbiased (random_walk) and biased (node2vec_walk) random walks, with node2vec_walk leveraging the random_walk primitive. Additionally, it offers specialized neighbor sampling techniques for GraphSAGE-like models, including NodeWiseNeighborSampler which interfaces with PaddlePaddle's geometric operations, and graphsage_sample which utilizes the edge_hash utility for efficient edge management. The traverse utility provides general data structure iteration capabilities within the subsystem.
Implements the fundamental algorithm for generating unbiased random walks on a graph. This is a core primitive for many graph embedding and sampling techniques.
Related Classes/Methods:
Encapsulates the biased random walk strategy specific to the Node2Vec algorithm, allowing for flexible exploration between BFS-like and DFS-like traversals. It utilizes random_walk for the unbiased case.
Related Classes/Methods:
A central component for performing node-wise neighbor sampling, particularly crucial for GraphSAGE-like models, utilizing PaddlePaddle's geometric APIs for efficient neighbor sampling.
Related Classes/Methods:
A general utility function for recursively iterating through list or numpy array structures.
Related Classes/Methods:
Implements the specific neighbor sampling algorithm used in GraphSAGE, which involves sampling a fixed number of neighbors from each hop.
Related Classes/Methods:
A utility component responsible for efficient hashing of edges, primarily used during sampling operations to optimize lookup.
Related Classes/Methods: