Graph Lib

As I was preparing for my math exams (discrete math) I decided to create a simple library for graphs. If you are interested in the Graph Theory, you may find this lib useful. It is very simple now and it has a little features. It is beta, so if you find any problems with it, please contact me.

Well, let’s start using it! I am going to show you how to create this graph on the image, using the lib.


So, here it is our graph. Now we can construct a spanning tree either in dept or in width.

Console.WriteLine(edge) will print on the screen x->y : v, where x is the first vertex, y is the second vertex and v is the value of this edge (if it has a value). Here are our two spanning trees, constructed using two different algorithms.

Spanning Trees

I have also implemented the algorithms of Prim, Kruskal and Dijkstra. I will show them in the following example. First, we are going to construct a new graph, which has values of his edges.


And here are the algorithms in action. They are implemented as simple as possible.


[ DLL File ] [ Source Code ]