static void ConnectTest() { Console.Write("This test displays a connection table for a directed graph\n\n"); // create the graph DGraph tree1 = new DGraph(); //add nodes tree1.AddNode('A'); tree1.AddNode('C'); tree1.AddNode('T'); tree1.AddNode('Z'); tree1.AddNode('X'); tree1.AddNode('K'); tree1.AddNode('Q'); tree1.AddNode('J'); tree1.AddNode('M'); tree1.AddNode('U'); // add some edges tree1.AddEdge('A', 'C'); tree1.AddEdge('A', 'T'); tree1.AddEdge('A', 'Z'); tree1.AddEdge('X', 'C'); tree1.AddEdge('C', 'X'); tree1.AddEdge('C', 'K'); tree1.AddEdge('T', 'Q'); tree1.AddEdge('K', 'Q'); tree1.AddEdge('Q', 'J'); tree1.AddEdge('J', 'M'); tree1.AddEdge('Z', 'X'); tree1.AddEdge('U', 'M'); tree1.AddEdge('K', 'X'); // uncomment the next line to see your node list, edge list, and edge matrix Debug1(tree1); Console.Write("The breadth first min tree from A should be: \n"); Console.Write(" A-Z A-Z A-T A-C Z-X T-Q C-K Q-J J-M with U unreachable\n"); Console.Write(" is: " + tree1.BreadthFirst('A') + "\n\n"); Console.Write("Note that the order of nodes in your output might differ\n"); Console.Write("what is important which nodes are reached from each start\n"); Console.Write("The graph connect table should be: \n"); Console.Write("A: Z X C K Q J M T \n"); Console.Write("C: K X Q J M\n"); Console.Write("T: Q J M\n"); Console.Write("Z: X C K Q J M\n"); Console.Write("X: C K Q J M\n"); Console.Write("K: X C Q J M\n"); Console.Write("Q: J M\n"); Console.Write("J: M\n"); Console.Write("M:\n"); Console.Write("U: M \n\n"); Console.Write("The graph connect table is: \n"); Console.Write(tree1.ConnectTable() + "\n\n"); Console.Write("End of testing connection table\n\n"); }