Ask Your Question

Drawing a graph - fixing its layout

asked 2013-10-30 12:29:11 +0200

Jernej gravatar image

updated 2015-01-14 14:08:34 +0200

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 12:35:16 +0200

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 12:29:11 +0200

Seen: 457 times

Last updated: Oct 30 '13