I found out that we can obtain line graph representation of a node graph using torch_geometric.transforms import LineGraph.
I have the following requirement where I want to access both original dataset’s nodes, adjacency matrix as well as it’s line graph’s nodes and adjacency matrix:
dataset = TUDataset(path, name=MUTAG)
dataloader = DataLoader(dataset_line, batch_size=batch_size)
for data, data_linegraph in dataloader:
loss = model(data.x, data.edge_index, data_linegraph.x, data_linegraph.edge_index)
Where should I use torch_geometric.transforms.LineGraph() to transform the original graph data object in order to make my dataloader output both representations?