Martin,

The short answer is that the graph code in sage right now doesn't have
any options to tweak the automatic spring layout. In other words, my
wrapping isn't done. You can, however, reach through to NetworkX as in
the following example. Suppose I have some graph G:

G = graphs.RandomGNP(27,.4)

You can recover the NetworkX graph,

N = G.networkx_graph()

and utilize NetworkX's spring layout function directly:

import networkx
from sage.plot.plot import Graphics, GraphicPrimitive_NetworkXGraph
P = networkx.drawing.spring_layout(N, iterations=20, dim=2)
NGP = GraphicPrimitive_NetworkXGraph(graph=N, pos=P)
g = Graphics()
g.append(NGP)
g.show(axes=False)

Note that the default is iterations=50. The only real tweaking NetworkX
lets you do is in the number of iterations (you can also increase
dimension, but then you have to project back down to 2...) If you're
looking for formal symmetries, you might try

networkx.drawing.spectral_layout(G, dim=2, vpos=None, iterations=1000,
eps=0.001)

It uses the smallest eigenvectors from the Laplacian adjacency matrix,
which is the normal adjacency matrix with (negative degree) along the
diagonal. It may reveal the more algebraic aspects you're looking for.
This also has a few options to tweak (the values above are all
defaults).

I'll add many tweaks for graph plots in the future. One tweak will be
allowing someone to specify how many iterations the spring layout
should go, and another will be using different layout methods. Is there
anything else specific you would like them to do?


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to