我正在使用python包networkx,并且有一个MultiDigraph,我想将它保存为graphml格式,以便在另一个软件中使用它,以便进行进一步的分析。我也有sone节点和边的属性。
我使用了bellow命令,但它不起作用。这个命令似乎不适用于MultiDigraph。
nx.write_graphml(G, 'C:\\hm\\HMGraph.gml')下面是我得到的错误:
nx.write_graphml(G, 'C:\\hm\\HMGraph.gml')
Traceback (most recent call last):
File "<ipython-input-5-e35c8921ea4a>", line 1, in <module>
nx.write_graphml(G, 'C:\\hm\\HMGraph.gml')
File "<decorator-gen-809>", line 2, in write_graphml_lxml
File "C:\Users\xparve\Anaconda3\lib\site-packages\networkx\utils\decorators.py", line 239, in _open_file
result = func_to_be_decorated(*new_args, **kwargs)
File "C:\Users\xparve\Anaconda3\lib\site-packages\networkx\readwrite\graphml.py", line 153, in write_graphml_lxml
writer = GraphMLWriterLxml(
File "C:\Users\xparve\Anaconda3\lib\site-packages\networkx\readwrite\graphml.py", line 664, in __init__
self.add_graph_element(graph)
File "C:\Users\xparve\Anaconda3\lib\site-packages\networkx\readwrite\graphml.py", line 714, in add_graph_element
T = self.xml_type[self.attr_type(k, "edge", v)]
KeyError: <class 'datetime.datetime'>有人能帮上忙吗?
发布于 2021-02-17 00:53:01
https://stackoverflow.com/questions/66168407
复制相似问题