/// <summary>
        /// Executes the algorithm.
        /// </summary>
        protected override void  RunInternal()
        {
            Result = new double[pivotArray.Length][];

            Node[] nodes = new Node[graph.Nodes.Count];
            graph.Nodes.CopyTo(nodes, 0);
            double[] min = new double[graph.Nodes.Count];
            for (int i = 0; i < min.Length; i++)
            {
                min[i] = Double.PositiveInfinity;
            }
            Node pivot = nodes[0];
            pivotArray[0] = 0;
            for (int i = 0; ; i++) {
                var ssd = new SingleSourceDistances(graph, pivot, directed);
                ssd.Run();
                Result[i] = ssd.Result;
                if (i + 1 < pivotArray.Length)
                {//looking for the next pivot
                    int argmax = 0;
                    for (int j = 0; j < Result[i].Length; j++)
                    {
                        min[j] = Math.Min(min[j], Result[i][j]);
                        if (min[j] > min[argmax])
                            argmax = j;
                    }
                    pivot = nodes[argmax];
                    pivotArray[i + 1] = argmax;
                }
                else
                    break;
            }

        }
        /// <summary>
        /// Executes the algorithm.
        /// </summary>
        protected override void RunInternal()
        {
            this.StartListenToLocalProgress(graph.Nodes.Count);
            Result = new double[graph.Nodes.Count][];
            int i = 0;
            foreach (Node source in graph.Nodes)
            {
                SingleSourceDistances distances = new SingleSourceDistances(graph, source, directed);
                distances.Run();

                Result[i] = distances.Result;
                ++i;

                this.ProgressStep();  // This checks for cancel too.
            }
        }
        /// <summary>
        /// Executes the algorithm.
        /// </summary>
        protected override void RunInternal()
        {
            this.StartListenToLocalProgress(graph.Nodes.Count);
            Result = new double[graph.Nodes.Count][];
            int i = 0;

            foreach (Node source in graph.Nodes)
            {
                SingleSourceDistances distances = new SingleSourceDistances(graph, source);
                distances.Run();

                Result[i] = distances.Result;
                ++i;

                this.ProgressStep();  // This checks for cancel too.
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Executes the algorithm.
        /// </summary>
        protected override void  RunInternal()
        {
            Result = new double[pivotArray.Length][];

            Node[] nodes = new Node[graph.Nodes.Count];
            graph.Nodes.CopyTo(nodes, 0);
            double[] min = new double[graph.Nodes.Count];
            for (int i = 0; i < min.Length; i++)
            {
                min[i] = Double.PositiveInfinity;
            }

            Node pivot = nodes[0];

            pivotArray[0] = 0;
            for (int i = 0; ; i++)
            {
                var ssd = new SingleSourceDistances(graph, pivot, directed);
                ssd.Run();
                Result[i] = ssd.Result;
                if (i + 1 < pivotArray.Length)
                {//looking for the next pivot
                    int argmax = 0;
                    for (int j = 0; j < Result[i].Length; j++)
                    {
                        min[j] = Math.Min(min[j], Result[i][j]);
                        if (min[j] > min[argmax])
                        {
                            argmax = j;
                        }
                    }
                    pivot             = nodes[argmax];
                    pivotArray[i + 1] = argmax;
                }
                else
                {
                    break;
                }
            }
        }