Ask HN: What is your favorite application of Graphviz?
How do you use Graphviz? What have you written that uses it on the backend? What is your favorite tool that you use that uses it? What are some ideas you haven't gotten around to implementing that would use it?
8 comments
[ 2.7 ms ] story [ 28.0 ms ] threadOne idea I have is to use "dot" to give auto-layout capabilities to a GUI that has a simple canvas. Right now, any data set that wasn't created by a GUI user (e.g. automatically generated) looks ugly, because it has no useful layout information. Since "dot" knows how to do layout, it would seem possible to run it in the background, parse the results, and use the node positions to make the default canvas look much more intelligent.
Someday I'd like to set up a script that takes the query-plan returned by PostgreSQL's EXPLAIN statement and turns it into a diagram with a node for each operation and arrows for dependencies, where the arrow width is proportional to the number of rows involved (again, much like SQL Server's query plan results). This would make it easier to spot the hotspots in a complex plan.
My favourite GraphViz tool would probably be XDot:
Fast, interactive viewing of GraphViz source files without having to convert them to PNG every time, and can be embedded in your own Python/GTK+ apps.I will say that the trickiest bits were extracting the exact information from the database, and figuring out the how to make arrows point to and from individual fields, instead of from the table in general.
Getting tables and fields from PostgreSQL:
Getting foreign-key information from PostgreSQL: As for the DOT output, I wound up using their HTML table support, generating a unique name for each cell in the table (port="blah" on each td element) and defining the foreign key arrows as going from table1:field1:e to table2:field2:w when table1.field1 is a foreign key referencing table2.field2.Thanks for the hints.