Reputation: 21
I'm using dgl library since it was easy to understand.. But I need several modules in torch_geometric, but they don't support dgl graph.
Is there any way to change dgl graph to torch_geometric graph? My datasets are built in dgl graph, and I'm gonna change them into torch_geometric graph when I load the dataset.
Upvotes: 1
Views: 2756
Reputation: 4892
With a homogenous networkx
graph as intermediate step, you could use the following methods:
dgl.to_homogenous
to create a homogenous dgl
graph instancedgl.to_networkx
to export the homogenous graph to a networkx
graphtorch_geometric.utils.from_networkx
to read the homogenous networkx
graph into pytorch geometric
torch_geometric.data.to_heterogenous
to transform the homogenous graph into a heterogenous graphAs far as I saw neither of the packages has separate reader/writer for the heterogenous graphs. Hence, these extra steps are needed. Another alternative is the manual export of the tensor and the direct creation of the heterogenous pytorch geometric
graph.
Upvotes: 0