What is the correct way to copy node attributes from a networkx
graph? I’m trying this:
import networkx as nx
from networkx.readwrite import json_graph
from dgl import DGLGraph
g = nx.Graph(id='graph')
g.add_node('A', A='xxx')
g.add_node('B', A='yyy')
g.add_edge('A', 'B')
x = DGLGraph()
x.from_networkx(g, node_attrs=['A'])
But it returns:
ValueError: too many dimensions ‘str’
According to the docs it should be possible: https://docs.dgl.ai/en/0.4.x/generated/dgl.DGLGraph.from_networkx.html?highlight=from_networkx
Thank you