public Object calculate(GraphModel g) {
        double power = 1;
        try {
            Matrix A = g.getWeightedAdjacencyMatrix();
            EigenvalueDecomposition ed = A.eig();
            double rv[] = ed.getRealEigenvalues();
            double iv[] = ed.getImagEigenvalues();
            double maxrv=0;
            double minrv=1000000;
            for(double value : rv) {
                double tval = Math.abs(value);
                if(maxrv < tval) maxrv=tval;
                if(minrv > tval) minrv=tval;
            }
            double sum = 0;
            double sum_i = 0;
            for(int i=0;i < rv.length;i++)
                sum += Math.pow(Math.abs(rv[i]),power);
            for(int i=0;i < iv.length;i++)
                sum_i +=  Math.abs(iv[i]);

            if (sum_i != 0) {
                sum_i=0;
                Complex num = new Complex(0,0);
                for(int i=0;i < iv.length;i++) {
                    Complex tmp = new Complex(rv[i], iv[i]);
                    tmp.pow(new Complex(power,0));
                    num.plus(tmp);
                }
                return "" + round(num.re(), 3) + " + "
                        + round(num.im(), 3) + "i";
            } else {
                return "" + round(sum, 3);
            }
        } catch (Exception e) {
        }
        return null;
    }