Database Schema diagram using QuickGraph

Topics: graph
Aug 13, 2009 at 9:29 AM

I am just getting introduced to QuickGraph. I was wondering whether the QuickGraph library (along with its support for GraphViz) can be used to generate an relationship diagram, given a Database Schema (DataSet??). I am looking for something similar to  but using QuickGraph.

Any help/pointers are much appreciated.



Aug 15, 2009 at 3:20 AM

QuickGraph supports building graphs from DataSets. Look for the 'DataSetGraph' type in the QuickGraph.Data.dll assembly. There's no built-in output to Graphviz tough, you'll have to code that part yourself.

Aug 17, 2009 at 4:44 PM

pelikhan, thanks for the response. I did look at DataSetGraph but was not sure whether they can be converted to a format accepted by the GraphViz module. If I understand the flow correct, I would be required to manipulate the DataSetGraph object and make it output a 'dot' file that can then be fed to GraphViz module in QuickGraph (which will then take over and output an image file??).

I will try this option and post my feedback here.

Thanks again.

Aug 22, 2009 at 9:16 AM

You need to create a GraphvizAlgorithm (see ), hook to the FormatVertex, FormatEdge events to customize the output then render it to a .dot file. Then, you need to call Graphviz to render it.

Aug 26, 2009 at 4:03 AM

I've just added a class that does this. Look for DataSetGraphExtensions.ToGraphviz in the sources.


Aug 26, 2009 at 5:21 AM

Thanks pelikhan for the follow-up. I ended up writing similar code that takes a DataSet and outputs a DOT file, but all done outside the GraphViz library. Now that I see how you have coded the algorithm in the context of GraphViz (as an extension to AlgorithmBase), I will try to use this and get back to you with feedback/improvements.

Thanks again.