pyg-team / pytorch_geometric

Graph Neural Network Library for PyTorch
https://pyg.org
MIT License
21.2k stars 3.64k forks source link

Tree Data Structure in PyTorch Geometric #1422

Open reshinthadithyan opened 4 years ago

reshinthadithyan commented 4 years ago

❓ Questions & Help

Is there a sub-branch which specifically deals with Tree related modelling using PyTorch Geometric? There is one problem in using the existing representation in Graphs for Tree. Say In a Graph World,

A, B B, C A, D B, D
B in the edge-index denotes the same node. Since all nodes in a graph are unique.

Rather in a Tree World, same node can be present in two different branches. Say in an AST, the nodes are labelled same but, can be two different entities when occuring in a Tree.

binop

Was wondering, if there's an existing way to solve this using PyTorch Geometric. If not, should we build it since Trees are equally important,common Structured Data.

My thought Can relabelling BinOp into Two labels (BinOp1[1] and BinOp2[0]) and having same feature vectors solve it?

rusty1s commented 4 years ago

Hey, and thank you for this interesting question. As far as I understand, you want to represent BinOp as a single node which appears multiple times in your tree? I don't think there is a particular reason to enforce that nodes are shared as long as their feature vectors are the same (like same identifier for this operation). Do I understand you correctly?

If you have any thoughts on how to improve PyG for tree representations, please let me know.