By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,760 Members | 995 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,760 IT Pros & Developers. It's quick & easy.

prog/lib to draw graphs

P: n/a
Hello,
I'm looking for a program or python library to draw graphs.
They should look like the that:
/--------\ /--------\
| Node A | ------ belongs to ----> | Node B |
\--------/ \--------/

Which is a result of the function call like that:

connectNodes(firstNode, secondNode, description, lineStyle)
connectNodes("Node A", "Node B", "belongs to", dashed)

It should have a open scalable vector format as output (DVI, SVG, PDF, ...)
and should be able to make automatic optimal placement of the items.
Do you know something like that?
Thx,
Florian
Jul 18 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Florian Lindner wrote:
Hello,
I'm looking for a program or python library to draw graphs.
They should look like the that:
/--------\ /--------\
| Node A | ------ belongs to ----> | Node B |
\--------/ \--------/

Which is a result of the function call like that:

connectNodes(firstNode, secondNode, description, lineStyle)
connectNodes("Node A", "Node B", "belongs to", dashed)

It should have a open scalable vector format as output (DVI, SVG, PDF, ...)
and should be able to make automatic optimal placement of the items.
Do you know something like that?
Thx,
Florian


Try graphviz:

http://www.research.att.com/sw/tools/graphviz/
I think there's a python interface to graphviz floating around (Google
it), but it's trivial to write a Python routine that spits out valid
Graphviz "dot" files.

In the case of your example, the contents of the dot file would be
something like:

digraph G{
"Node A" -> "Node B" [label="belongs to"];
}
--Paul
Jul 18 '05 #2

P: n/a
>>>>> "Florian" == Florian Lindner <Fl*************@xgm.de> writes:

Florian> Hello, I'm looking for a program or python library to
Florian> draw graphs. They should look like the that:
Florian> /--------\ /--------\ | Node A | ------ belongs to ---->
Florian> | Node B | \--------/ \--------/

Florian> Which is a result of the function call like that:

Florian> connectNodes(firstNode, secondNode, description,
Florian> lineStyle) connectNodes("Node A", "Node B", "belongs to",
Florian> dashed)

Florian> It should have a open scalable vector format as output
Florian> (DVI, SVG, PDF, ...) and should be able to make
Florian> automatic optimal placement of the items. Do you know
Florian> something like that? Thx, Florian --
Florian> http://mail.python.org/mailman/listinfo/python-list

graphviz is a sophisticated graph drawing program

http://www.research.att.com/sw/tools/graphviz/

There is a python interface

http://www.cs.virginia.edu/~jg9h/graphiz/

JDH
Jul 18 '05 #3

P: n/a
[P&M]

Florian Lindner wrote:
Hello,
I'm looking for a program or python library to draw graphs.
They should look like the that:
/--------\ /--------\
| Node A | ------ belongs to ----> | Node B |
\--------/ \--------/

Florian -

Graphviz (http://www.graphviz.org) is a great package for drawing
graphs. It ouputs to many formats. There is a python lib for it at
http://www.freshports.org/graphics/py-graphviz/, but I have not used
it. It's easy enough to generate dot[1] code and call dot to generate
the graph image, so that's what I usually do.

HTH,

Bill
1. 'dot' is one of the graphviz commands.
Which is a result of the function call like that:

connectNodes(firstNode, secondNode, description, lineStyle)
connectNodes("Node A", "Node B", "belongs to", dashed)

It should have a open scalable vector format as output (DVI, SVG, PDF, ...)
and should be able to make automatic optimal placement of the items.
Do you know something like that?
Thx,
Florian

Jul 18 '05 #4

P: n/a
netnews.upenn.edu wrote:
Florian Lindner wrote:
Hello,
I'm looking for a program or python library to draw graphs.
They should look like the that:
/--------\ /--------\
| Node A | ------ belongs to ----> | Node B |
\--------/ \--------/

Which is a result of the function call like that:

connectNodes(firstNode, secondNode, description, lineStyle)
connectNodes("Node A", "Node B", "belongs to", dashed)

It should have a open scalable vector format as output (DVI, SVG, PDF,
...) and should be able to make automatic optimal placement of the items.
Do you know something like that?
Thx,
Florian


Try graphviz:

http://www.research.att.com/sw/tools/graphviz/
I think there's a python interface to graphviz floating around (Google
it), but it's trivial to write a Python routine that spits out valid
Graphviz "dot" files.

In the case of your example, the contents of the dot file would be
something like:

digraph G{
"Node A" -> "Node B" [label="belongs to"];
}


Thanks! (to all)
Does GraphViz also support the automated optimal placement of nodes? I'll
have many nodes...
Thx,
Florian
Jul 18 '05 #5

P: n/a
graphivz seems good but it is an external tool... Is there something
similar as http://gef.tigris.org for python ?

Yermat

Jul 18 '05 #6

P: n/a

On Jan 22, 2004, at 5:15 AM, Florian Lindner wrote:
Thanks! (to all)
Does GraphViz also support the automated optimal placement of nodes?
I'll
have many nodes...


What constitutes optimal is a matter of an entire subfield of graph
theory, and is pretty different depending on what type of graph you are
doing. Nonetheless, graphviz does pretty well without any cues. In a
project I used to use it in (a browser for large automatically learned
ontologies) I would sometimes use it to render thousands of nodes, and
it would usually look better than I expected. There is a problem in
that highly connected large graphs result in a lot of black ink for the
edges, since in such graph they will be much denser than the DPI of
your screen. I'm not sure you'll find any full display of a large
graph practical for interactive use without a lot of tweaking.

If you do want to use it interactively, be prepared for long waits
(>30s, sometimes several minutes) for very large graphs. For small
graphs, it's near instantaneous. This is a problem with graph layout
algorithms in general, however, and not graphviz per se - they do not
scale very efficiently. People I know who used ygraph, a commercial
package, told me that it was not much faster on large graphs.

hope that helps,
-kyle
Jul 18 '05 #7

P: n/a
Florian Lindner <Fl*************@xgm.de> wrote in message news:<bu*************@news.t-online.com>...
Hello,
I'm looking for a program or python library to draw graphs.
They should look like the that:
/--------\ /--------\
| Node A | ------ belongs to ----> | Node B |
\--------/ \--------/

Which is a result of the function call like that:

connectNodes(firstNode, secondNode, description, lineStyle)
connectNodes("Node A", "Node B", "belongs to", dashed)

It should have a open scalable vector format as output (DVI, SVG, PDF, ...)
and should be able to make automatic optimal placement of the items.


Since you mention DVI you probably know about LaTeX. You might
want to try its `psfrag' package, which can do all you want and
more. Learning curve is a bit steep, but the results are _very_
high quality. Nothing to do with Python though......
Jul 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.