In the process of analysing a client’s existing database, I used Visio’s reverse-engineering tool. It works well, but the resulting diagram was an incomprehensible bowl of spaghetti. Visio does have a “Layout shapes” command, which appears to work by moving shapes with repulsive forces and the result is, not surprisingly, repulsive.

What I wanted was a tool which would unravel the spaghetti, so that I could get a grasp of the relationships, edit and revise them and layout again in an iterative process.
Searching for a solution, I found three layout programs, none of which have a Visio interface:

  1. Microsoft Automatic Graph Layout (MSAGL), formerly known as GLEE The first version, GLEE, is free whereas MSAGL costs between 99 USD and 279 USD depending on where you buy it.
  2. Tom Sawyer Layout is also a graph layout library, the price isn’t disclosed on their website.
  3. Graphviz from AT&T research labs, reputed to have the most sophisticated layout algorithms, is free.

Given that the best quality was to be found in the free library, I made the obvious choice.
It took me over a year and some 11’000 lines of VB to get Visio and Graphviz to co-exist; marrying a Unix-style command-line program with a WYSIWYG interface, both with quirks to numerous to mention, was far more challenging than I initially thought.
The result, unimaginatively called GraphVizio, is available here, I hope you’ll find it useful.

25 May 2011 Version 1.1.5 released. Improvements:

Full support for 64-bit Windows and Visio

No longer makes a Visio document ‘dirty’ when opening

Full support for UTF8. This DOT file:

graph  RootGraph {
  node [width="7.08661417322834", height="0.787401574803148", color="#000000", fillcolor="#FFFFFF", fontname=Calibri, fontsize=24, style=filled, shape=box];
  edge [color="#000000", fillcolor="#FFFFFF"];

  "English: Hello, my name is Maurice\n(and blame Google if the translations are bad)" [pos="283.704566929134,620.932913385827", label="English: Hello, my name is Maurice\n(and blame Google if the translations are bad)"];
  "Russian: Здравствуйте, меня зовут Морис" [pos="283.704566929134,526.932913385827", label="Russian: Здравствуйте, меня зовут Морис"];
  "مرحبا، اسمي موريس : Arabic" [pos="283.704566929134,432.932913385827", label="مرحبا، اسمي موريس : Arabic"];
  "Chinese: 你好,我叫莫里斯" [pos="283.704566929134,338.932913385827", label="Chinese: 你好,我叫莫里斯"];
  "שלום, שמי הוא מוריס : Hebrew" [pos="283.704566929134,244.932913385827", label="שלום, שמי הוא מוריס : Hebrew"];
  "Japanese: こんにちは、私の名前はモーリスです" [pos="283.704566929134,150.932913385826", label="Japanese: こんにちは、私の名前はモーリスです"];
  "Thai: สวัสดีชื่อของฉันคือ Maurice" [pos="283.704566929134,56.9329133858268", label="Thai: สวัสดีชื่อของฉันคือ Maurice"];

  "English: Hello, my name is Maurice\n(and blame Google if the translations are bad)"--"Russian: Здравствуйте, меня зовут Морис";
  "Russian: Здравствуйте, меня зовут Морис"--"مرحبا، اسمي موريس : Arabic";
  "مرحبا، اسمي موريس : Arabic"--"Chinese: 你好,我叫莫里斯";
  "Chinese: 你好,我叫莫里斯"--"שלום, שמי הוא מוריס : Hebrew";
  "שלום, שמי הוא מוריס : Hebrew"--"Japanese: こんにちは、私の名前はモーリスです";
  "Japanese: こんにちは、私の名前はモーリスです"--"Thai: สวัสดีชื่อของฉันคือ Maurice";
}

produces this Visio diagram:

Graphvizio UTF8

