コード例 #1
0
        /**
         * Returns cycles count in the graph which length is equal
         * to the specified 'cycleLength' argument
         * @precondition cycleLength >= 3
         */
        public double calculateCyclesCount(int cyclesLenght)
        {
            /*TextWriter tw = new StreamWriter(@"C:\ComplexNetwork\Progress"
             + cyclesLenght.ToString() + ".txt", true);
             + tw.WriteLine("Execution start time = " + DateTime.Now);
             + tw.Flush();*/
            _cyclesCount     = 0;
            _working_threads = _verticesCount;
            for (int i = 0; i < _verticesCount; ++i)
            {
                _counters[i] = new PivotsCyclesCounter(this, _container, i, cyclesLenght);
                ThreadPool.QueueUserWorkItem(_counters[i].ThreadPoolCallback);
            }
            lock (this)
            {
                while (_working_threads > 0)
                {
                    Monitor.Wait(this);
                }
            }

            /*tw.WriteLine("Execution end time = " + DateTime.Now);
             * tw.Close();*/
            return(_cyclesCount);
        }
コード例 #2
0
 /**
  * Returns cycles count in the graph which length is equal
  * to the specified 'cycleLength' argument
  * @precondition cycleLength >= 3
  */
 public double calculateCyclesCount(int cyclesLenght)
 {
     /*TextWriter tw = new StreamWriter(@"C:\ComplexNetwork\Progress"
         + cyclesLenght.ToString() + ".txt", true);
     tw.WriteLine("Execution start time = " + DateTime.Now);
     tw.Flush();*/
     _cyclesCount = 0;
     _working_threads = _verticesCount;
     for (int i = 0; i < _verticesCount; ++i)
     {
         _counters[i] = new PivotsCyclesCounter(this, _container, i, cyclesLenght);
         ThreadPool.QueueUserWorkItem(_counters[i].ThreadPoolCallback);
     }
     lock (this)
     {
         while (_working_threads > 0)
         {
             Monitor.Wait(this);
         }
     }
     /*tw.WriteLine("Execution end time = " + DateTime.Now);
     tw.Close();*/
     return _cyclesCount;
 }
コード例 #3
0
 public CyclesParallelCounter(NonHierarchicContainer container)
 {
     _container     = container;
     _verticesCount = (int)_container.Size;
     _counters      = new PivotsCyclesCounter[_verticesCount];
 }