private static void PrintSymbolGraph() { string fileName = @"C:\Users\Ashish Sheth\Documents\Ashish\practice\DatasctructureAndAlgorithms\DatastructureAndAlgorithms\routes.txt"; var lines = File.ReadAllLines(fileName); SymbolGraph sg = new SymbolGraph(lines, " "); Graph g = sg.Graph; Console.WriteLine("Enter the source airport. Type exit to exit: "); string source = Console.ReadLine(); while (source != "exit" || string.IsNullOrEmpty(source)) { int s = sg.IndexOf(source); foreach (int v in g.GetAdjacencyList(s)) { Console.WriteLine(" " + sg.NameOf(v)); } Console.WriteLine("Enter the source airport. Type exit to exit: "); source = Console.ReadLine(); } }
private static void SymbolGraphTest() { SymbolGraph g = new SymbolGraph(@"Resources\movies.txt", @"\"); }
private static void PrintDegreesOfSeparation() { Console.WriteLine("Enter file path: "); string fileName = Console.ReadLine(); //@"C:\Users\Ashish Sheth\Documents\Ashish\practice\DatasctructureAndAlgorithms\DatastructureAndAlgorithms\movies.txt"; var lines = File.ReadAllLines(fileName); Console.WriteLine("Enter separator: "); string separator = Console.ReadLine(); SymbolGraph sg = new SymbolGraph(lines, separator); Graph g = sg.Graph; Console.WriteLine("Enter the source. Type exit to exit: "); string source = Console.ReadLine(); while (source != "exit" || string.IsNullOrWhiteSpace(source)) { if (!sg.Contains(source)) { Console.WriteLine("{0} not in database", source); continue; } int s = sg.IndexOf(source); BreathFirstPaths bfp = new BreathFirstPaths(g, s); Console.WriteLine("Enter the destination. Type exit to exit: "); string sink = Console.ReadLine(); while (sink != "exit" || string.IsNullOrWhiteSpace(sink)) { if (sg.Contains(sink)) { int t = sg.IndexOf(sink); if (bfp.HasPathTo(t)) { foreach (int v in bfp.PathTo(t)) { Console.WriteLine(" {0}", sg.NameOf(v)); } } else { Console.WriteLine("Not Connected"); } } else { Console.WriteLine("Not in database"); } Console.WriteLine("Enter the destination. Type exit to exit: "); sink = Console.ReadLine(); } Console.WriteLine("Enter the source. Type exit to exit: "); source = Console.ReadLine(); } }