Graph-and-Social-Network-Analytics icon indicating copy to clipboard operation
Graph-and-Social-Network-Analytics copied to clipboard

problem with reading .pkl file

Open SriSatyaLokesh opened this issue 6 years ago • 0 comments

sc = nx.read_gpickle('Datasets/Synthetic Social Network.pkl')

plt.figure(figsize=(10,7))

nx.draw_networkx(sc,node_color='c',node_size=900,with_labels=True)

got this error
AttributeError Traceback (most recent call last) in 3 plt.figure(figsize=(10,7)) 4 ----> 5 nx.draw_networkx(sc,node_color='c',node_size=900,with_labels=True)

~/.local/lib/python3.6/site-packages/networkx/drawing/nx_pylab.py in draw_networkx(G, pos, arrows, with_labels, **kwds) 273 274 if pos is None: --> 275 pos = nx.drawing.spring_layout(G) # default to spring layout 276 277 node_collection = draw_networkx_nodes(G, pos, **kwds)

</home/satya/.local/lib/python3.6/site-packages/decorator.py:decorator-gen-782> in fruchterman_reingold_layout(G, k, pos, fixed, iterations, threshold, weight, scale, center, dim, seed)

~/.local/lib/python3.6/site-packages/networkx/utils/decorators.py in _random_state(func, *args, **kwargs) 403 new_args = list(args) 404 new_args[random_state_index] = random_state --> 405 return func(*new_args, **kwargs) 406 return _random_state 407

~/.local/lib/python3.6/site-packages/networkx/drawing/layout.py in fruchterman_reingold_layout(G, k, pos, fixed, iterations, threshold, weight, scale, center, dim, seed) 441 pos_arr = None 442 --> 443 if len(G) == 0: 444 return {} 445 if len(G) == 1:

~/.local/lib/python3.6/site-packages/networkx/classes/graph.py in len(self) 430 431 """ --> 432 return len(self._node) 433 434 def getitem(self, n):

AttributeError: 'Graph' object has no attribute '_node'

##why?
and
##how to solve?

SriSatyaLokesh avatar Feb 08 '19 15:02 SriSatyaLokesh