tags:

views:

432

answers:

4

I want to use GraphViz in my WPF application without installing Graphviz.

Does AT&T (or somebody else) distribute such a DLL?

Thanks, Kemal

A: 

Licensing

GraphViz is licensed under the Common Public License (see the CPL FAQ)

Also from the GraphViz site:

For more information on the Common Public License, see the FAQ. If you have any concerns about the what the license means, especially if money is involved, you should contact an intellectual property lawyer.

Using GraphViz as a DLL

GraphViz is an executable program rather than a DLL - to use it in your app you need to spawn the executable with the correct command line parameters and pick up the resulting output.

Other ways of using GraphViz

There is a COM component available that parses the DOT language and renders it: WinGraphViz but I've never used it and cannot vouch for how well it works.

Aside: If you are doing graph work in WPF I thoroughly recommend using QuickGraph to actually manage the graph - it will also output to GraphViz compatible text files.

Matt Breckon
OK but is it at all technichally possible?
Kemal
See edits - it's possible but you need to launch an .exe rather than using it like a library
Matt Breckon
Why?Why not use it as a library if it is possible (as you say)?
Kemal
It is available only as a .EXE - it is not possible to use this as a library. My original meaning was that it is possible to use GraphViz from a WPF application but you must spawn the .exe to do the work
Matt Breckon
So nobody ever compiled a DLL out of it?
Kemal
There are several DLLs in the installation which you might be able to use if you can program in C++ but I've never seen a single DLL version of GraphViz.
Matt Breckon
WinGraphViz was dead long ago.And QuickGraph is a general purpose graph library that uses GraphViz only as one of the possible back-ends.
Kemal
I know this comment is rather late, but you can definitely use Graphviz as a library. They even have a guide on their website: http://www.graphviz.org/pdf/libguide.pdf. If you just want to layout and render a graph, you'll need graph.dll, gvc.gll, cdt.dll, ltdl.dll, zlib1.dll, and pathplan.dll from the /bin directory along with the associated .lib and .h files.
David Brown
A: 

Apparently ImageMagick can read the graphviz DOT format: http://www.imagemagick.org/script/formats.php

Perhaps you can call ImageMagick from .NET using this wrapper http://imagemagick.codeplex.com/ and get it to read DOT and output as PNG or something? I've never tried, and for all I know ImageMagick might end up spawning the command line program anyway!

(I have used graphviz from ASP classic a long time ago by spawning the graphviz executable with good results BTW.)

Matthew Lock
+1  A: 

Just use the "GraphViz XAML Renderer" @ http://www.sixpairs.com/graphviz/graphviz.aspx

Features:

  • No need to install GraphViz
  • No need to launch an external process
  • No need to use files
  • Thread safety

Regards,

Ciper

Ciper
Sounds interesting but the link is utterly broken for me
flq
Seems to be here now, have to email the author to get it: http://www.graphspe.com/graphviz-xaml-renderer#/Renderer
Scott Bilas
+2  A: 

You can compile the dot tool as DLL from source. That is what I did a while back. I use QuickGraph with GraphViz and render the graph with slightly modified version of the control you can get from here http://www.codeproject.com/KB/WPF/Dot2Wpf.aspx

aogan