Getting Dataset does not have a key 'nodes'
jonimatix opened this issue · 3 comments
Hello,
I have build a graph network using networkx and it works well as follows:
G = nx.from_pandas_edgelist(results.head(100), 'source', 'target', edge_attr=True, create_using = nx.MultiDiGraph)
G.nodes
nx.draw(G, with_labels=True, pos = nx.spring_layout(G), alpha = 0.8)
When i then call visualize(G)
, i get Dataset does not have a key 'nodes'
.
Can you help on this please?
Thanks
Can you post the output you obtain when you call G.nodes
? Also, which version of networkx
do you use? You can find out by calling
import networkx as nx
print(nx.__version__)
okay, I've now remembered that the problem is that we only allow nx.Graph
and nx.DiGraph
as visualizable network types. If you convert your network to nx.DiGraph
, it should work. Is there any particular reason you need nx.MultiDiGraph
?
In any way we haven't really caught that error in a proper manner yet so thank you for raising this issue. I'll fix it soon.
Also, I don't remember why we don't allow nx.MultiDiGraph
. @ulfaslak , do you? I've just removed the restriction to allow for nx.MultiDiGraph
and it worked fine. Is it possible that we wanted to forbid self-loops explicitly? I'm referring to this line: https://github.com/benmaier/netwulf/blob/master/netwulf/interactive.py#L272
anyway, it seems to currently work now, so I'm closing this issue