我正在使用NetworkX庫用於我的任務的路徑查找問題。我當然只需要找到簡單的路徑。下面是我使用的示例代碼:NetworkX all_simple_paths給出內存錯誤
paths = list(nx.all_simple_paths(G, startnode, endnode))
這裏是一個控制檯顯示錯誤:我想這是因爲你的圖是太大
Traceback (most recent call last):
File "run_duc.py", line 130, in <module>
main()
File "run_duc.py", line 78, in main
m1.main()
File "C:\Users\User\Desktop\all_model_run_script\abstractive_ilp\main.py", line 119, in main
paths = mygraph.generate_graph(mytext, mystartnode, myendnode, financial_corpus)
File "C:\Users\User\Desktop\all_model_run_script\abstractive_ilp\graph_node.py", line 241, in generate_graph
paths = self.find_paths(G, self.START, self.END, financial_corpus)
File "C:\Users\User\Desktop\all_model_run_script\abstractive_ilp\graph_node.py", line 153, in find_paths
paths = list(nx.all_simple_paths(G, startnode, endnode))
MemoryError
How * big *是你的圖表嗎? – Sait
它給出錯誤的情況下包含1804個節點 – Barbarian