Ask Your Question
0

Drawing a graph - fixing its layout

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

Jernej gravatar image

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

FrédéricC gravatar image

Hello!

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
3

answered 2013-10-30 12:35:16 +0100

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: g.show(save_pos=True)                         
sage: g2 = g.complement()
sage: g2.set_pos(g.get_pos())
sage: g2.show()
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

Stats

Asked: 2013-10-30 12:29:11 +0100

Seen: 538 times

Last updated: Oct 30 '13