dgl
dgl copied to clipboard
[GraphBolt] ItemSetDict should inherit from Dict/Mapping
🔨Work Item
IMPORTANT:
- This template is only for dev team to track project progress. For feature request or bug report, please use the corresponding issue templates.
- DO NOT create a new work item if the purpose is to fix an existing issue or feature request. We will directly use the issue in the project tracker.
Project tracker: https://github.com/orgs/dmlc/projects/2
Description
For now, ItemSetDict
is like a dictionary but not a real one as dict-like operations such as pop()
, keys()
are not supported. But these methods are very helpful for beginner to check what data are stored in ItemSetDict
.
One solution is make ItemSetDict
inherit from Mapping
which offers dict-like methods in nature. And for the special case: iterating over data instead of keys in GraphBolt's DataLoader, we could just offer a dedicated iterator for it. Then ItemSetDict
supports iterating over keys(which is like dict) and iterating over data(nodes/edges dimensions for ItemSampler
in GraphBolt) simultaneously.