-
I need to convert a graph to its corresponding line-graph so I use the LineGraph function in torch_geometric.transforms. I found that this function cannot convert the node features of the original graph into the edge features of the Line Graph, but directly discards the original node features. This troubles me a lot. I don't know how to solve this problem. How can I solve this problem? How about transforming the original node feature into the edge feature of LineGraph? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 11 replies
-
I think you should be able to have node features if you convert them to edge features before transforming the graph via data = ...
src, dst = data.edge_index
data.edge_attr = torch.cat([data.x[src], data.x[dst]], dim=-1)
data = LineGraph()(data) |
Beta Was this translation helpful? Give feedback.
I think you should be able to have node features if you convert them to edge features before transforming the graph via
LineGraph
, .e.g: