Beispiel #1
0
        public static void Main(string filename, char delimitor, string source, string sink)
        {
            SymbolGraph symbolGraph = new SymbolGraph(filename, delimitor);

            if (!symbolGraph.Contains(source))
            {
                Console.WriteLine(string.Format("Source {0} is out of DB", source));
            }

            if (!symbolGraph.Contains(sink))
            {
                Console.WriteLine(string.Format("Sink {0} is out of DB", sink));
            }

            int                  sourceIndex = symbolGraph.GetIndex(source);
            int                  sinkIndex   = symbolGraph.GetIndex(sink);
            BfsPaths             bfsTree     = new BfsPaths(symbolGraph.Graph, sourceIndex);
            IEnumerable <string> paths       = bfsTree.PathTo(sinkIndex).Select(index => symbolGraph.GetName(index));

            Console.WriteLine(string.Format("{0} -> {1}\n {2}", source, sink, String.Join("\n ", paths)));
        }