public AffinityMatrix(PrimsMST minSpanningTree){
		TunableParameters parameters = TunableParameters.getInstance();
		int n = parameters.getDataSetSize();
                double sigma = parameters.getSigma();
		//initialize the matrix
		_affinityMatrix = new double[n][n];
                
        // i know it's ridiculous to store n values in n by n matrix
        _diagonalMatrix = new double[n][n];
        
        _nMatrix = new int[n][n];

         int m = parameters.getM();
		 int numberOfThreads = 4;


		ClusterThreadHandler(minSpanningTree.getMST() , m , numberOfThreads );



        
        // calculate affinity matrix
        for(int i = 0; i < n; i++ ) {
            for(int j = 0; j < n; j++ ) {
                _affinityMatrix[i][j] = Math.exp(-(1-((double)_nMatrix[i][j]/m))/sigma);
            }
        }
        
        // calculate diagonal matrix
        for(int i = 0; i < n; i++ ) {
            _diagonalMatrix[i][i] = 0.0;
            for(int j = 0; j < n; j++ ) {
                if( j != i) {
                    _diagonalMatrix[i][j] = 0.0;
                } else {
                    _diagonalMatrix[i][i] += _affinityMatrix[i][j];
                }
            }
        }
                
	}