0

How to solve this issue? It keeps giving me the error 'Graph' object has no attribute '_node'. Is this due to the networkX version issue?

import networkx as nx
import pandas as pd

G = nx.read_gpickle('major_us_cities')
G.nodes(data=True)

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-af9b96288895> in <module>
----> 1 G.nodes(data=True)

/usr/local/anaconda3/lib/python3.8/site-packages/networkx/classes/graph.py in nodes(self)
    752 
    753         """
--> 754         nodes = NodeView(self)
    755         # Lazy View creation: overload the (class) property on the instance
    756         # Then future G.nodes use the existing View

/usr/local/anaconda3/lib/python3.8/site-packages/networkx/classes/reportviews.py in __init__(self, graph)
    166 
    167     def __init__(self, graph):
--> 168         self._nodes = graph._node
    169 
    170     # Mapping methods

AttributeError: 'Graph' object has no attribute '_node'
Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
nerd_gram
  • 53
  • 8
  • Potentially the same as this: https://stackoverflow.com/q/47694773/1968 – Konrad Rudolph Sep 06 '21 at 09:35
  • 1
    It is, but I (humbly) suggest this is a better place to find the solution: https://stackoverflow.com/questions/49016596/networkx-digraph-attribute-error-self-succ – Joel Sep 06 '21 at 09:57

0 Answers0