TypeError: unhashable type: 'slice'
srbdev opened this issue · 2 comments
srbdev commented
In the notebook 2-networkx-basics-instructor.ipynb
, the first code cell after the Basic Network Statistics section
# Who are represented in the network?
G.nodes()[0:5]
returns the following error on my Macbook:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-22-3fb6155cc2e4> in <module>()
1 # Who are represented in the network?
----> 2 G.nodes()[0:5]
~/playspace/pycon2018/Network-Analysis-Made-Simple/network/lib/python3.6/site-packages/networkx/classes/reportviews.py in __getitem__(self, n)
176
177 def __getitem__(self, n):
--> 178 return self._nodes[n]
179
180 # Set methods
TypeError: unhashable type: 'slice'
I can fix the issue with
list(G.nodes())[0:5]
Let me know if this is an actual issue or just something not setup correctly on my end. Thanks!
ericmjl commented
@srbdev thanks for picking that out! Yes, with the new NetworkX API, G.nodes()
and G.edges()
now return views into the node and edge lists respectively.
A fix will be coming soon 😄.
ericmjl commented
Bug has been fixed in Notebook 2.