Example #1
0
        static void Main(string[] args)
        {
            if (args.Length >= 1 && args[0].StartsWith("-s"))
            {
                SSSPSlave slave = new SSSPSlave();
                slave.Start(true);
            }

            //SSSP.exe -c startcell
            if (args.Length >= 2 && args[0].StartsWith("-c"))
            {
                TrinityConfig.CurrentRunningMode = RunningMode.Client;
                for (int i = 0; i < Global.SlaveCount; i++)
                {
                    Global.CloudStorage.StartSSSPToSSSPSlave(i, new StartSSSPMessageWriter(long.Parse(args[1].Trim())));
                }
            }

            //SSSP.exe -q cellID
            if (args.Length >= 2 && args[0].StartsWith("-q"))
            {
                TrinityConfig.CurrentRunningMode = RunningMode.Client;
                var cell = Global.CloudStorage.LoadSSSPCell(int.Parse(args[1]));
                Console.WriteLine("Current Node's id is {0}, The distance to the centre node is {1}.",
                                  cell.CellID, cell.distance);
                while (cell.distance > 0)
                {
                    cell = Global.CloudStorage.LoadSSSPCell(cell.parent);
                    Console.WriteLine("Current Node's id is {0}, The distance to the centre node is {1}.",
                                      cell.CellID, cell.distance);
                }
            }

            //SSSP.exe -g node count
            if (args.Length >= 2 && args[0].StartsWith("-g"))
            {
                TrinityConfig.CurrentRunningMode = RunningMode.Client;

                Random rand      = new Random();
                int    nodeCount = int.Parse(args[1].Trim());
                for (int i = 0; i < nodeCount; i++)
                {
                    HashSet <long> neighbors = new HashSet <long>();
                    for (int j = 0; j < 10; j++)
                    {
                        long neighor = rand.Next(0, nodeCount);
                        if (neighor != i)
                        {
                            neighbors.Add(neighor);
                        }
                    }
                    Global.CloudStorage.SaveSSSPCell(i, distance: int.MaxValue, parent: -1, neighbors: neighbors.ToList());
                }
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            if (args.Length >= 1 && args[0].StartsWith("-s"))
            {
                SSSPSlave slave = new SSSPSlave();
                slave.Start(true);
            }

            //SSSP.exe -c node_count iteration_time precision
            if (args.Length >= 4 && args[0].StartsWith("-c"))
            {
                TrinityConfig.CurrentRunningMode = RunningMode.Client;

                long   node_count     = long.Parse(args[1].Trim());
                long   iteration_time = long.Parse(args[2].Trim());
                double precision      = double.Parse(args[3].Trim());

                //DateTime dt = DateTime.Now;
                for (int i = 0; i < Global.SlaveCount; i++)
                {
                    Global.CloudStorage.StartSSSPToSlave(i, new StartSSSPMessageWriter(node_count, precision));
                    //Global.CloudStorage.ChangeSSSPToSlave(i, new ChangeSSSPMessageWriter(node_count));
                }
                //TimeSpan ts = DateTime.Now - dt;
                //Console.WriteLine("All Time --- " + " Node_count: " + node_count + " Time: " + ts.TotalMilliseconds.ToString());
            }

            //SSSP.exe -q cellID
            if (args.Length >= 2 && args[0].StartsWith("-q"))
            {
                TrinityConfig.CurrentRunningMode = RunningMode.Client;
                var cell = Global.CloudStorage.LoadSSSPCell(int.Parse(args[1]));
                print(cell);

                Console.WriteLine();
            }

            //SSSP.exe -r fileName node_count
            //search in the desktop
            if (args.Length >= 3 && args[0].StartsWith("-r"))
            {
                TrinityConfig.CurrentRunningMode = RunningMode.Client;
                String path = "C:\\Users\\Administrator\\Desktop\\" + args[1];
                loadFile(path, int.Parse(args[2]));
            }
        }
Example #3
0
        static void Main(string[] args)
        {
            if (args.Length >= 1 && args[0].StartsWith("-s"))
            {
                SSSPSlave slave = new SSSPSlave();
                slave.Start(true);
            }

            //SSSP.exe -c node_count iteration_time precision
            if (args.Length >= 4 && args[0].StartsWith("-c"))
            {
                TrinityConfig.CurrentRunningMode = RunningMode.Client;

                long node_count = long.Parse(args[1].Trim());
                long iteration_time = long.Parse(args[2].Trim());
                double precision = double.Parse(args[3].Trim());

                //DateTime dt = DateTime.Now;
                for (int i = 0; i < Global.SlaveCount; i++)
                {
                    Global.CloudStorage.StartSSSPToSlave(i, new StartSSSPMessageWriter(node_count, precision));
                    //Global.CloudStorage.ChangeSSSPToSlave(i, new ChangeSSSPMessageWriter(node_count));
                }
                //TimeSpan ts = DateTime.Now - dt;
                //Console.WriteLine("All Time --- " + " Node_count: " + node_count + " Time: " + ts.TotalMilliseconds.ToString());
            }

            //SSSP.exe -q cellID
            if (args.Length >= 2 && args[0].StartsWith("-q"))
            {
                TrinityConfig.CurrentRunningMode = RunningMode.Client;
                var cell = Global.CloudStorage.LoadSSSPCell(int.Parse(args[1]));
                print(cell);

                Console.WriteLine();
            }

            //SSSP.exe -r fileName node_count
            //search in the desktop
            if (args.Length >= 3 && args[0].StartsWith("-r"))
            {
                TrinityConfig.CurrentRunningMode = RunningMode.Client;
                String path = "C:\\Users\\Administrator\\Desktop\\" + args[1];
                loadFile(path, int.Parse(args[2]));
            }
        }
Example #4
0
        /*
         * static void Main(string[] args)
         * {
         *  //HashSet<long> neighbors = new HashSet<long>();
         *  //parseFile("C:\\Users\\Administrator\\Desktop\\b.txt");
         * }
         */

        static void Main(string[] args)
        {
            if (args.Length >= 1 && args[0].StartsWith("-s"))
            {
                SSSPSlave slave = new SSSPSlave();
                slave.Start(true);
            }

            //SSSP.exe -c node_count iteration_time thresholdFactor
            if (args.Length >= 4 && args[0].StartsWith("-c"))
            {
                TrinityConfig.CurrentRunningMode = RunningMode.Client;

                long   node_count      = long.Parse(args[1].Trim());
                long   iteration_time  = long.Parse(args[2].Trim());
                double thresholdFactor = double.Parse(args[3].Trim());

                DateTime dt = DateTime.Now;
                for (int i = 0; i < Global.SlaveCount; i++)
                {
                    Global.CloudStorage.StartSSSPToSlave(i, new StartSSSPMessageWriter(node_count, thresholdFactor));
                    //Global.CloudStorage.ChangeSSSPToSlave(i, new ChangeSSSPMessageWriter(node_count));
                }
                TimeSpan ts = DateTime.Now - dt;
                Console.WriteLine("All Time --- " + " Node_count: " + node_count + " Time: " + ts.TotalMilliseconds.ToString());
            }

            //SSSP.exe -q cellID
            if (args.Length >= 2 && args[0].StartsWith("-q"))
            {
                TrinityConfig.CurrentRunningMode = RunningMode.Client;
                var cell = Global.CloudStorage.LoadSSSPCell(int.Parse(args[1]));
                Console.Write("Current Node's id is {0}, The RankValue is {1}, The neighbours are",
                              cell.CellID, cell.rankValue);

                for (int i = 0; i < cell.neighbors.Count; i++)
                {
                    Console.Write(" " + cell.neighbors[i]);
                }

                Console.WriteLine();
            }

            //SSSP.exe -g node_count

            /*
             * if (args.Length >= 2 && args[0].StartsWith("-g"))
             * {
             *  TrinityConfig.CurrentRunningMode = RunningMode.Client;
             *
             *  Random rand = new Random();
             *  int nodeCount = int.Parse(args[1].Trim());
             *
             *  for (int i = 0; i < nodeCount; i++)
             *  {
             *      HashSet<long> neighbors = new HashSet<long>();
             *      for (int j = 0; j < 10; j++)
             *      {
             *          long neighor = rand.Next(0, nodeCount);
             *          if (neighor != i)
             *          {
             *              neighbors.Add(neighor);
             *          }
             *      }
             *      Global.CloudStorage.SaveSSSPCell(i, rankValue: INIRANK, status: true, neighbors: neighbors.ToList());
             *  }
             * }
             */

            //SSSP.exe -r fileName node_count
            //search in the desktop
            if (args.Length >= 3 && args[0].StartsWith("-r"))
            {
                TrinityConfig.CurrentRunningMode = RunningMode.Client;
                String path = "C:\\Users\\Administrator\\Desktop\\" + args[1];
                loadFile(path, int.Parse(args[2]));
            }

            //SSSP.exe -a fileName node_count
            //search in the desktop
            if (args.Length >= 3 && args[0].StartsWith("-a"))
            {
                TrinityConfig.CurrentRunningMode = RunningMode.Client;
                String path = "C:\\Users\\Administrator\\Desktop\\" + args[1];
                loadFile2(path, int.Parse(args[2]));
            }
        }
Example #5
0
        /*
        static void Main(string[] args)
        {
            //HashSet<long> neighbors = new HashSet<long>();
            //parseFile("C:\\Users\\Administrator\\Desktop\\b.txt");
        }
        */
        static void Main(string[] args)
        {
            if (args.Length >= 1 && args[0].StartsWith("-s"))
            {
                SSSPSlave slave = new SSSPSlave();
                slave.Start(true);
            }

            //SSSP.exe -c node_count iteration_time thresholdFactor
            if (args.Length >= 4 && args[0].StartsWith("-c"))
            {
                TrinityConfig.CurrentRunningMode = RunningMode.Client;

                long node_count = long.Parse(args[1].Trim());
                long iteration_time = long.Parse(args[2].Trim());
                double thresholdFactor = double.Parse(args[3].Trim());

                DateTime dt = DateTime.Now;
                for (int i = 0; i < Global.SlaveCount; i++)
                {
                    Global.CloudStorage.StartSSSPToSlave(i, new StartSSSPMessageWriter(node_count, thresholdFactor));
                    //Global.CloudStorage.ChangeSSSPToSlave(i, new ChangeSSSPMessageWriter(node_count));
                }
                TimeSpan ts = DateTime.Now - dt;
                Console.WriteLine("All Time --- " + " Node_count: " + node_count + " Time: " + ts.TotalMilliseconds.ToString());
            }

            //SSSP.exe -q cellID
            if (args.Length >= 2 && args[0].StartsWith("-q"))
            {
                TrinityConfig.CurrentRunningMode = RunningMode.Client;
                var cell = Global.CloudStorage.LoadSSSPCell(int.Parse(args[1]));
                Console.Write("Current Node's id is {0}, The RankValue is {1}, The neighbours are",
                    cell.CellID, cell.rankValue);

                for (int i = 0; i < cell.neighbors.Count; i++)
                {
                    Console.Write(" " + cell.neighbors[i]);
                }

                Console.WriteLine();

            }

            //SSSP.exe -g node_count
            /*
            if (args.Length >= 2 && args[0].StartsWith("-g"))
            {
                TrinityConfig.CurrentRunningMode = RunningMode.Client;

                Random rand = new Random();
                int nodeCount = int.Parse(args[1].Trim());

                for (int i = 0; i < nodeCount; i++)
                {
                    HashSet<long> neighbors = new HashSet<long>();
                    for (int j = 0; j < 10; j++)
                    {
                        long neighor = rand.Next(0, nodeCount);
                        if (neighor != i)
                        {
                            neighbors.Add(neighor);
                        }
                    }
                    Global.CloudStorage.SaveSSSPCell(i, rankValue: INIRANK, status: true, neighbors: neighbors.ToList());
                }
            }
            */

            //SSSP.exe -r fileName node_count
            //search in the desktop
            if (args.Length >= 3 && args[0].StartsWith("-r"))
            {
                TrinityConfig.CurrentRunningMode = RunningMode.Client;
                String path = "C:\\Users\\Administrator\\Desktop\\" + args[1];
                loadFile(path, int.Parse(args[2]));
            }

            //SSSP.exe -a fileName node_count
            //search in the desktop
            if (args.Length >= 3 && args[0].StartsWith("-a"))
            {
                TrinityConfig.CurrentRunningMode = RunningMode.Client;
                String path = "C:\\Users\\Administrator\\Desktop\\" + args[1];
                loadFile2(path, int.Parse(args[2]));
            }
        }