nodes = pd.read_csv(’./nodes.csv’)
node_feat = th.tensor(nodes[[‘this is feature name list’]].to_numpy(), dtype=th.float32)
node_label = th.tensor(nodes[[‘label’]].to_numpy(), dtype=th.float32)
edges = pd.read_csv(’./edges.csv’)
src = th.tensor(edges[‘src’].to_numpy(), dtype=th.int32)
dst = th.tensor(edges[‘dst’].to_numpy(), dtype=th.int32)
weight = th.tensor(edges[‘weight’].to_numpy(), dtype=th.float32)
g = dgl.graph((src, dst))
g.ndata[‘x’] = node_feat
g.ndata[‘y’] = node_label
g.edata[‘w’] = weight
I tried creating a homogeneous DGLGraph from code above, but print(type(g))
got <class ‘dgl.heterograph.DGLHeteroGraph’>. Is this common?
nodes.csv format: feat1, feat2, …, featN, label
edges.csv format: src, dst, weight
dgl version: dgl-cuda11.3 0.8.1