Ask Your Question

Drawing a graph - fixing its layout

asked 2013-10-30 06:29:11 -0500

Jernej gravatar image

updated 2015-01-14 07:08:34 -0500

FrédéricC gravatar image


I would like to draw a simple graph $G$ and its complement $\overline{G}.$ I was asked to make the drawing such that it is evident that the drawings are complementary. More precisely I was advised to draw $G$ and $\overline{G}$ such that the coordinates of the vertices of $G$ are the same as the one for $\overline{G}.$

What would be an easy way to accomplish this in Sage?

Thank you

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2013-10-30 06:35:16 -0500

Nathann gravatar image

With g.plot(save_pos = True) the layout used by Sage in the plot is saved in g. You can obtain it by doing g.get_pos() and give them to another graph with h.set_pos(g.get_pos()).

sage: g = graphs.KneserGraph(5,2)                   
sage: g2 = g.complement()
sage: g2.set_pos(g.get_pos())
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-10-30 06:29:11 -0500

Seen: 139 times

Last updated: Oct 30 '13