Not an error, but just notice that reported Python code does not always follow common naming conventions on variables: Python's variable are expected to start with small case characters, and names are exptected to be not too general.
Using one capital letter to name a variable is generally considered too naive, as reported in many tutorials, such as: https://medium.com/@dasagrivamanu/python-naming-conventions-the-10-points-you-should-know-149a9aa9f8c7
There is a reason behind such a convention: expert programmers want to avoid ambiguity with classes; in fact, capitalized names are usually given to classes.
For example,
G = nx.Graph()
could be changed to something like:
graph1 = nx.Graph()
(also note that the name of the class 'Graph' is capitalized).
I am aware that such ambiguity has been introduced in the networkx official tutorial in the first place, but students with some knownledge on Python may find reported examples odd-looking.