Esempio n. 1
0
        public static Vector EigenvectorCentrality(Matrix m)
        {
            Vector v = RandomMatrix.LoadRealUnitVector(m.Rows);

            v.Labels.CopyFrom(m.RowLabels);

            int numIter = Math.Max(Constants.MinimumNumberOfConvergenceSteps, m.Rows);

            while (numIter-- > 0)
            {
                v = m * v;
                v.Normalize();
            }

            for (int i = 0; i < v.Size; ++i)
            {
                v[i] *= 100.0 * Math.Sqrt(2);
            }

            return(v);
        }
Esempio n. 2
0
        public static Vector LoadRealUnitVector(int n)
        {
            Vector v = new Vector(n);
            Algorithms.Iota(v.Labels, 1);
            Algorithms.Fill<double>(v, RNG.RandomFloat);
            v.Normalize();

            return v;
        }