Getting Started

Topics: graph
Oct 15, 2007 at 11:06 PM
Edited Oct 15, 2007 at 11:14 PM
I want to use quickgraph to manage database table relationships. A user may select fields from tables that are not directly linked meaning additional tables would have to be included in the join to facilitate creating the sql statement. This seems like the strongly connected components algorithm? Does this seem like a good use of QuickGraph? overkill? or makes no sense?

Thanks
Rich
Coordinator
Oct 16, 2007 at 3:44 AM
Definitely!

Check out DataSetGraphPopulatorAlgorithm in QuickGraph.Data. It will create a directed graph from a DataSet schema. Once you have the graph, you can apply all the algorithms from the library.

Topological sort for example is usefull to figure which table to delete first in order to avoid foreign issues etc...
Oct 16, 2007 at 5:36 PM
Would it be possible to see a code snippet example.

Thanks
Oct 17, 2007 at 1:13 AM
        • I loaded dsSchema with DataTables and Relationship schema info. How do I instantiate visitedGraph?

IMutableVertexAndEdgeListGraph<DataTable, DataRelationEdge> visitedGraph = ???

      • the following fails because visitedGraph is not instantiated.
        • Am I even close on this.

DataSetGraphPopulatorAlgorithm dsGPA =
new DataSetGraphPopulatorAlgorithm(visitedGraph, dsSchema);
Coordinator
Oct 17, 2007 at 4:00 AM
You can use a bidirectional graph:
BidirectionalGraph<DateTable, DateRelationEdge> g = new ...;
 
DataSetGraphPopulatorAlgorithm dsGPA =
new DataSetGraphPopulatorAlgorithm(visitedGraph, dsSchema);
 
dsGPA.Compute();