Graphs Management #461
Replies: 3 comments 8 replies
-
Great idea! It simplifies a lot the logic and allow use to define more flexible graph object. Actually, I have an idea in mind of the possible behavior of the new class.
Multi graph creation with the same structure
If you are agree with the logic proposed by @gc031298 we can introduce it before merging #459 |
Beta Was this translation helpful? Give feedback.
-
I think a possible solution would be to simply use Data classes from pyG (a wrapper on it is fine). For radius and knn graph we simply check: if user passes the edge_index we throw an error, otherwise we build internally the graph using pos. For the conditions I would avoid GraphCondition, since we risk to not use many solvers! I would add in Condition the possibility to pass input_graph and output_graph an iterable of Data or a single Data. Then we can mix (input_points/output_graph, ...) this allows to use freely the solvers. |
Beta Was this translation helpful? Give feedback.
-
I think this discussion can be closed, as graphs where implemented in #403 and simplified using the graph condition in #459 #471 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to bring up the current approach to graph management in PINA, as I believe it is somewhat complex and could be improved.
Currently, with PINA's
Graph
, we create an object that internally manages a list of graphs. While this works well, it can make it harder for users to inspect and freely customize individual graphs. Additionally, this approach requires several internal checks for dimensions and consistency. Finally, since PINA'sGraph
is later transformed into a pygBatch
object, the way data is handled becomes less transparent.Instead of managing multiple graphs within a single object, I propose handling graphs separately. Specifically, we could create a wrapper class around pyg's
torch_geometric.data.Data
to manage single graphs. This would allow users to either:Graph
, ortorch_geometric.data.Data
object, which would then be converted into a PINAGraph
.If multiple graphs are needed, users can instantiate several instances accordingly.
For conditions, we could introduce a
GraphCondition
class that takes only the input (since the output, if any, is typically stored as a graph attribute, e.g., graph.y). This input could be either a single graph or a list of graphs. If it’s a list, the graphs are grouped into aBatch
object, as it is currently done.This change could bring several advantages:
Notice that while the current logic is somewhat preserved, we would only require fewer checks.
I'm curious to hear your thoughts on this approach. Would this make working with graphs in PINA more intuitive?
Beta Was this translation helpful? Give feedback.
All reactions