Getting Started

Topics: graph
Oct 16, 2007 at 12:06 AM
Edited Oct 16, 2007 at 12:14 AM
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?

Oct 16, 2007 at 4:44 AM

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 6:36 PM
Would it be possible to see a code snippet example.

Oct 17, 2007 at 2: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);
Oct 17, 2007 at 5:00 AM
You can use a bidirectional graph:
BidirectionalGraph<DateTable, DateRelationEdge> g = new ...;
DataSetGraphPopulatorAlgorithm dsGPA =
new DataSetGraphPopulatorAlgorithm(visitedGraph, dsSchema);