Ask Your Question

.plot() displaying cycle graphs as huge pretzels

asked 2013-07-05 04:01:28 -0500

JackM gravatar image

updated 2013-07-05 04:25:17 -0500

image description

That big morass of vertices on the left is actually just a single cycle. Is there any way to get Sage to render it more sensibly? I'd use layout=planar but as you can see this isn't a simple graph, the 0 vertex is connected to itself.

I suspect this might just be Sage trying to fit the large cycle into a small space, is there some way to tell it what size image to use?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-07-05 04:34:19 -0500

Nathann gravatar image

I don't agree with your very offensive criticism about pretzels.

This being said, and if you have no taste for food, you can give this a try :

sage: # Displays a Pretzel
sage: digraphs.Circuit(100).show()
sage: # Displays a calamari
sage: digraphs.Circuit(100).show(iterations=20000)

Now that I think of it, given the choice I would also chose a calamari over a pretzel.

Hence it all makes sense, after all.


edit flag offensive delete link more


Thanks. Are there any guidelines on a reasonable amount of iterations to use, as a function of the number of vertices? I'm just going with vertices*2000, but it seems like this is excessive for smaller numbers of vertices - Circuit(5) does well with just 50 iterations.

JackM gravatar imageJackM ( 2013-07-05 05:00:18 -0500 )edit

That said, now the vertices get grouped so close together I can't see the arcs - any way to make them longer, or increase the size of the "canvas"?

JackM gravatar imageJackM ( 2013-07-05 05:10:29 -0500 )edit

No guidelines, just try what works for you as it will also depend on your graphs. And your plots seems to be very different from mine. It looks like you produce them with "view" instead of "plot", or that they are latex-produced. Anyway you can play with the (many) options or .plot() and .show() to change the size of labels. It's all very "custom", but if you find good ways to tune those options you are very welcome to patch Sage with it !

Nathann gravatar imageNathann ( 2013-07-07 10:11:14 -0500 )edit

Small edit : I uploaded a pach there ( which lets one draw graphs in javascripts. As you can then move the vertices around, you'll be saved from pretzels.

Nathann gravatar imageNathann ( 2013-08-01 23:52:10 -0500 )edit

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: 2013-07-05 04:01:28 -0500

Seen: 179 times

Last updated: Jul 05 '13