Actually, I seem to have patched something together that works (at
least for me).  If your graph is t, I can get it to print the way I
want it to using:


curve = Graphics()
n=t.num_verts()

for i in range(n):
    curve = curve + disk((i,0),.03,(0,2*pi), color='black') + text(i,
(i,-.1), color='black')

for i in range(n):
    for j in range(i+1,n):
        if t.has_edge((i,j)):
            curve = curve + bezier_path([[(i,0),((i+j)/2,(j-i-1)/2),(j,
0)]])


curve.show(axes=false, aspect_ratio=1)


How do I make this an option for printing a graph, so I don't have to
copy this code in each time?

Also, honestly, I'm only using steiner_tree so I can test it out with
random tree graphs.  It seemed the easiest way at the time.

~Katie



On Aug 25, 12:05 pm, Katie Johnson <katie.v.johnso...@gmail.com>
wrote:
> I'm sorry it's taken me so long to reply, and thank you for all of the
> information!
>
> I'll plan on trying something with Bezier curves, and if I get
> anything to work out, I'll definitely repost!  However, I'm pretty new
> to Sage, so don't expect anything remotely soon. :-P
>
> Thanks again,
> Katie
>
> On Aug 14, 11:50 pm, William Stein <wst...@gmail.com> wrote:
>
>
>
> > On Sat, Aug 14, 2010 at 9:22 PM, Nathann Cohen <nathann.co...@gmail.com> 
> > wrote:
> > >> Clarification: Sage's plot code does not "interact" with the GPL
> > >> incompatible graphviz library in any way.
>
> > > ?.. So we have a graphviz spkg and absolutely no interface between the 
> > > two ? O_o
>
> > I'm sorry, that's not what I meant.    You can do
>
> >   sage: g = graphs.PetersenGraph()
> >   sage: g.plot(layout='graphviz')
>
> > and graphviz would then evidently somehow get used, I guess.   I just
> > meant that by default Sage's plotting code doesn't use it at all.
>
> > I could test the above though, since (not surprisingly) the optional
> > graphviz spkg fails to install for me (on bog standard OS X 10.6), and
> > installing graphviz from the web isn't enough because the above
> > requres dot2tex.
>
> > `../../lib/gvc/no_demand_loading.c
> > make[3]: *** No rule to make target
> > `../../plugin/pango/libgvplugin_pango.la', needed by `dot_builtins'.
> > Stop.
> > make[3]: *** Waiting for unfinished jobs....
> > mv -f .deps/no_demand_loading.Tpo .deps/no_demand_loading.Po
> > mv -f .deps/dot.Tpo .deps/dot.Po
> > make[2]: *** [all-recursive] Error 1
> > make[1]: *** [all-recursive] Error 1
> > make: *** [all] Error 2
> > Error building Graphviz
>
> > ---
>
> > I tried on sage.math.washington.edu (linux) and the build succeeds, but
>
> >  sage: g = graphs.PetersenGraph()
> >  sage: g.plot(layout='graphviz')
>
> > still fails with a "dot2tex" error:
>
> > /mnt/usb1/scratch/wstein/build/sage-4.5.2.rc0/local/lib/python2.6/site-pack 
> > ages/sage/graphs/dot2tex_utils.pyc
> > in assert_have_dot2tex()
> >      60             raise RuntimeError(check_error_string)
> >      61     except ImportError:
> > ---> 62         raise RuntimeError(missing_error_string)
> >      63
> >      64 def quoted_latex(x):
>
> > RuntimeError:
> > dot2tex not available.
>
> > Please see :meth:`sage.graphs.generic_graph.GenericGraph.layout_graphviz`
> > for installation instructions.
>
> > ----
>
> > I tried installing dot2tex on sage.math.washington.edu (via apt-get),
> > but the above error stays.
> > So I have absolutely no clue how to get
>
> > g.plot(layout='graphviz')
>
> > to actually do anything useful.
>
> > On the other hand, one can use the command  g.graphviz_to_file_named(...)
> > to save a description of g in graphviz format to a file, which one can then
> > open with Graphviz directly. That works (and is what I illustrated in
> > my graph talk, which is here:http://sagemath.org/help-video.html).
>
> >  -- William

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to