Graph with 2d node feature


I have a graph with N nodes, and the feature dimension of each node is 2d (let’s say pxq), so in total, the node feature dimension is N x p x q. Even though there are multiple dimensions in the node feature, I think it still belongs to a homogeneous graph (an instance of dgl.DGLGraph()).
so I create a blank instance and import feature from networkx:

g = dgl.DGLGraph()
g.ndata['feat] = node_feat #N x p x q

But after I create the graph, it automatically converts into a heterogeneous graph (dgl.heterograph()).

print(type(g)) # <class 'dgl.heterograph.DGLHeteroGraph'>

I’m wondering why that happened. Thank you.

DGL also represents a homogeneous graph with a heterogeneous graph with one node/edge type. So you should be good (you can check g.ntypes and g.etypes to verify this).

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.