Vertex Numbering, Gradient Fills

Topics: glee, graph
Sep 13, 2007 at 12:35 PM
As mentioned in another thread i generate the graph out of an AdjacencyGraph like this

GleeGraphPopulator<string, Edge<string>> populator = GleeGraphUtility.Create<string, Edge<string>>(graph);
populator.Compute();
Graph gleeGraph = populator.GleeGraph;

But all the vertices are suddenly numbered when displaying the graph using GLEE. E.g. there is a vertex called "MyState" and when displaying the graph it is called "0: MyState" and so on. Is there some way to suppress this?

One more short question:
- How do i produce such gradient fills in my graph as they are shown on the GLEE Homepage?
Coordinator
Sep 14, 2007 at 8:23 AM
First question: use the 'Create' overload that takes a formatprovider and format string.

Second question: use on VertexAdded and EdgeAdded to get notified about Glee vertex and edges being created. At this point, you can modify all the attributes of the glee nodes (including the label)
Sep 14, 2007 at 9:40 AM
can you give an example of the formatprovider overload? i have found it but haven't got a clue how to create such a formatprovider or even how to specyfy the format string for the third argument.
Sep 29, 2007 at 3:05 PM
just a reminder if you could please post an example how the formatprovider can be used
Coordinator
Oct 3, 2007 at 6:58 AM
Edited Oct 3, 2007 at 7:00 AM
Attach to the NodeAdded, EdgeAdded events of the GleePopulator objects

{
    GleeGraphPopulator<V, E> populator = GleeGraphUtility.Create(g);
    try
    {
        populator.NodeAdded += new GleeVertexNodeEventHandler<V>(populator_NodeAdded);
        populator.EdgeAdded += new GleeEdgeEventHandler<V, E>(populator_EdgeAdded);
        populator.Compute();
        ,,,
   }
   finally
   {
       populator.NodeAdded -= new GleeVertexNodeEventHandler<V>(populator_NodeAdded);
       populator.EdgeAdded -= new GleeEdgeEventHandler<V, E>(populator_EdgeAdded);
    }
 
    return this;
}
 
    void populator_EdgeAdded(object sender, GleeEdgeEventArgs<V, E> e)
    {
            // change the edge apperance here 
        }
 
        void populator_NodeAdded(object sender, GleeVertexEventArgs<V> args)
        { 
          // change the vertex appeance here
        } 
 
Oct 3, 2007 at 8:17 PM
i appreciate your examples for the formatting, it works fine now for me, but what i am still dont't get right is the IFormatprovider . The create method takes, as you mentioned before, this additonal argument with the iformatprovider. but how do i create such a formatprovider? what are the arguments for a formatstring? i know that for example for datetime you can provide a formatsting like "dd.MM.YYYY" but which arguments can be used here? is there some example you can provide?
Coordinator
Oct 4, 2007 at 4:27 AM
You don't need that. If you vertex supports a ToString(IFormatProvider fp) method, then it will be used. For example, DateTime supports this overload.