public static void MainTest(string[] args) { TextInput StdIn = new TextInput(); string filename = args[0]; string delimiter = args[1]; SymbolGraph sg = new SymbolGraph(filename, delimiter); Graph G = sg.G; while (StdIn.HasNextLine()) { string source = StdIn.ReadLine(); if (sg.Contains(source)) { int s = sg.Index(source); foreach (int v in G.Adj(s)) { Console.WriteLine(" " + sg.Name(v)); } } else { Console.WriteLine("input not contain '" + source + "'"); } } }
public static void MainTest(string[] args) { string filename = args[0]; string delimiter = args[1]; string source = args[2]; SymbolGraph sg = new SymbolGraph(filename, delimiter); Graph G = sg.G; if (!sg.Contains(source)) { Console.WriteLine(source + " not in database."); return; } int s = sg.Index(source); BreadthFirstPaths bfs = new BreadthFirstPaths(G, s); TextInput StdIn = new TextInput(); while (!StdIn.IsEmpty) { string sink = StdIn.ReadLine(); if (sg.Contains(sink)) { int t = sg.Index(sink); if (bfs.HasPathTo(t)) { foreach (int v in bfs.PathTo(t)) { Console.WriteLine(" " + sg.Name(v)); } } else { Console.WriteLine("Not connected"); } } else { Console.WriteLine(" Not in database."); } } }