41 Responses to “GraphVizio – A Graphviz addin for Visio”

  1. Astonishing! Working fine with Visio 2003 on XP. I have seen a few crashes on imports of existing dot files, but overall very good. Much better than using the cvs version of Graphviz to generate vml files to import to Visio.
    A truly groundbreaking enhancement.

    Thanks for all your hard work.

  2. My colleagues and I here in Mexico are very impressed with the solution, we applied the Add in in Visio 2010 and the results are impresive !

    In just two days we were able to analyze Cobol code using the outstanding work from Graphviz team and you ! Thank you !

  3. Amazing! … Is there a way to make it unfuddle swimlane diagrams? It takes those and turns them into flowcharts.

  4. We have a dot file that has clusters representing servers, with processes inside the server/cluster, but when using GraphVizio to import into Vizio, it drops the clusters. Any suggestions?

    Thanks,

    - N

  5. You know, this is amazing. I hope people realize that even though it does not do everything (like the clusters above), it does sooooo very much. I am using it for PERT charts and it’s awesome.

  6. I do love this software. I just upgraded to a 64 bit version of 2010…and now the menu won’t show up in the add-in section.

    I know you don’t support directly, but you do have any hints on how to get it to work? Or could I migrate this project forwards for you? It’s too valuable for me not to use. The 2010 auto layout is much more cumbersome.

  7. Hi, I’m trying to use this with a simple CSV file and it keeps showing an error that says ‘line must contain a single comma’.

    Does anyone have any solution for this?

    Many thanks

  8. To avoid cluttering this thread, I reply and fix questions, as opposed to comments, directly to their authors.

    If you have a specific question, do feel free to contact me directly at graphvizio@calvert.ch

  9. Hi,

    Is there anyway to control the size of the boxes that are drawn? Or how about causing long labels to break across multiple lines?

    Nice tool!

  10. I’m also using 64-bit Visio and after installing the add-in I don’t see it anywhere in the app.

  11. Yes, I’m afraid I can’t provide a 64-bit version; addin express, which I use to interface to Visio doesn’t have 64-bit support.

    I’ve already asked them, it would be great if you could ask as well, to try and get them to provide this.

    Edit 14/10/2010: Addin Express does support 64-bit as of the 2010 version. I just need to find the time to install and test…

  12. First let me say, great effort!!!

    It looks like HTML Like labels are not supported. Since clustering is not supported, any suggestions for how to graph complex shapes without using HTML like labels to have Tables?

  13. Correct, HTML isn’t supported, as it doesn’t fit into the Visio way of things. Clustering IS supported, however. Could you send me an example of what you’re trying to do and I’ll see if there’s a solution?

  14. Great Effort!! I have been searching for something like for a long time.

    I have a question:
    My Graphviz installation is not in the standard directory under C:program Files

    How do I change the settings so that Graphvizio can invoke GraphViz from my installed directory?

    Thanks

  15. Graphvizio for Visio 2010 64bit, please please make it happen! :-) I’m a big graphviz fan and I want to see some visio-graphviz magic to happen!

    Thanks for your time and effort!

  16. Oh, I found the sourcecode
    http://sourceforge.net/projects/graphvizio/

    If the plugin won’t work out I wouldn’t mind a standalone program that turns .dot into .vsd, but…

    …well, I’m seeing lots and lots of VB code, which fixes “quirks” and provided “challenges”, as you put it…

    I think I’ll wait and hope for your next update of Graphvizio! :-)

    Uwe

  17. Thank you for making this available. I am amazed at what is possible using this plugin. To be able to generate a graph using relationships entered into a dot file and then import it into Visio for further tweaking makes for the perfect diagramming tool.

  18. Hi,

    Nice work with the add-in.

    A question though. I have a perl script which creates visio xml groups to match certain kind of dot records. Now, when I run GraphVizio on those groups all the things inside the group are also rearanged (connection points, texts, etc..). How hard would it be to change the code such that It would only reposition instances of one master shape? I.e. it would only reposition the blocks that have text inside them.

    –Jouko

  19. Fantastic!
    I have a .net application, which creates a DOT file as a directed graph with nodes and edges by reading from an access database. It is not an organization data, but a hierarchical – parent to multiple children to their children and so on and on. Is there anyway to automatically read the DOT file and use graphvizio automation to layout my nodes ?? I do not like to see orgdata stencils or templates used. thank you – jay

  20. Now, if it would only understand ports …

  21. I installed your stuff but cannot find the file type .dot in the “File Save As…” dialog. Why? Do I have to install graphviz on the Visio machine, too? It would be cool to have a short tutorial. Please, help! Your tool is highly appretiated.

  22. Thanks for your hint via email. I’ve called the export via menu Graph->Diagram->ExportGraphviz and it works now… except these 2 issues:
    1. single states which are not connected to other states by arrows are missing in the graphviz file.
    2. I had a Visio graph from left to right but Graphviz display it from top to bottom, although generally Graphviz supports such alignment via: rankdir=LR;
    Would be cool if you fixed it… ;-)
    Anyway, good work, thanks a lot!

  23. Neither are issues.

    1. When Graphvizio reads a diagram to layout, it only considers shapes and connectors that have at least one connection to something. This is by design, due to the differences between Graphviz and Visio. A Visio diagram may contain headers, footers and so forth, which must not participate in layout. Such shapes are identified as such precisely because they are not connected.

    2. To make Graphvizio layout left-to-right, use Graph->Settings->Diagram->Rank Direction->Left-to-right. This adds rankdir=LR.

    HTH,
    Maurice

  24. I was looking for a way to import GraphViz-Files to Visio.
    Your solution sounds great, so I installed GraphVizio.

    Unfortunately I had a problem, when I tried to import a GraphViz-File. I got an error-message:

    Couldn’t find shape ‘record’ in Visio Stencil C:\Program Files (x86)\GraphVizio\GraphVizio\GraphVizio.vss

    As far as I can see GraphVizio.vss doesn’t exist at all.

  25. This is normal, Graphvizio does not support records.
    You’re not the first to ask and I would have liked to implement records, but it would be a very challenging task which would involve imitating records with grouped shapes.
    Sorry about that.

  26. Thank you for the effort poured into the tool!

  27. Hi Maurice

    Nice tool – works well.

    One issue is that with the COM addin loaded (in Visio 32 bit on Win7 64 bit), any diagram that is opened seems to get marked as “dirty” and requires to be saved. On the Undo menu there is a “Set Formula” call which can be undone.

    If I disable the addin, then the above doesn’t happen.

    This is using 1.1.1.0

    Thoughts?

    Robert

  28. First of all, thank you very much for this fantastic plugin!!!

    I have a layout with 500 links and each one in the Graphviz file has a head label and tail label, but when i import it with Graphvizio i dont see the labels in visio, are not supported??

    Thanks again,
    Victor

  29. The notion of ‘head’ and ‘tail’ doesn’t exist in Visio, so headlabel and taillabel are not supported.
    Only ‘label’ is supported.
    Sorry about that.

  30. Hi. I recently came across GraphVizio and am looking forward to working with it. I installed it into Visio 2003. When I try to import a GraphViz file I get the following error:

    “Error locating GraphViz in Program Files: The path is not of a legal form”

    Any help in resolving this would be greatly appreciated.

  31. Graphvizio uses graphviz to layout diagrams. To find the latest version of Graphviz on your PC, it looks for directories starting with “Graphviz” (excluding those starting with “Graphvizio”) in “Program Files”. Windows potentially has 2 special folders called “Program Files”, by default the first is “C:\Program Files” and the other is “C:\Program Files (x86)” if you have a 64-bit system.

    The Graphviz files are in a directory called “GraphvizXX.YY”, where XX.YY is the version. Graphvizio takes the highest-numbered one, which should be the latest version of Graphviz on your system. This directory must contain a “bin” directory, which must contain the Graphviz binaries.

    You should check:

    What is the registry setting
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir ?
    (It should be “C:\Program Files” or something similar)

    What is the registry setting
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir (x86)
    ? (It should be “C:\Program Files (x86)” or something similar)

    Do you have any other files or directories in either of the “Program Files” whose name begins with “Graphviz” and is not the result of a Graphiv install? (If so, rename or move them)

  32. Grapvizio is very impressive and one of my favorites!

    Is it possibe to include HTML tags as is done in the example below?

    Using GVedit (Graphviz 2.2.8) I get the results I want but I would like to use Graphvizio to import the .dot file in Visio.

    Thanks,
    Hessel.


    digraph structs {

    splines = ortho;

    node [shape=box, fontname = "Arial", fontsize=9];
    PC1;
    PC2;
    PC3;
    PC4;
    PC5;
    PC6;

    PC11;
    PC12;
    PC13;
    PC14;
    PC15;
    PC16;

    node [shape=box3d];
    Server;

    node [shape=trapezium];
    Printer1;
    Printer2;

    node [shape=circle];
    Router1;
    Router2;

    node [shape=none, height=0.1];
    struct1 [ label=<
    0001020304
    0506070809
    1011121314
    15161718>];

    struct2 [ label=<
    0001G020304
    0506G070809
    1011G121314
    1516G1718>];

    Router1 -> Router2[arrowhead = none];

    PC1 -> struct1:f01[arrowhead = none];
    PC3 -> struct1:f05[arrowhead = none];
    PC5 -> struct1:f09[arrowhead = none];
    Server -> struct1:f13[arrowhead = none];
    Printer1 -> struct1:f17 [arrowhead = none];

    struct1:f03 -> PC2 [arrowhead = none];
    struct1:f07 -> PC4 [arrowhead = none];
    struct1:f11 -> PC6 [arrowhead = none];
    struct1:f15 -> Router1[arrowhead = none];

    PC11 -> struct2:f01[arrowhead = none];
    PC13 -> struct2:f05[arrowhead = none];
    PC15 -> struct2:f09[arrowhead = none];
    Router2 -> struct2:f17[arrowhead = none];

    struct2:f03 -> PC12 [arrowhead = none];
    struct2:f07 -> PC14 [arrowhead = none];
    struct2:f11 -> PC16 [arrowhead = none];
    struct2:f15 -> Printer2 [arrowhead = none];

    }

  33. Maurice,

    Hello and thanks for createing Graphvizio. I hope to give it a test drive some time. Where is the best place to find documentation? Also, has the project moved to sourceforge?

    Thanks,
    Dan

  34. At the end of the install, Visio starts and a live WYSIWYG tutorial shows you how the program works. A series of tutorials covering the major features is available under Graph -> Help -> How Do I?

    The complete source code is available on SourceForge

  35. I’m afraid Graphvizio can’t handle HTML labels or Graphviz records, neither have an easy correspondence in Visio.

    Sorry about that.

  36. Is it possible to automatically open a .gv file (I would like to display a dot file in visio using something like double click or COM automation)

    (I like graphvizio but am wondering if I can save the user a manual step)

  37. I’m afraid not, sorry, it would require quite a lot of work to provide this kind of automation.

  38. Thanks a lot for that impressing Visio Add-In! Just starting to get into GraphViz.
    I’ve noticed two things: If I had not installed GraphViz the GraphVizio introduction is messy (of course). Some of the help-samples are missing e.g. for “Keep shapes togehter in groups” is missing \AppData\Roaming\GraphVisio\threecountries.vsd.

    best regards

  39. I don’t know if I am doing something wrong, but all of my boxes are having their width set from the text (or maybe graphviz) but it appears their height is taken from a fixed aspect ratio, unlike the height I see in graphviz. (So long labels get tall boxes, labels with lots of short lines get boxes that are too short)
    [And size to fit seems to do the same]

    I think it may be a bug and because

    Private Sub SizeShape(ByVal shape As Shape, ByVal width As Double, ByVal height As Double)
    Dim oldwidth As Double = shape.CellsU(“Width”).ResultIU
    Dim oldheight As Double = shape.CellsU(“Height”).ResultIU
    Dim oldvalue As Double
    Dim cellname As String

    shape.CellsU(“Width”).FormulaForceU = Convert.ToString(width, CultureInfo.InvariantCulture)
    shape.CellsU(“Height”).FormulaForceU = Convert.ToString(width, CultureInfo.InvariantCulture)
    repeats width

  40. To clarify, I would expect
    shape.CellsU(“Height”).FormulaForceU = Convert.ToString(width, CultureInfo.InvariantCulture)
    to refer to height not width

  41. A coleague has pointed out that the bug I am suggesting in SizeShape makes size to fit put all text into square boxes rather than probably being the problem with the original load.

Leave a Reply

(required)

(required)


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2012 Maurice's Musings