Ask Your Question

Revision history [back]

There is a difference between the graph and the plot of the graph:

sage: the_graph = graphs.PetersenGraph()
sage: the_plot_of_the_graph = the_graph.plot()

which are two different objects:

sage: type(the_graph)
<class 'sage.graphs.graph.Graph'>
sage: type(the_plot_of_the_graph)
<class 'sage.plot.graphics.Graphics'>

Only the graph has the attribute get_pos:

sage: hasattr(the_graph, 'get_pos')
True
sage: hasattr(the_plot_of_the_graph, 'get_pos')
False

Notice that the plot of a circle is also an instance of a Graphics object:

sage: P = circle((0,0), 1).plot()
sage: type(P)
<class 'sage.plot.graphics.Graphics'>

so there is no reason for a Graphics object to have the get_pos attribute.