Vertices with String Names

Topics: graph
Sep 20, 2010 at 4:42 PM


This should be a simple question for this crew.  I am trying to generate a graph with the code below.  However, the vertices are labled ordinally, instead of with the string value I provide.  I would like to see the vertices below labeled as "root", "intermediate", and "hola" instead of "0", "1", "2".  How do I change this?  I tried playing with some of the formatting members but to no avail.

Thanks for your help,


//create a new graph
        var g = new AdjacencyGraph<string, TaggedEdge<string, string>>();
        var graphviz = new QuickGraph.Graphviz.GraphvizAlgorithm<string, TaggedEdge<string, string>>(g);
        //create vertexes
        string v1 = "root";
        string v2 = "intermediate";

        var e1 = new TaggedEdge<string,string>(v1,v2,"hello");
        //Render Graph
        graphviz.CommonVertexFormat.FontColor = System.Drawing.Color.FromName("Green");
        string output = graphviz.Generate(new FileDotEngine(), "c:\\graphoutput\\graph");

Sep 28, 2010 at 12:57 PM

Hello, in order to make this you should implément the event FormatVertex or FormatEdge on graphviz object.

It permit to customize the label,comment,color set to the edge and the vertex in dot file.