Hi Nicolas, On Tue, Sep 29, 2009 at 1:05 PM, Nicolas M. Thiery <nicolas.thi...@u-psud.fr> wrote: > Hi Kjell, > > On Tue, Sep 29, 2009 at 09:36:57AM +0200, Kjell Magne Fauske wrote: >> >> import dot2tex >> >> texcode = dot2tex.dot2tex(testgraph, debug=True) > > Speaking of this: I have another use case for which is not (yet!) > covered by the new shiny interface, namely calling dot2tex only to > extract out the node layout information, as a dictionary of the form { > node_name : [x,y] }. Here is how I currently cheat around: > > from dot2tex.dot2tex import DotConvBase > > class TrivialDotConv(DotConvBase): > def do_nodes(self): > pass > > def do_edges(self): > pass > > conv = (TrivialDotConv({})) > conv.convert(dotdata) > > return dict( (node.name, map(int, node.attr['pos'].split(','))) for > node in conv.nodes ) > > Would you consider adding this feature to the shiny interface, so that > one could do something like: > > > dotdata = r""" > digraph { > "a" [label=" ", texlbl="$1$"]; > "b" [label=" ", texlbl="$2$"]; > "c" [label=" ", texlbl="$3$"]; > a -> c > b -> c > } > """ > > dot2tex.dot2tex(dotdata, format = "positions") > > {'a': [8, 66], 'b': [42, 66], 'c': [25, 10]} >
Adding such a feature is of course possible. I'll see what I can do. Just curious. What do you want to use the positioning information for? As I mentioned in an earlier post, the dot2tex's graph data structure is very simple. If you want to manipulate DOT graphs in a more robust way I recommend taking a look at NetworkX and PyGraphviz: http://networkx.lanl.gov/ http://networkx.lanl.gov/pygraphviz/ > > Oh, and a last point: in order to include a test-suite in the upcoming > dot2tex sage package, I tried running the test-script, and got some > errors/warnings. Am I doing something wrong? > > I did: > > ... install pyparsing > > zephyr>cd /tmp/dot2tex-2.8.6 > zephyr>sudo python setup.py install > zephyr>cd tests > zephyr>python test_multirender.py The problem here is probably that the tool pdftk is not installed on your system. I use it to combine several PDF into one file. > zephyr>python test_buildexamples.py I will investigate this and see if all the examples are built correctly on my system. - Kjell Magne Fausk --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en -~----------~----~----~----~------~----~------~--~---