Ask Your Question
0

.plot() displaying cycle graphs as huge pretzels

asked 2013-07-05 11:01:28 +0100

JackM gravatar image

updated 2013-07-05 11:25:17 +0100

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
1

answered 2013-07-05 11:34:19 +0100

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.

Nathann

edit flag offensive delete link more

Comments

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 12:00:18 +0100 )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 12:10:29 +0100 )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 17:11:14 +0100 )edit

Small edit : I uploaded a pach there (http://trac.sagemath.org/ticket/14953) 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-02 06:52:10 +0100 )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

Stats

Asked: 2013-07-05 11:01:28 +0100

Seen: 479 times

Last updated: Jul 05 '13