Я пытаюсь проанализировать большой график, но на нем написано «Ошибка памяти», какое решение для данных Azure мне следует использовать и как?
Я разместил следующий код при запуске на своем компьютере
import networkx as nx
class GraphFromTxt:
def __init__(self, text): # init from text file
self.GraphStan = []
file = open(text, "r")
for line in file:
self.GraphStan.append(line)
def print_list(self):
print(self.GraphStan)
def length(self):
print(self.GraphStan.__len__())
def print_edges(self, G):
print(G.edges())
def parse(self):
return nx.parse_edgelist(self.GraphStan, nodetype=int)
G_listed = GraphFromTxt("stan.txt")
G_listed.length()
G = G_listed.parse()
выход:
"C:\Users\Roy Greenberg\AppData\Local\Programs\Python\Python37-32\python.exe" "C:/Users/Roy Greenberg/PycharmProjects/Random-walks/Graph_from_txt.py"
7600595
Traceback (most recent call last):
File "C:/Users/Roy Greenberg/PycharmProjects/Random-walks/Graph_from_txt.py", line 26, in <module>
G = G_listed.parse()
File "C:/Users/Roy Greenberg/PycharmProjects/Random-walks/Graph_from_txt.py", line 21, in parse
return nx.parse_edgelist(self.GraphStan, nodetype=int)
File "C:\Users\Roy Greenberg\AppData\Local\Programs\Python\Python37-32\lib\site-packages\networkx\readwrite\edgelist.py", line 296, in parse_edgelist
G.add_edge(u, v, **edgedata)
File "C:\Users\Roy Greenberg\AppData\Local\Programs\Python\Python37-32\lib\site-packages\networkx\classes\graph.py", line 900, in add_edge
datadict = self._adj[u].get(v, self.edge_attr_dict_factory())
MemoryError
Process finished with exit code 1