public static void preE(Topic root) {
		
		
		// Fetching the edge set for the topic
		ArrayList<SparseMatrix> getset = root.Get_edgeset();
		
		//System.out.println("Edge size" + getset.size());

		// Fetching the Max word it of the topic
		Integer MaxWordId = root.Get_Maxwordid();

		// Fetching the edge weight across sub topics(children)
		float[][] edgeweight = root.Get_edgeweight();
		int edgeweight_i = root.Get_edgeweight().length;
		int edgeweight_j = root.Get_edgeweight()[0].length; // Number of columns
															// or topics

		// Fetching original rho value (initially set to 0.0)
		float[] rho = root.Get_rho_z();
		for (int j = 0; j < edgeweight_j; j++) {
			for (int i = 0; i < edgeweight_i; i++) {
				rho[j] = rho[j] + edgeweight[i][j];
			}

		}

		// ROOT SETTING RHO : Setting the newly calculated rho values for each subtopic
		root.Set_rho_zM(rho);
		//System.out.println("[EM] rho set");
		// printing edge weight
		// for(int i = 0; i < edgeweight_i; i++){
		// for(int j = 0 ; j < edgeweight_j; j++){
		// System.out.print(edgeweight[i][j] + " ");
		// }
		// System.out.println();
		// }

		 //printing rho array for the present topic's children
//		 for(int f = 0 ; f < rho.length; f++){
//		 System.out.print(rho[f] + " ");
//		 }
		//
		// Calculate theta i for everyword in each subtopic
		float[][] sumthetai = new float[root.Get_thetai().length][root.Get_thetai()[0].length];
		for(int i = 0; i< root.Get_thetai()[0].length; i++ ){
			Arrays.fill(sumthetai[i], 0);
		}
		
		
		
		// System.out.println("rows: " + sumthetai.length);
		// System.out.println("cols: " + sumthetai[0].length);
		//
		Iterator<SparseMatrix> it = getset.iterator();
		int ew = 0;
		
		while (it.hasNext()) {
			SparseMatrix current = it.next();
			
			for (int t = 0; t < sumthetai[0].length; t++) {
				sumthetai[current.getwordid1() - 1][t] = sumthetai[current.getwordid1() - 1][t] + edgeweight[ew][t];
				sumthetai[current.getwordid2() - 1][t] = sumthetai[current.getwordid2() - 1][t] + edgeweight[ew][t];
			}
			ew++;
		}

		// For printing the theta value of each word across the topics
		 int aa = sumthetai.length;
		 int bb = sumthetai[0].length;
		
		 
//		 System.out.println("-------sum theta>>>>>>>-----");
//		 for(int a = 0; a < aa ; a++){
//		 for(int b = 0; b < bb; b++){
//		 System.out.print(sumthetai[a][b] + " ");
//		 }
//		 System.out.println("");
//		 }
		//

		float[][] thetaiEM = new float[sumthetai.length][sumthetai[0].length];
		for (int i = 0; i < sumthetai.length; i++) {
			for (int j = 0; j < sumthetai[0].length; j++) {
				thetaiEM[i][j] = sumthetai[i][j] / rho[j];
			}
		}
		
		
		//System.out.println("Calling thetai set to set the preEM values of theta i");
		root.Set_thetai(thetaiEM);
		
//		int nn = thetaiEM.length;
//		 int mm = thetaiEM[0].length;
//		 System.out.println("-------Theta of each word in each topic-----");
//		 for(int i = 0; i < nn ; i++){
//		 for(int j = 0; j < mm; j++){
//		 System.out.print(thetaiEM[i][j] + " ");
//		 }
//		 System.out.println("");
//		 }
		
		// Creating a Thetai in array format to return to the Build Tree
		// function
		
		//System.out.println("thetai set");
		
		
	}