Undirected Graphs Visualization

Topics: graph
Feb 12, 2009 at 10:08 AM
Hi folks,

I'm having some problems with undirected graphs by using graphviz visualization and I don't know how to solve it.

Initially, I have the following pseudo-code:

UndirectedGraph<int, Edge<int>> g = new UndirectedGraph<int, Edge<int>>();
GraphvizAlgorithm<int, Edge<int>> graphviz = new GraphvizAlgorithm<int, Edge<int>>(g);
string output = graphviz.Generate(new FileDotEngine(), "graph");

But when I run Generate method, it creates a dot file with the structure of directed graph.

digraph G 
{ a1;

a1 -> a2 [];
It's very strange and I don't know why it happens. I'm using quickgraph ver. 3.1.40122.0 for .net framework 3.5.

Thanks in advanced and regards.
Feb 12, 2009 at 11:33 PM
The graphviz writer probably does not support undirected graphs.
Feb 13, 2009 at 11:44 AM
Hi again,

Firstly, thanks for the quicker reponse, I really appreciate your effort.

Once wrote this post, I began to research deeper and I found that the graphviz writer has always, or in major cases, the same behaviour.

It includes the header digraph on dot files without take into account the graph type. I don't know if this is an error or not because I'm a begginer with this API.

I solved it with a "little trick". Keep the data structure of UndirectedGraph for compatibility purposes, and change edge direction to None on rendering tier, and get a true correspondence between data structure and rendering tier.

Feb 14, 2009 at 12:07 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.