There is a very nice Graph Visualization Software from AT&T called Graphviz. You can have a look at the types of graphs that can be generated using it. It consists of a few tool named "dot", "neato" etc... It is realeased under a open-source type of license. As a result of which good a number of tools, library, language bindings, third-party apps have been developed around it. It has been ported to window by Ood Tsen as a co component with support for various languages like c++, vb, asp and perl. It is called WinGraphviz

Here is the code that is used for generating it

#include <atlbase.h>
#include <iostream.h>
#include "WinGraphviz.h"

const IID IID_IDOT = {0xA1080582,0xD33F,0x486E,{0xBD,0x5F,0x58,0x19,0x89,0xA3,0xC7,0xE9}};     
const CLSID CLSID_DOT = {0x55811839,0x47B0,0x4854,{0x81,0xB5,0x0A,0x00,0x31,0xB8,0xAC,0xEC}};

int main(int argc, char* argv[])
{
 USES_CONVERSION;
 HRESULT hr;
 IDOT * pIDOT;
 unsigned short* result;
 IBinaryImage *img;

 hr = CoInitialize(NULL);
 if (FAILED(hr)) {
  cout << "CoInitialize Failed: " << hr << "\n\n";
  exit(1);
 }
  
 hr = CoCreateInstance (CLSID_DOT, NULL, CLSCTX_ALL, 
  IID_IDOT, (void**)&pIDOT);
 if (FAILED(hr)) {
   cout << "CoCreateInstance Failed: " << hr << "\n\n";
   exit(1);
 }
 
 hr = pIDOT->ToPNG(A2BSTR("digraph G {      A -> B; E -> B; E -> D; D -> C;    B -> D; D -> E; F -> D; G -> A;    D -> A; B -> G; H -> C; G -> H;    C -> A; B -> H; E -> H; H -> A; }"),
   &img);
   
 img->Save(A2BSTR("Hi.png"),(VARIANT_BOOL*)&result);
 
 if (FAILED(hr)) {
   cout << "ToSvg Failed: " << hr << "\n\n";
   exit(1);
 }

 CoUninitialize();
 return 0;
};


Comments (0)

Add a Comment