Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question
0

Drawing a graph - fixing its layout

asked 11 years ago

Jernej gravatar image

updated 10 years ago

FrédéricC gravatar image

Hello!

I would like to draw a simple graph G and its complement ¯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 ¯G such that the coordinates of the vertices of G are the same as the one for ¯G.

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

Thank you

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
3

answered 11 years ago

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()
Preview: (hide)
link

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: 11 years ago

Seen: 568 times

Last updated: Oct 30 '13