コード例 #1
0
        /// <summary>
        /// Calculates the eigenvalues of adjacency matrix of the network.
        /// </summary>
        /// <returns>List of eigenvalues.</returns>
        protected List <Double> CalculateEigenValues()
        {
            bool[,] m = Container.GetMatrix();

            EigenValueUtils eg = new EigenValueUtils();

            try
            {
                eigenValues  = eg.CalculateEigenValue(m);
                calledEigens = true;
                return(eigenValues);
            }
            catch (SystemException)
            {
                return(new List <double>());
            }
        }
コード例 #2
0
        /// <summary>
        /// Calculates distances between eigenvalues.
        /// </summary>
        /// <returns>(distance, count) pairs.</returns>
        protected SortedDictionary <Double, Double> CalculateEigenDistanceDistribution()
        {
            bool[,] m = Container.GetMatrix();

            EigenValueUtils eg = new EigenValueUtils();

            try
            {
                if (!calledEigens)
                {
                    eg.CalculateEigenValue(m);
                }

                return(eg.CalcEigenValuesDist(eigenValues));
            }
            catch (SystemException)
            {
                return(new SortedDictionary <Double, Double>());
            }
        }
コード例 #3
0
        /// <summary>
        /// Calculates the eigenvalues of Laplacian matrix of adjacency matrix of the network.
        /// </summary>
        /// <returns>List of eigenvalues of Laplacian matrix.</returns>
        protected List <Double> CalculateLaplacianEigenValues()
        {
            BitArray[] m    = Container.GetMatrix();
            int        size = m.Length;

            double[,] lm = new double[size, size];
            for (int i = 0; i < size; ++i)
            {
                int connection_count = 0;
                for (int j = 0; j < size; ++j)
                {
                    if (i == j)
                    {
                        continue;
                    }
                    if (m[i][j])
                    {
                        lm[i, j] = -1;
                        ++connection_count;
                    }
                    else
                    {
                        lm[i, j] = 0;
                    }
                }
                lm[i, i] = connection_count;
            }

            EigenValueUtils eg = new EigenValueUtils();

            try
            {
                return(eg.CalculateEigenValue(lm));
            }
            catch (SystemException)
            {
                return(new List <double>());
            }
        }
コード例 #4
0
        protected List <Double> CalculateLaplacianEigenValues()
        {
            bool[,] m    = Container.GetMatrix();
            double[,] lm = new double[m.GetLength(0), m.GetLength(1)];
            for (int i = 0; i < m.GetLength(0); ++i)
            {
                int connection_count = 0;
                for (int j = 0; j < m.GetLength(1); ++j)
                {
                    if (i == j)
                    {
                        continue;
                    }
                    if (m[i, j])
                    {
                        lm[i, j] = -1;
                        ++connection_count;
                    }
                    else
                    {
                        lm[i, j] = 0;
                    }
                }
                lm[i, i] = connection_count;
            }

            EigenValueUtils eg = new EigenValueUtils();

            try
            {
                return(eg.CalculateEigenValue(lm));
            }
            catch (SystemException)
            {
                return(new List <double>());
            }
        }