Custom Vertex Information

Jul 16, 2009 at 12:44 AM

Hi.

I am considering using QuickGraph and Graph# for a project I am doing. This may be a stupid question, but it is possible to add a custom object containing data about the vertex directly to it, or would I have to store that information seperately in a database?

For example, store a time stamp and description string with each vertex/node.

I have had a look through the source, but I am not good enough to find out.

Thanks.

Coordinator
Jul 16, 2009 at 3:17 AM

All datastructure in QuickGraph are generic with respect to the vertex/node type. Therefore, you can use any .net class or struct as the vertex type. You can also instatiate the TaggedEdge<TTag> class with a struct that contains your data. i.e.

public sealed class MyData
{ ... }
var g = new AdjacencyGraph<MyData, SEdge<MyData>>();