| 1 | initial version |
The error occurs because Sage names, like Graph, are automatically imported in an interactive Sage session, but not in a Python file, like zg.py (only pure Python keywords are known in such a file). You have to import them explicitely. In your case, you have to add the following line at the top of the file:
from sage.graphs.graph import Graph
To find which import statement should be added for a given Sage name bla (say), type import_statements("bla") in a Sage session. For instance, in your case:
sage: import_statements("Graph")
from sage.graphs.graph import Graph
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.