Prev: labels legibility in matplotlib pie charts and bar plots
Next: TypeError: list indices must be integers
From: Nima on 1 Jun 2010 12:42 Hi there, Is it possible to draw an (undirected) multigraph using a python library? I need to write a program that finds an Eulerian circuit in a graph (which might obviously be a multigraph). As the output of the program, I should draw the graph and print out the solution. I asked my question at NetworkX discussion group. They told me that matplotlib, which provides drawing routines for NetworkX, doesn't show multiple edges and I have to pass the graph to another graph drawing package (if there is one!). * I've used the Fleury's algorithm to solve the problem. -- Yours sincerely, Nima Mohammadi
From: geremy condra on 1 Jun 2010 13:43 On Tue, Jun 1, 2010 at 9:42 AM, Nima <nima.irt(a)gmail.com> wrote: > Hi there, > Is it possible to draw an (undirected) multigraph using a python library? > I need to write a program that finds an Eulerian circuit in a graph > (which might obviously be a multigraph). As the output of the program, > I should draw the graph and print out the solution. We use Dot in Graphine, and it works well. It's also very easy to output to. Geremy Condra (sent to the list this time)
From: Nima on 1 Jun 2010 14:24 2010/6/1 geremy condra <debatem1(a)gmail.com> > > We use Dot in Graphine, and it works well. It's also very easy to > output to. > Graphine is a flexible, easy-to-use graph library for Python 3. I always knew a day would come when I'd need to use Python 3. And I've been so stupid thinking I could run away from this everlasting misery! Can you give me an example of drawing a simple graph by Graphine? I'm gonna use PyQt as GUI. Doesn't Qt provide any facility for drawing a graph? BTW, I just found this page: http://nodebox.net/code/index.php/Graphing Has anyone tried it out? -- Yours sincerely, Nima Mohammadi
From: geremy condra on 1 Jun 2010 14:56 On Tue, Jun 1, 2010 at 11:24 AM, Nima <nima.irt(a)gmail.com> wrote: > 2010/6/1 geremy condra <debatem1(a)gmail.com> >> >> We use Dot in Graphine, and it works well. It's also very easy to >> output to. > > >> Graphine is a flexible, easy-to-use graph library for Python 3. > > I always knew a day would come when I'd need to use Python 3. And I've > been so stupid thinking I could run away from this everlasting misery! > Can you give me an example of drawing a simple graph by Graphine? from graph.base import Graph from graph.extras import dot from subprocess import getstatusoutput # build a circular graph g = Graph(edges=['ab', 'bc', 'cd', 'da']) # build the drawing tool drawer = dot.DotGenerator() # populate the output file with open('graph.dot', 'w') as f: output = drawer.draw(g, "my_graph") f.write(output) # call circo, which will produce the best results here status, output = getstatusoutput("circo -Tgif -o graph.gif -v graph.dot") Geremy Condra
From: Richard Brodie on 2 Jun 2010 04:52
"geremy condra" <debatem1(a)gmail.com> wrote in message news:mailman.825.1275414239.32709.python-list(a)python.org... > On Tue, Jun 1, 2010 at 9:42 AM, Nima <nima.irt(a)gmail.com> wrote: >> Hi there, >> Is it possible to draw an (undirected) multigraph using a python library? >> I need to write a program that finds an Eulerian circuit in a graph >> (which might obviously be a multigraph). As the output of the program, >> I should draw the graph and print out the solution. > > We use Dot in Graphine, and it works well. It's also very easy to > output to. NetworkX apparently has dot bindings built-in, although I've not used it, so I think one should just be able to export to it. |