Use ogbn-products when product relationships matter as much as product descriptions. This Open Graph Benchmark dataset represents Amazon products as nodes and co-purchases as edges: two products are connected when they were bought in the same transaction. It supports product-category prediction and experiments with embeddings that may reveal useful product bundles. section 3.5 section 3.1
The full graph has about 2.5 million product nodes and 61.9 million edges. Each node has 100 feature dimensions, and there are 47 category labels. Product-description features were created by converting descriptions with bag-of-words and reducing them with principal component analysis (PCA). section 7.1.1 section 5.2.1
For a smaller node-classification baseline:
- Load the graph with `PygNodePropPredDataset(name='ogbn-products', root=root)` and select the first 10,000 node indices. section 3.1.1
- Use `subgraph` to retain edges within the selection and relabel their node indices. Slice `data.x` and `data.y` with the same indices so features and labels stay aligned. section 3.1.1
- Train GCN and GraphSAGE models to predict product categories, then compare their predictions and training curves. Their learned embeddings can also be compared for potential bundles. section 3.1
Listing 3.1 Reading in data and creating a subgraph
dataset = PygNodePropPredDataset(name='ogbn-products',\ root=root) #1 data = dataset[0] #2 subset_indices = torch.arange(0, 10000) #3 subset_edge_index, edge_attr, edge_mask = \ subgraph(subset_indices, data.edge_index, \ None, relabel_nodes=True, num_nodes=\ data.num_nodes, return_edge_mask=True) #4 subset_features = data.x[subset_indices] #5 subset_labels = data.y[subset_indices] #6 subset_graph = data.__class__() #7 subset_graph.edge_index = subset_edge_index #8 subset_graph.x = subset_features #9 subset_graph.y = subset_labels #10
The loading example shows the dataset name and the index, edge, feature, and label operations needed to create a consistent PyTorch Geometric subgraph. section 3.1.1
Interpreting a co-purchase edge
A group of books bought together suggests an intuitive relationship; an instant meal bought with an iPod is harder to explain. An edge records a co-purchase, not a guarantee that the products form a useful bundle. section 3.5
Scale affects the experiment: storage size, in-memory representation, hardware capacity, and the training algorithm all matter. Taking the first 10,000 nodes makes a baseline manageable, but it is only one way to choose a subgraph; domain-guided selection or graph sampling may preserve more relevant relationships. Amazon Electronics is a separate co-purchase dataset used for link prediction, not another name for ogbn-products. section 3.1.1 section 7.1.1 section 5.2.1
