Ordering graphs.

Topics: algorithm, graph
Jul 2, 2008 at 10:34 PM
I just started with QuickGraph and I want to ordering the output of the graph. Example:
We have the Nodes connected like:

     Edge<string> a_b = new Edge<string>("A", "B");
     Edge<string> e_b = new Edge<string>("E", "B");
     Edge<string> e_f = new Edge<string>("E", "F");
     Edge<string> h_f = new Edge<string>("H", "F");
     Edge<string> b_i = new Edge<string>("B", "I");
     Edge<string> f_i = new Edge<string>("F", "I");
     Edge<string> i_c = new Edge<string>("I", "C");
     Edge<string> i_g = new Edge<string>("I", "G");
     Edge<string> c_d = new Edge<string>("C", "D");
     Edge<string> c_b = new Edge<string>("C", "B");

So I want to print in this order, first the possible starting nodes, I mean the nodes that does not had InEdges behind:
In this case [A,E,H]
And then the others nodes that had the previous predecessor nodes [A,E,H]
In this case [F, B, I, G, C, D]
So the the final printing is:
[A, E, H, F, B, I, G, C, D]

Anybody know how to do it?

Aug 26, 2008 at 5:17 PM
Look for the method AlgoUtility.TopologicalSort