Ask Your Question

Plotting poset with vertices replaced by graph plots

asked 2017-03-13 13:28:20 -0600

GrumpyChuckles gravatar image

updated 2017-07-31 15:23:35 -0600

FrédéricC gravatar image

Hello ask.sagemath! I'd like to graph a poset of all connected graphs on $4$ vertices with the relation of $\subset$.
So far I can either draw all such graph using

L = filter(lambda g : g.is_connected(), graphs(4));

Or draw a Poset with


But I can't combine them to, say, have


Is there a way to draw a poset where the vertices are also drawn to be graphs?

Thank you for your help!

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2017-03-17 14:58:33 -0600

FrédéricC gravatar image

Not very nice, but this sort of works. First install ''dot2tex'' using ''sage -i dot2tex''. Then

sage: g1 = Graph([(1,2),(2,3)], immutable=True)
sage: g2 = Graph([(1,2),(1,3)], immutable=True)

You can also do this like that : "g = g.copy(immutable=True)"

sage: G = DiGraph({g1:[g2]})
sage: G.set_latex_options(format='dot2tex')
sage: view(G)

This outputs a pdf file.

You can then try to play with the options to get a better layout.

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

1 follower


Asked: 2017-03-13 13:28:20 -0600

Seen: 81 times

Last updated: Mar 17 '17