public ModularityDetection(LinkedList<KeyWord> partKeywords, double[][] correlations, float startDay, float endDay, int window_, String nwtFolder_) throws Exception{
		this.startDay = startDay;
		this.endDay = endDay;
		window = window_;
		nwtFolder = nwtFolder_;
				
		// instantiate structure
		NodeFactory<Node> nodeFactory = new NodeFactory<>(new Node());
		EdgeFactory<Edge<Node>> edgeFactory = new EdgeFactory<>(new Edge<Node>());
		structure = new Structure<>(nodeFactory, edgeFactory);	 
		 System.out.println(" partKeywords.size()" +  partKeywords.size());
                for(int i = 0; i < partKeywords.size()-1; i++){                	                	                	                	                 	 
                    for(int j = i+1; j < partKeywords.size(); j++){                    	 
                        if(correlations[i][j] > 0.0){                        	 
                             //Adding keywords
                             structure.addNode(partKeywords.get(i).getKeyWord());
                             structure.addNode(partKeywords.get(j).getKeyWord());
                             
                             //Adding edges
                             structure.addEdge(new Edge<Node>(structure.getNode(partKeywords.get(i).getKeyWord()),structure.getNode(partKeywords.get(j).getKeyWord()),correlations[i][j]));
                        }
                    }
                }                               
        nodeList = structure.getNodesOrderedByNames();
		System.out.println("[window "+window+"] ["+startDay+","+endDay+"] : Number of nodes: " + structure.getSize());
		System.out.println("[window "+window+"] ["+startDay+","+endDay+"] : Number of edges: " + structure.getNumEdges());

		if(structure.getNumEdges()>0){//IF THERE IS NO EDGE, NO NEED TO PARTITION	
				// instantiate JmodNetwork
				JmodNetwork network = new JmodNetwork(structure);
				JmodSettings settings = JmodSettings.getInstance();
				settings.setUseMovingVertex(false);
				settings.setUseGlobalMovingVertex(false);	
				
				if(Boolean.valueOf(Main.mapParam.get("debugMode"))){			
					// select the datasets to export
					// modularity Q and number of indivisible communities
					settings.setExportBasicDataset(true);
					// export the modules detected to files
					settings.setExportCommunityNetworks(true);
					// specify the file format of the modules detected
					settings.setCommunityNetworkFormat(Structure.TSV);
					// export the original network in GML format with node
					// colors depending on which module a given node belongs to
					settings.setExportColoredCommunities(true);
					// export the community tree (dendrogram)
					settings.setExportCommunityTree(true);
				}
				
				// run modularity detection
				Jmod jmod = new Jmod();		 
				try {
					jmod.runModularityDetection(network);			                
			        events = new LinkedList<>();
					RootCommunity rc = jmod.getRootCommunity();
					System.out.println("[window "+window+"] ["+startDay+","+endDay+"] : There are "+rc.getNumIndivisibleCommunities()+" indivisible communities.");
					arrayCommunities = rc.getIndivisibleCommunities();
			
					//put events in events
					explore(rc,nodeList);
					
			//		for(Community c:arrayCommunities){			
			//		exploreCommunity(c,nodeList);
			//	}		
				} catch (Exception e) {
					// TODO Auto-generated catch block
					//e.printStackTrace();
				}	
				
				if(Boolean.valueOf(Main.mapParam.get("debugMode"))){	
					// set output directory			//create the folder "results"
					String pathRes = nwtFolder+"/results/Jmod/window"+window;
					File fb = new File(pathRes); 
					fb.mkdirs();		
					URI outputDirURI = new URI(pathRes);
					// run modularity detection		
					jmod.setOutputDirectory(outputDirURI);		
					jmod.printResult();
					jmod.exportDataset();
				}		
		
		}			
	}