Weighted Graphs

Topics: graph
Jun 23, 2009 at 12:03 PM

I work with DFA (Deteministic Finite Automata ) / NFA  (Nondeterministic Finite Automata ) in my application , 

since they can be modeled as weighted graph I searched for graph frameworks in .net and I found this project and I found this project great work and useful

so I decided to shift to Quickgraph.

My questions are:

 1- How can I create weighted directed graph ?

 2- How can I layout and display weighted directed graph ? each edge should be marked with label displaying its weight.

3- How can I change display style of one vertex ? I.E: change its color or its shape to show whether it is final state.

I appreciate your answers.

In case you want to add DFA , NFA and their common algorithms to your library I can join your project.



Jun 23, 2009 at 3:19 PM

1) All data structure in QuickGraph are generic with respect to the vertex and edge type. You can create your own weighted edge or use TaggedEdge<int, double>, assuming your vertex type is an int.
2,3) QuickGraph does not provide any layout algorithm per se, but it provides 'bridges' to dot (Graphviz language), GLEE or MsAgl. Each tool is different but the pattern is similar using quickgraph: when you render a graph (see user manual in wiki), you can hook to an event that gets raised for each edge (EdgeFormat I beleive). In the callback, you receive an object that controls the 'looks' for the edge vertex. There's some doc here: http://quickgraph.codeplex.com/Wiki/View.aspx?title=Visualization%20Using%20Graphviz&referringTitle=Home.