Ask Your Question

Revision history [back]

If G is you graph, you can define coordinates of the vertices by using the set_pos method, see:

sage: G.set_pos?

for more details.

If G is you graph, you can define coordinates of the vertices by using the set_pos method, see:

sage: G.set_pos?

for more details.

EDIT Having a look at the set_pos documentation, it is actually lacking examples, so here is how to use set_pos: you have to define a dictionary that associates to each vertex a coordinate (i.e. a tuple of two numbers):

sage: G = Graph(3)
sage: G.set_pos({0:(0,0), 1:(1,1), 2:(0,1)})
sage: G.plot()

If G is you graph, you can define coordinates of the vertices by using the set_pos method, see:

sage: G.set_pos?

for more details.

EDIT Having a look at the set_pos documentation, it is actually lacking meaningful examples, so here is how to use set_pos: you have to define a dictionary that associates to each vertex a coordinate (i.e. a tuple of two numbers):numbers), as follows:

sage: G = Graph(3)
sage: G.set_pos({0:(0,0), 1:(1,1), 2:(0,1)})
sage: G.plot()