'What is the difference edge_weight and edge_attr in Pytorch Geometric
I want to handle weighted undirected graphs in Pytorch Geometric.
The node features are 50 dimensional. I found that this can be handled by the x attribute of the torch_geometric.data.data class.
The weights of the edges are scalar values.
We found out that edge_attr and edge_weight are the attributes to handle edges.
I think I should probably use edge_weight, is this correct?
Also, what is the difference between edge_attr and edge_weight?
I'm not very good at English, so I apologize for that. I hope I can get a good answer.
Thank you.
Solution 1:[1]
The difference between edge_weight and edge_attr is that edge_weight is always one-dimensional (one value per edge) and that edge_attribute can be multi-dimensional. You can check the cheatsheet for the support of the models.
Solution 2:[2]
The difference between edge_weight and edge_attr is that edge_weight is the non-binary representation of the edge connecting two nodes, without edge_weight the edge connecting two nodes either exists or it doesn't(0 or 1) but with the weight the edge connecting the nodes can have arbitrary value.
Whereas edge_attr means the features of the edge connecting any two nodes. These feature can be multidimensional.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sparky05 |
| Solution 2 | 22_prajwol poudel |
