public static void E(Topic root) {
		
		ArrayList<SparseMatrix> edges = root.Get_edgeset();
		float[][] prior_eijk = root.clone2df(root.Get_edgeweight());

		
		int ii = prior_eijk.length; // number of edges
		int jj = prior_eijk[0].length; // number of topics

		float[] rho_z = root.clone1df(root.Get_rho_z());
		float[][] thetai = root.clone2df(root.Get_thetai());
		
		// Calculating sum of each edge weight across all topics
		
		
		float[] sum_eij = new float[prior_eijk.length];
		Arrays.fill(sum_eij, 0);
		for (int i = 0; i < ii; i++) {
			for (int j = 0; j < jj; j++) {
				sum_eij[i] = sum_eij[i] + prior_eijk[i][j];
			}
		}
		

		Iterator<SparseMatrix> it = edges.iterator();
		float[] den_Estep = new float[prior_eijk.length];
		
		
		for (int i = 0; i < ii; i++) {
			SparseMatrix curredge = it.next();
			for (int j = 0; j < jj; j++) {
				
				den_Estep[i] = den_Estep[i]
						+ (rho_z[j] * thetai[curredge.getwordid1() - 1][j] * thetai[curredge.getwordid2() - 1][j]);
			}
			//curredge = it.next();
		}

		
		
//		System.out.println("DENOMINATOR"); //Working fine
//		for(int i = 0; i< den_Estep.length; i++){
//			if(den_Estep[i]!=0){
//			System.out.println(den_Estep[i]);
//			}
//			else{
//				System.out.println("WARNING");
//			}
//		}
		
		
		float[][] new_eij = new float[prior_eijk.length][prior_eijk[0].length];
		Iterator<SparseMatrix> it2 = edges.iterator();
		for (int i = 0; i < ii; i++) {
			SparseMatrix curredge = it2.next();
			for (int j = 0; j < jj; j++) {
				new_eij[i][j] = sum_eij[i]
						* ((rho_z[j] * thetai[curredge.getwordid1() - 1][j] * thetai[curredge
								.getwordid2() - 1][j]) / den_Estep[i]);
			}
			
		}

		root.Set_edgewieghtE(new_eij);

	}