public void zeitOfAlgorithmus(string path, String methode, bool directed)
        {
            string[] word = Regex.Split(path, "/");

            Console.WriteLine(word[word.LongLength - 1]);

            Algorithmus algorithmus = new Algorithmus();

            Graph graph = Parse.getGraphByFile(path, directed);

            DateTime befor = System.DateTime.Now;

            if (methode == "cycleCancelling")
            {
                algorithmus.cycleCancelling(graph);
            }
            else
            {
                algorithmus.successiveShortestPath(graph);
            }

            DateTime after = System.DateTime.Now;
            TimeSpan ts    = after.Subtract(befor);

            // Console.WriteLine("\n\n{0}s \n", ts.TotalSeconds);
            Console.WriteLine("\n", ts.TotalSeconds);
        }
Beispiel #2
0
        public void zeitOfAlgorithmus(string path, String methode)
        {
            Console.WriteLine(methode);

            Algorithmus algorithmus = new Algorithmus();

            Graph graph = Parse.getGraphByFile(path);

            DateTime befor = System.DateTime.Now;

            if (methode == "Neighbor")
            {
                algorithmus.nearestNeighbor(graph);
            }
            else if (methode == "DoubleTree")
            {
                algorithmus.DoubleTree(graph);
            }
            else if (methode == "bruteforce")
            {
                algorithmus.bruteforce(graph);
            }
            else
            {
                algorithmus.branchUndBound(graph);
            }

            DateTime after = System.DateTime.Now;
            TimeSpan ts    = after.Subtract(befor);

            Console.WriteLine("\n\n{0}s", ts.TotalSeconds);
        }
        public void BFS_und_TFS(string path, bool bfs)
        {
            Console.WriteLine("Bereitensuche oder Tiefensuche");

            Algorithmus algorithmus = new Algorithmus();

            List <Node> nodeList = Parse.readFile(path);

            List <List <Node> > resultList = new List <List <Node> >();

            DateTime befor = System.DateTime.Now;

            Node root = null;

            while ((root = checkNodeList(nodeList)) != null)
            {
                List <Node> result = new List <Node>();

                if (bfs)
                {
                    algorithmus.BFS(root, result);
                }
                else
                {
                    algorithmus.DFS(root, result);
                }

                resultList.Add(result);
            }
            DateTime after = System.DateTime.Now;
            TimeSpan ts    = after.Subtract(befor);

            Console.WriteLine("\n\n{0}s.", ts.TotalSeconds);



            foreach (List <Node> result in resultList)
            {
                Console.WriteLine("\n");
                foreach (Node n in result)
                {
                    Console.Write(n.id + ",");
                }
            }


            Console.ReadLine();
        }