Преглед на файлове

derniere version de paradevs-tests

totofeh преди 9 години
родител
ревизия
a813e71b64

+ 110 - 21
src/tests/boost_graph/file_generator.cpp

@@ -27,6 +27,7 @@
 #include <boost/format.hpp>
 #include <fstream>
 
+//#include <tests/boost_graph/partitioning/graph_build.hpp>
 #include <tests/boost_graph/graph_generator.hpp>
 #include <tests/boost_graph/graph_partitioning.hpp>
 
@@ -34,17 +35,82 @@ using namespace paradevs::tests::boost_graph;
 
 int main()
 {
-    std::vector < int > levels = {/*5,4,2,*/ 2  };
-    int nbr_sommets = 10;
-    int sources = nbr_sommets/100*1;
-
-    RandomGraphGenerator generator(nbr_sommets, levels, sources, 2, 3);
-
-    PartitioningGraphBuilder graph_builder(2,
-                                           "gggp_pond",
-                                           1,
-                                           true,
-                                           generator);
+	srand((unsigned)time(NULL));
+	/** Grid **/
+	/*int side = floor(sqrt(4900));
+	std::vector<std::pair<int,int>> vertex_selection;
+    std::pair<int,int> tmp;
+    tmp.first = 0;
+	tmp.second = 3;
+    vertex_selection.push_back(tmp);
+    Entiers weight_vertex;
+    weight_vertex.push_back(1);
+    const char *texte = "../../sortie_graphe/tests_grid.txt";
+    RandomGridGraphGenerator generator(side, vertex_selection, 
+									weight_vertex, texte, true);*/
+									
+	/** Tree **/
+	/*int nbr_sommets = 20000;
+	int sources = nbr_sommets/100*1; 
+	Entiers levels = {5,4,3,2};
+	//Text_generator_graph("file/data_base/linked/linked_10000.txt", &gtmp);
+	RandomGraphGenerator generator(nbr_sommets, levels, sources, 2, 3);*/
+	
+	/** Linked **/
+	//OrientedGraph gtmp;
+	int nbr_sommets = 10000;
+	int nbr_couches = 60;
+	RandomLinkedGraphGenerator generator(nbr_sommets, nbr_couches, 2, 3);
+	//generator.generate(gtmp);
+	//Text_generator_graph("file/data_base/linked/linked_10000.txt", &gtmp);
+	
+	//ArtificialGraphGenerator generator(38);
+	
+	OrientedGraph::vertex_iterator vertexIt, vertexEnd;
+	
+	/*UnorientedGraph gi;
+	OrientedGraph go;
+	generator.generate(go);
+	std::ofstream flat("file/data_base/linked/flat.tgf");
+	std::map < int, int > indexs;
+	int k1 = 1;
+
+	boost::tie(vertexIt, vertexEnd) = boost::vertices(go);
+	for (; vertexIt != vertexEnd; ++vertexIt) {
+		indexs[go[*vertexIt]._index] = k1;
+		switch (go[*vertexIt]._type) {
+		case TOP_PIXEL:
+			flat << "top " << std::endl;
+			break;
+		case NORMAL_PIXEL:
+			flat << "normal " << std::endl;
+			break;
+		};
+		++k1;
+	}
+	boost::tie(vertexIt, vertexEnd) = boost::vertices(go);
+	for (; vertexIt != vertexEnd; ++vertexIt)
+	{
+		OrientedGraph::adjacency_iterator neighbourIt, neighbourEnd;
+
+		boost::tie(neighbourIt, neighbourEnd) =
+			boost::adjacent_vertices(*vertexIt, go);
+		for (; neighbourIt != neighbourEnd; ++neighbourIt) {
+			int a = *vertexIt + 1;
+			int b = *neighbourIt + 1
+
+			flat << a << " " << b << " 0 0" << std::endl;
+		}
+	}*/
+
+	/**Liste des méthodes possible : 
+	 * gggp
+	 * ggp
+	 * rand
+	 **/
+    PartitioningGraphBuilder graph_builder(2, "gggp", 200,
+                                           false, generator);
+                                           
     OrientedGraphs graphs;
     InputEdgeList  input_edges;
     OutputEdgeList output_edges;
@@ -52,15 +118,31 @@ int main()
 
     graph_builder.build(graphs, input_edges, output_edges,
                         parent_connections);
+    
+    /*std::vector<const char*> name;
+    name.push_back("../../sortie_graphe/Tests/Graphes/Multiniveau/txt/partie_0.txt");
+    name.push_back("../../sortie_graphe/Tests/Graphes/Multiniveau/txt/partie_1.txt");
+    name.push_back("../../sortie_graphe/Tests/Graphes/Multiniveau/txt/partie_2.txt");
+    name.push_back("../../sortie_graphe/Tests/Graphes/Multiniveau/txt/partie_3.txt");
+    name.push_back("../../sortie_graphe/Tests/Graphes/Multiniveau/txt/partie_4.txt");
+    name.push_back("../../sortie_graphe/Tests/Graphes/Multiniveau/txt/partie_5.txt");
+    name.push_back("../../sortie_graphe/Tests/Graphes/Multiniveau/txt/partie_6.txt");
+    name.push_back("../../sortie_graphe/Tests/Graphes/Multiniveau/txt/partie_7.txt");
+    name.push_back("../../sortie_graphe/Tests/Graphes/Multiniveau/txt/partie_8.txt");
+    name.push_back("../../sortie_graphe/Tests/Graphes/Multiniveau/txt/partie_9.txt");
+    name.push_back("../../sortie_graphe/Tests/Graphes/Multiniveau/txt/partie_10.txt");*/
 
     for (unsigned int i = 0; i < graphs.size(); ++i) {
         OrientedGraph& g = graphs[i];
         Edges& inputs = input_edges[i];
         Edges& outputs = output_edges[i];
         std::map < int, int > indexes;
-        std::ofstream f((boost::format("S%1%.tfg") % i).str());
+        
+        //std::cout<<num_vertices(graphs[i])<<std::endl;
+        //Plot_OrientedGraph(&graphs[i],name.at(i));
+        std::ofstream f((boost::format("file/data_base/linked/rand/S%1%.tgf") % i).str());
 
-        OrientedGraph::vertex_iterator vertexIt, vertexEnd;
+       // OrientedGraph::vertex_iterator vertexIt, vertexEnd;
 
         int k = 1;
 
@@ -102,7 +184,7 @@ int main()
 
         // output
         std::vector < int > outs;
-
+		
         for (Edges::const_iterator it = outputs.begin(); it != outputs.end(); ++it) {
             if (std::find(outs.begin(), outs.end(), it->first) == outs.end()) {
                 f << indexes[it->first] << " 0 0 " << it->first << std::endl;
@@ -112,26 +194,33 @@ int main()
         f.close();
     }
 
-    std::ofstream f("ROOT.tfg");
+    std::ofstream f("file/data_base/linked/rand/ROOT.tgf");
 
     for (unsigned int i = 0; i < graphs.size(); ++i) {
         f << "coupled" << std::endl;
     }
     f << "#" << std::endl;
 
-    std::vector < std::pair < int, int > > outs;
+    //std::vector < std::pair < int, int > > outs;
+    std::vector<std::pair<int, int>> Outs;
 
     for (Connections::const_iterator it = parent_connections.begin();
          it != parent_connections.end(); ++it) {
-        const Connection& connection = *it;
-
-        if (std::find(outs.begin(), outs.end(), connection.first) == outs.end()) {
+       const Connection& connection = *it;
+	   std::pair<int, int> tmp_outs; 
+	   tmp_outs.first = connection.first.second;
+	   tmp_outs.second = connection.second.first;		
+       //if (std::find(outs.begin(), outs.end(), connection.) == outs.end()) {
+       if(std::find(Outs.begin(), Outs.end(), tmp_outs) == Outs.end()){
+	   //} else{
             f << connection.first.first << " "
               << connection.second.first << " "
               << connection.first.second << " "
               << connection.first.second << std::endl;
-            outs.push_back(connection.first);
-        }
+            //outs.push_back(connection.second.first);
+            //outs.push_back(connection.second.first);
+            Outs.push_back(tmp_outs);
+		}
     }
 
     f.close();

+ 12 - 7
src/tests/boost_graph/graph_generator.hpp

@@ -57,13 +57,13 @@ public:
 
     virtual void generate(OrientedGraph& go)
     {
-        /*const char *texte = new const char();
-        texte = "enregistrement.txt";
-        Graph_constructor_txt(texte,&go);*/
+        const char *texte = new const char();
+        texte = "file/data_base/tree/tree_20000.txt";
+        Graph_constructor_txt(texte,&go);
        //boost::timer t; 
 	   
-       build_generator_graph(&go, edge_number, source_number, min_neigh,
-                              max_neigh, levels);
+       /* build_generator_graph(&go, edge_number, source_number, min_neigh,
+                              max_neigh, levels);*/
        //double t3 = t.elapsed();
 	   //std::cout << "tmp_gen = " << t3 << std::endl;
     }
@@ -119,8 +119,13 @@ public:
 
     virtual void generate(OrientedGraph& go)
     {
-       build_generator_graph_linked(&go, edge_number, levels , min_neigh,
-                              max_neigh);
+		const char *texte = new const char();
+        //texte = "file/data_base/HO_models.txt";
+        texte = "file/data_base/linked/linked10000.txt";
+        Graph_constructor_txt(texte,&go);
+        
+      //build_generator_graph_linked(&go, edge_number, levels , min_neigh,
+                            //  max_neigh);
     }
 
 private:

+ 7 - 2
src/tests/boost_graph/graph_partitioning.hpp

@@ -55,6 +55,11 @@ public:
 		std::cout<<"**"<<cluster_number<<"**"<<std::endl;
         OrientedGraph go;
         
+        /** Méthode de contraction possible :
+         *  HEM : hem standars amélioré en temps 
+         *  HEM_degree : hem aves suppression de l'aléatoire 
+         *  autre : random_matching
+         *  **/
         std::vector<std::string> parameters = {"HEM", 
 											  partitioning_method_name, 
 											  "diff", "ratio"};
@@ -75,7 +80,7 @@ public:
             graphs = Multiniveau(&go, numeric_parameters,
                                  parameters, edge_partie ,
                                  output_edges, input_edges,
-                                 parent_connections,false , 2);
+                                 parent_connections, true, 2);
         } else {
 			uint nbr_tirage = 10;
 			std::vector<uint> numeric_parameters = {contraction_coef ,
@@ -85,7 +90,7 @@ public:
             graphs = Multiniveau(&go, numeric_parameters,
                                  parameters, edge_partie ,
                                  output_edges, input_edges,
-                                 parent_connections,false , 2);
+                                 parent_connections, true, 2);
         }
 
         // std::cout << "*********************************" << std::endl;

+ 76 - 31
src/tests/boost_graph/partitioning/gggp.cpp

@@ -557,22 +557,12 @@ void Pseudo_random_partitioning(UnorientedGraph *g, EntiersEntiers &Partition,
     }
 }
 
-
-
-EntiersEntiers Random_partitioning(UnorientedGraph *g,
+EntiersEntiers Random_equal_weight_partitioning(UnorientedGraph *g,
                                 uint parts_number)
 {
 	EntiersEntiers Partition;
-	Entiers random_order; //gestion d'un tableau contenant tout les sommets et ranger de façon aléatoire
+	Entiers random_order =  Random_Sort_Vector(num_vertices(*g));
 	uint cpt = 0;
-	for (uint i=0 ; i<num_vertices(*g) ; i++)
-		random_order.push_back(i);
-	for (uint j=0 ; j<num_vertices(*g)-1 ; j++) {
-		int rand_pos = rand()%(num_vertices(*g)-j)+j;
-		int tmp      = random_order.at(j);
-		random_order.at(j) = random_order.at(rand_pos);
-		random_order.at(rand_pos) = tmp;
-	}
 	
 	for(uint j = 0 ; j < parts_number ; j++){
 		Entiers *part = new Entiers();
@@ -593,6 +583,54 @@ EntiersEntiers Random_partitioning(UnorientedGraph *g,
 	return Partition;
 }
 
+EntiersEntiers Random_partitioning(UnorientedGraph *g,
+                                uint parts_number)
+{
+	EntiersEntiers Partition;
+	uint nbr_vertices = num_vertices(*g);
+	Entiers random_order =  Random_Sort_Vector(nbr_vertices);
+	uint cpt = 0;
+	
+	std::vector<int> taille;
+	
+	int tmp_size = nbr_vertices;
+	for(uint i = 0; i < parts_number - 1; i++){
+		int t1;
+		if(parts_number < 10){
+			if(floor(tmp_size*0.5/10) != 0)
+				t1 = rand_fini(floor(tmp_size*0.5/100), floor(tmp_size*(60-10*i/2)/100));
+			else
+				t1 = rand_fini(1, floor(tmp_size*(60-10*i/2)/100));
+		}else{
+			if(floor(tmp_size*0.5/100) != 0)
+				t1 = rand_fini(floor(tmp_size*0.5/100), floor(tmp_size*(60-10*i/4)/100));
+			else
+				t1 = rand_fini(1, floor(tmp_size*(60-10*i/4)/100));
+		}
+		tmp_size -= t1;
+		taille.push_back(t1);	
+	}
+	
+	taille.push_back(tmp_size);
+	
+	for(uint id_size = 0; id_size < taille.size(); id_size ++){
+		Entiers *part = new Entiers();
+		uint cpt_taille = 0;
+		while(cpt_taille < taille.at(id_size)){
+			part->push_back(random_order.at(cpt));
+			cpt_taille++;
+			cpt++;
+		}
+		Partition.push_back(part);
+	}
+
+	for(uint i = 0 ; i < Partition.size() ; i++){
+		sort(Partition.at(i)->begin(),Partition.at(i)->end());
+	}
+
+	return Partition;
+}
+
 void Coarsening_Phase(Base_Graph &baseg, ListEntiersEntiers &liste_corr, 
 					  uint niveau, int nbr_vertex, 
 					  std::string parameter){
@@ -601,6 +639,9 @@ void Coarsening_Phase(Base_Graph &baseg, ListEntiersEntiers &liste_corr,
 	
     while(!stop){
     	if(parameter == "HEM")
+			stop = contraction_HEM(baseg.at(cpt), baseg, 
+									liste_corr, niveau, nbr_vertex);
+		else if(parameter == "HEM_degree")
 			stop = contraction_HEM_degree(baseg.at(cpt), baseg, 
 									liste_corr, niveau, nbr_vertex);
     	else
@@ -608,6 +649,7 @@ void Coarsening_Phase(Base_Graph &baseg, ListEntiersEntiers &liste_corr,
 									liste_corr, niveau, nbr_vertex);
         cpt++;
     }
+    std::cout<<std::endl;
     
 }
 
@@ -627,9 +669,12 @@ EntiersEntiers Partitioning_Phase(const Base_Graph &baseg,
 					  numeric_parameters.at(2), parameters.at(1), 
 					  distance);
     }
-    else
+    else if(parameters.at(1) == "rand")
     	Partition = Random_partitioning(baseg.at(baseg.size()-1),
 										numeric_parameters.at(1));
+	else
+		Partition = Random_equal_weight_partitioning(baseg.at(baseg.size()-1),
+										numeric_parameters.at(1));
 	
 	return Partition;
     
@@ -777,6 +822,7 @@ OrientedGraphs Multiniveau(OrientedGraph *go,
                            bool rec, int distance)
 {   
     boost::timer t;
+    double t1, t2, t3, t4;
     UnorientedGraph *g = new UnorientedGraph();
 	make_unoriented_graph(*go, *g); 
     Base_Graph baseg;
@@ -785,10 +831,9 @@ OrientedGraphs Multiniveau(OrientedGraph *go,
     OrientedGraphs Graphes;
     int val_cpt = num_vertices(*g);
     bool time = true;
-    double t1, t2, t3, t4;
     
-    if(numeric_parameters.at(0) != val_cpt && parameters.at(1) != "rand"){
-			
+    if(numeric_parameters.at(0) != val_cpt && parameters.at(1) != "rand" && parameters.at(1) != "rande"){
+		
 		Coarsening_Phase(baseg, liste_corr, numeric_parameters.at(0), val_cpt, parameters.at(0));
 	    
 	    if(rec){
@@ -838,8 +883,13 @@ OrientedGraphs Multiniveau(OrientedGraph *go,
 			std::cout << "A : " << (t4 - t3) << " ; "<<std::endl;
 	    }
 	    
+	    for(uint si = 0; si < Partition.size(); si++){
+			std::cout<<Partition.at(si)->size()<<std::endl;
+		}
+		std::cout<<std::endl;
+	    
 	    double ratio_cut = Cut_cluster(Partition, *g, parameters.at(3));
-	    std::cout<<"Coût de la fonction objectif : "<<ratio_cut<<std::endl;
+	    std::cout<<"Ratio : "<<ratio_cut<<std::endl;
 		
 		Graphes = Graph_Partition(Partition, go, g, outputedgelist,
 	                              inputedgelist, connections);
@@ -863,8 +913,13 @@ OrientedGraphs Multiniveau(OrientedGraph *go,
 			std::cout << "P : " << t1 << " ; "<<std::endl;
 	    }
 	    
-	    double ratio_cut = Cut_cluster(Partition, *g, parameters.at(3));
-	    std::cout<<"Coût de la fonction objectif : "<<ratio_cut<<std::endl;
+	    for(uint si = 0; si < Partition.size(); si++){
+			std::cout<<Partition.at(si)->size()<<std::endl;
+		}
+		std::cout<<std::endl;
+	    
+	    double ratio_cut = Cut_cluster(Partition, *copie_g, parameters.at(3));
+	    std::cout<<"Ratio : "<<ratio_cut<<std::endl;
 			
 		Graphes = Graph_Partition(Partition, go, copie_g, 
 								  outputedgelist, inputedgelist,
@@ -897,8 +952,6 @@ OrientedGraphs Multiniveau(OrientedGraph *go,
         *it = NULL;
     }
     
-    //double t5 = t.elapsed();
-    //std::cout << "Devs : " << (t5 - t4)<<std::endl;
     return Graphes;
 }
 
@@ -910,17 +963,9 @@ void Optimisation_method_neighbour(UnorientedGraph *g,
 	/*Initialisation des parametres*/
 	Entiers *part2_cons = new Entiers();
 	Entiers *part_cour_cons = new Entiers();
-	Entiers Random_list_vertices;
 	double cut = 1000000000.;
-
-	for (uint i=0 ; i<Partition.at(index_partition)->size() ; i++)
-		Random_list_vertices.push_back(i);
-	for (uint j=0 ; j<Partition.at(index_partition)->size()-1 ; j++) {
-		uint rand_pos = rand()%(Partition.at(index_partition)->size()-j)+j;
-		uint tmp      = Random_list_vertices[j];
-		Random_list_vertices[j] = Random_list_vertices[rand_pos];
-		Random_list_vertices[rand_pos] = tmp;
-	}
+	
+	Entiers Random_list_vertices =  Random_Sort_Vector(Partition.at(index_partition)->size());
 		
 	if(Partition.at(index_partition)->size()< nbr_tirage)
 		nbr_tirage = Partition.at(index_partition)->size();

+ 3 - 0
src/tests/boost_graph/partitioning/gggp.hpp

@@ -58,6 +58,9 @@ void Pseudo_random_partitioning(UnorientedGraph *g,
 							EntiersEntiers &Partition,
                             uint nbr_parties);
 
+EntiersEntiers Random_equal_weight_partitioning(UnorientedGraph *g,
+                            uint parts_number);
+                            
 EntiersEntiers Random_partitioning(UnorientedGraph *g,
                             uint parts_number);
 

+ 196 - 102
src/tests/boost_graph/partitioning/graph_build.cpp

@@ -47,35 +47,35 @@ void build_graph(OrientedGraph& og, unsigned int edge_number)
 		vertex_to v9 = boost::add_vertex(og);
 		vertex_to v10 = boost::add_vertex(og);
 
-		add_edge(v1, v0, EdgeProperties(2.), og);
-		add_edge(v2, v0, EdgeProperties(1.5), og);
-		add_edge(v3, v0, EdgeProperties(1.5), og);
-		add_edge(v1, v2, EdgeProperties(3.), og);
-		add_edge(v4, v1, EdgeProperties(3.), og);
-		add_edge(v5, v1, EdgeProperties(3.), og);
-		add_edge(v6, v1, EdgeProperties(3.), og);
-		add_edge(v6, v2, EdgeProperties(2.), og);
+		add_edge(v1, v0, EdgeProperties(1), og);
+		add_edge(v2, v0, EdgeProperties(1), og);
+		add_edge(v3, v0, EdgeProperties(1), og);
+		add_edge(v1, v2, EdgeProperties(1), og);
+		add_edge(v4, v1, EdgeProperties(1.), og);
+		add_edge(v5, v1, EdgeProperties(1.), og);
+		add_edge(v6, v1, EdgeProperties(1.), og);
+		add_edge(v6, v2, EdgeProperties(1.), og);
 		add_edge(v2, v3, EdgeProperties(1.), og);
 		add_edge(v9, v3, EdgeProperties(1.), og);
 		add_edge(v10, v3, EdgeProperties(1.), og);
-		add_edge(v4, v5, EdgeProperties(1.5), og);
-		add_edge(v5, v6, EdgeProperties(1.5), og);
+		add_edge(v4, v5, EdgeProperties(1), og);
+		add_edge(v5, v6, EdgeProperties(1), og);
 		add_edge(v7, v4, EdgeProperties(1.), og);
 		add_edge(v8, v4, EdgeProperties(1.), og);
-		add_edge(v7, v8, EdgeProperties(1.5), og);
-		add_edge(v9, v10, EdgeProperties(2.), og);
+		add_edge(v7, v8, EdgeProperties(1), og);
+		add_edge(v9, v10, EdgeProperties(1.), og);
 
-		og[v6] = VertexProperties(6, 1.5, NORMAL_PIXEL);
+		og[v6] = VertexProperties(6, 1, NORMAL_PIXEL);
 		og[v8] = VertexProperties(8, 1., NORMAL_PIXEL);
-		og[v10] = VertexProperties(10, 1.5, NORMAL_PIXEL);
-		og[v0] = VertexProperties(0, 3, NORMAL_PIXEL);
-		og[v1] = VertexProperties(1, 2, NORMAL_PIXEL);
-		og[v2] = VertexProperties(2, 2, NORMAL_PIXEL);
-		og[v3] = VertexProperties(3, 2, NORMAL_PIXEL);
-		og[v4] = VertexProperties(4, 1.5, NORMAL_PIXEL);
-		og[v5] = VertexProperties(5, 1.5, NORMAL_PIXEL);
+		og[v10] = VertexProperties(10, 1, NORMAL_PIXEL);
+		og[v0] = VertexProperties(0, 1, NORMAL_PIXEL);
+		og[v1] = VertexProperties(1, 1, NORMAL_PIXEL);
+		og[v2] = VertexProperties(2, 1, NORMAL_PIXEL);
+		og[v3] = VertexProperties(3, 1, NORMAL_PIXEL);
+		og[v4] = VertexProperties(4, 1, NORMAL_PIXEL);
+		og[v5] = VertexProperties(5, 1, NORMAL_PIXEL);
 		og[v7] = VertexProperties(7, 1., TOP_PIXEL);
-		og[v9] = VertexProperties(9, 1.5, TOP_PIXEL);
+		og[v9] = VertexProperties(9, 1., TOP_PIXEL);
 		
 	} else if(edge_number == 38){
 		
@@ -182,45 +182,58 @@ void build_graph(OrientedGraph& og, unsigned int edge_number)
 		add_edge(v36, v37, EdgeProperties(1.), og);
 		add_edge(v36, v33, EdgeProperties(1.), og);
 		add_edge(v37, v33, EdgeProperties(1.), og);
-
-		og[v6] = VertexProperties(6, 2.5, NORMAL_PIXEL);
-		og[v8] = VertexProperties(8, 2., NORMAL_PIXEL);
-		og[v10] = VertexProperties(10, 2.5, NORMAL_PIXEL);
-		og[v0] = VertexProperties(0, 4, NORMAL_PIXEL);
-		og[v1] = VertexProperties(1, 3, NORMAL_PIXEL);
-		og[v2] = VertexProperties(2, 3, NORMAL_PIXEL);
-		og[v3] = VertexProperties(3, 3, NORMAL_PIXEL);
-		og[v4] = VertexProperties(4, 2.5, NORMAL_PIXEL);
-		og[v5] = VertexProperties(5, 2.5, NORMAL_PIXEL);
-		og[v7] = VertexProperties(7, 2., NORMAL_PIXEL);
-		og[v9] = VertexProperties(9, 2.5, TOP_PIXEL);
-		og[v11] = VertexProperties(11, 2, NORMAL_PIXEL);
-		og[v12] = VertexProperties(12, 1.5, NORMAL_PIXEL);
-		og[v13] = VertexProperties(13, 1.5, NORMAL_PIXEL);
+		
+		add_edge(v4, v0, EdgeProperties(1.), og);
+		add_edge(v9, v2, EdgeProperties(1.), og);
+		add_edge(v28, v24, EdgeProperties(1.), og);
+		add_edge(v28, v31, EdgeProperties(1.), og);
+		add_edge(v33, v3, EdgeProperties(1.), og);
+		add_edge(v33, v0, EdgeProperties(1.), og);
+		add_edge(v36, v3, EdgeProperties(1.), og);
+		add_edge(v17, v13, EdgeProperties(1.), og);
+		add_edge(v17, v7, EdgeProperties(1.), og);
+		add_edge(v21, v23, EdgeProperties(1.), og);
+		add_edge(v23, v20, EdgeProperties(1.), og);
+		add_edge(v26, v4, EdgeProperties(1.), og);
+		
+		og[v6] = VertexProperties(6, 1, NORMAL_PIXEL);
+		og[v8] = VertexProperties(8, 1, NORMAL_PIXEL);
+		og[v10] = VertexProperties(10, 1, NORMAL_PIXEL);
+		og[v0] = VertexProperties(0, 1, NORMAL_PIXEL);
+		og[v1] = VertexProperties(1, 1, NORMAL_PIXEL);
+		og[v2] = VertexProperties(2, 1, NORMAL_PIXEL);
+		og[v3] = VertexProperties(3, 1, NORMAL_PIXEL);
+		og[v4] = VertexProperties(4, 1, NORMAL_PIXEL);
+		og[v5] = VertexProperties(5, 1, NORMAL_PIXEL);
+		og[v7] = VertexProperties(7, 1, NORMAL_PIXEL);
+		og[v9] = VertexProperties(9, 1, TOP_PIXEL);
+		og[v11] = VertexProperties(11, 1, NORMAL_PIXEL);
+		og[v12] = VertexProperties(12, 1, NORMAL_PIXEL);
+		og[v13] = VertexProperties(13, 1, NORMAL_PIXEL);
 		og[v14] = VertexProperties(14, 1, TOP_PIXEL);
 		og[v15] = VertexProperties(15, 1, NORMAL_PIXEL);
 		og[v16] = VertexProperties(16, 1, NORMAL_PIXEL);
 		og[v17] = VertexProperties(17, 1, NORMAL_PIXEL);
-		og[v18] = VertexProperties(18, 1.5, TOP_PIXEL);
-		og[v19] = VertexProperties(19, 1.5, NORMAL_PIXEL);
-		og[v20] = VertexProperties(20, 1.5, NORMAL_PIXEL);
+		og[v18] = VertexProperties(18, 1, TOP_PIXEL);
+		og[v19] = VertexProperties(19, 1, NORMAL_PIXEL);
+		og[v20] = VertexProperties(20, 1, NORMAL_PIXEL);
 		og[v21] = VertexProperties(21, 1, TOP_PIXEL);
 		og[v22] = VertexProperties(22, 1, NORMAL_PIXEL);
 		og[v23] = VertexProperties(23, 1, NORMAL_PIXEL);
-		og[v24] = VertexProperties(24, 2, NORMAL_PIXEL);
-		og[v25] = VertexProperties(25, 2, NORMAL_PIXEL);
-		og[v26] = VertexProperties(26, 1.5, TOP_PIXEL);
-		og[v27] = VertexProperties(27, 1.5, NORMAL_PIXEL);
-		og[v28] = VertexProperties(28, 1.5, NORMAL_PIXEL);
+		og[v24] = VertexProperties(24, 1, NORMAL_PIXEL);
+		og[v25] = VertexProperties(25, 1, NORMAL_PIXEL);
+		og[v26] = VertexProperties(26, 1, TOP_PIXEL);
+		og[v27] = VertexProperties(27, 1, NORMAL_PIXEL);
+		og[v28] = VertexProperties(28, 1, NORMAL_PIXEL);
 		og[v29] = VertexProperties(29, 1, TOP_PIXEL);
 		og[v30] = VertexProperties(30, 1, TOP_PIXEL);
-		og[v31] = VertexProperties(31, 2, NORMAL_PIXEL);
-		og[v32] = VertexProperties(32, 2, NORMAL_PIXEL);
-		og[v33] = VertexProperties(33, 2, NORMAL_PIXEL);
-		og[v34] = VertexProperties(34, 1.5, TOP_PIXEL);
-		og[v35] = VertexProperties(35, 1.5, NORMAL_PIXEL);
-		og[v36] = VertexProperties(36, 1.5, TOP_PIXEL);
-		og[v37] = VertexProperties(37, 1.5, NORMAL_PIXEL);
+		og[v31] = VertexProperties(31, 1, NORMAL_PIXEL);
+		og[v32] = VertexProperties(32, 1, NORMAL_PIXEL);
+		og[v33] = VertexProperties(33, 1, NORMAL_PIXEL);
+		og[v34] = VertexProperties(34, 1, TOP_PIXEL);
+		og[v35] = VertexProperties(35, 1, NORMAL_PIXEL);
+		og[v36] = VertexProperties(36, 1, TOP_PIXEL);
+		og[v37] = VertexProperties(37, 1, NORMAL_PIXEL);
 		
 	}else{
 		std::cout<<"Le type de artificiel graphe choisi n'existe pas ! "<<std::endl;
@@ -238,54 +251,94 @@ void modify_file_paths(std::string& absolutePath,
 
 void build_graph_cyclique(OrientedGraph& og)
 {
-		vertex_to v0 = boost::add_vertex(og);
-		vertex_to v1 = boost::add_vertex(og);
-		vertex_to v2 = boost::add_vertex(og);
-		vertex_to v3 = boost::add_vertex(og);
-		vertex_to v4 = boost::add_vertex(og);
-		vertex_to v5 = boost::add_vertex(og);
-		vertex_to v6 = boost::add_vertex(og);
-		vertex_to v7 = boost::add_vertex(og);
-		vertex_to v8 = boost::add_vertex(og);
-		vertex_to v9 = boost::add_vertex(og);
-		vertex_to v10 = boost::add_vertex(og);
-
-		add_edge(v0, v1, EdgeProperties(1.), og);
-		add_edge(v0, v2, EdgeProperties(1.), og);
-		add_edge(v0, v3, EdgeProperties(1.), og);
-		add_edge(v1, v3, EdgeProperties(1.), og);
-		add_edge(v2, v1, EdgeProperties(1.), og);
-		add_edge(v2, v3, EdgeProperties(1.), og);
-		add_edge(v2, v4, EdgeProperties(1.), og);
-		add_edge(v2, v5, EdgeProperties(1.), og);
-		add_edge(v2, v7, EdgeProperties(1.), og);
-		add_edge(v2, v9, EdgeProperties(1.), og);
-		add_edge(v3, v4, EdgeProperties(1.), og);
-		add_edge(v3, v5, EdgeProperties(1.), og);
-		add_edge(v3, v7, EdgeProperties(1.), og);
-		add_edge(v3, v9, EdgeProperties(1.), og);
-		add_edge(v4, v6, EdgeProperties(1.), og);
-		add_edge(v5, v4, EdgeProperties(1.), og);
-		add_edge(v5, v6, EdgeProperties(1.), og);
-		add_edge(v6, v7, EdgeProperties(1.), og);
-		add_edge(v7, v8, EdgeProperties(1.), og);
-		add_edge(v7, v10, EdgeProperties(1.), og);
-		add_edge(v8, v9, EdgeProperties(1.), og);
-		add_edge(v8, v10, EdgeProperties(1.), og);
-		add_edge(v9, v10, EdgeProperties(1.), og);
-		add_edge(v10, v0, EdgeProperties(1.), og);
+	vertex_to v0 = boost::add_vertex(og);
+	vertex_to v1 = boost::add_vertex(og);
+	vertex_to v2 = boost::add_vertex(og);
+	vertex_to v3 = boost::add_vertex(og);
+	vertex_to v4 = boost::add_vertex(og);
+	vertex_to v5 = boost::add_vertex(og);
+	vertex_to v6 = boost::add_vertex(og);
+	vertex_to v7 = boost::add_vertex(og);
+	vertex_to v8 = boost::add_vertex(og);
+	vertex_to v9 = boost::add_vertex(og);
+	vertex_to v10 = boost::add_vertex(og);
+
+	add_edge(v0, v1, EdgeProperties(1.), og);
+	add_edge(v0, v2, EdgeProperties(1.), og);
+	add_edge(v0, v3, EdgeProperties(1.), og);
+	add_edge(v1, v3, EdgeProperties(1.), og);
+	add_edge(v2, v1, EdgeProperties(1.), og);
+	add_edge(v2, v3, EdgeProperties(1.), og);
+	add_edge(v2, v4, EdgeProperties(1.), og);
+	add_edge(v2, v5, EdgeProperties(1.), og);
+	add_edge(v2, v7, EdgeProperties(1.), og);
+	add_edge(v2, v9, EdgeProperties(1.), og);
+	add_edge(v3, v4, EdgeProperties(1.), og);
+	add_edge(v3, v5, EdgeProperties(1.), og);
+	add_edge(v3, v7, EdgeProperties(1.), og);
+	add_edge(v3, v9, EdgeProperties(1.), og);
+	add_edge(v4, v6, EdgeProperties(1.), og);
+	add_edge(v5, v4, EdgeProperties(1.), og);
+	add_edge(v5, v6, EdgeProperties(1.), og);
+	add_edge(v6, v7, EdgeProperties(1.), og);
+	add_edge(v7, v8, EdgeProperties(1.), og);
+	add_edge(v7, v10, EdgeProperties(1.), og);
+	add_edge(v8, v9, EdgeProperties(1.), og);
+	add_edge(v8, v10, EdgeProperties(1.), og);
+	add_edge(v9, v10, EdgeProperties(1.), og);
+	add_edge(v10, v0, EdgeProperties(1.), og);
+
+	og[v6] = VertexProperties(6, 1, NORMAL_PIXEL);
+	og[v8] = VertexProperties(8, 1, NORMAL_PIXEL);
+	og[v10] = VertexProperties(10, 1, NORMAL_PIXEL);
+	og[v0] = VertexProperties(0, 1, NORMAL_PIXEL);
+	og[v1] = VertexProperties(1, 1, NORMAL_PIXEL);
+	og[v2] = VertexProperties(2, 1, NORMAL_PIXEL);
+	og[v3] = VertexProperties(3, 1, NORMAL_PIXEL);
+	og[v4] = VertexProperties(4, 1, NORMAL_PIXEL);
+	og[v5] = VertexProperties(5, 1, NORMAL_PIXEL);
+	og[v7] = VertexProperties(7, 1, NORMAL_PIXEL);
+	og[v9] = VertexProperties(9, 1, NORMAL_PIXEL);
+}
 
-		og[v6] = VertexProperties(6, 1, NORMAL_PIXEL);
-		og[v8] = VertexProperties(8, 1, NORMAL_PIXEL);
-		og[v10] = VertexProperties(10, 1, NORMAL_PIXEL);
-		og[v0] = VertexProperties(0, 1, NORMAL_PIXEL);
-		og[v1] = VertexProperties(1, 1, NORMAL_PIXEL);
-		og[v2] = VertexProperties(2, 1, NORMAL_PIXEL);
-		og[v3] = VertexProperties(3, 1, NORMAL_PIXEL);
-		og[v4] = VertexProperties(4, 1, NORMAL_PIXEL);
-		og[v5] = VertexProperties(5, 1, NORMAL_PIXEL);
-		og[v7] = VertexProperties(7, 1, NORMAL_PIXEL);
-		og[v9] = VertexProperties(9, 1, NORMAL_PIXEL);
+void build_example_linked9(OrientedGraph& og)
+{
+	vertex_to v0 = boost::add_vertex(og);
+	vertex_to v1 = boost::add_vertex(og);
+	vertex_to v2 = boost::add_vertex(og);
+	vertex_to v3 = boost::add_vertex(og);
+	vertex_to v4 = boost::add_vertex(og);
+	vertex_to v5 = boost::add_vertex(og);
+	vertex_to v6 = boost::add_vertex(og);
+	vertex_to v7 = boost::add_vertex(og);
+	vertex_to v8 = boost::add_vertex(og);
+	vertex_to v9 = boost::add_vertex(og);
+	
+	add_edge(v1, v0, EdgeProperties(1.), og);
+	add_edge(v2, v0, EdgeProperties(1.), og);
+	add_edge(v3, v0, EdgeProperties(1.), og);
+	add_edge(v4, v1, EdgeProperties(1.), og);
+	add_edge(v4, v2, EdgeProperties(1.), og);
+	add_edge(v5, v1, EdgeProperties(1.), og);
+	add_edge(v6, v1, EdgeProperties(1.), og);
+	add_edge(v6, v2, EdgeProperties(1.), og);
+	add_edge(v6, v3, EdgeProperties(1.), og);
+	add_edge(v7, v2, EdgeProperties(1.), og);
+	add_edge(v7, v3, EdgeProperties(1.), og);
+	add_edge(v8, v2, EdgeProperties(1.), og);
+	add_edge(v9, v1, EdgeProperties(1.), og);
+	add_edge(v9, v3, EdgeProperties(1.), og);
+	
+	og[v6] = VertexProperties(6, 1, TOP_PIXEL);
+	og[v8] = VertexProperties(8, 1, TOP_PIXEL);
+	og[v0] = VertexProperties(0, 1, NORMAL_PIXEL);
+	og[v1] = VertexProperties(1, 1, NORMAL_PIXEL);
+	og[v2] = VertexProperties(2, 1, NORMAL_PIXEL);
+	og[v3] = VertexProperties(3, 1, NORMAL_PIXEL);
+	og[v4] = VertexProperties(4, 1, TOP_PIXEL);
+	og[v5] = VertexProperties(5, 1, TOP_PIXEL);
+	og[v7] = VertexProperties(7, 1, TOP_PIXEL);
+	og[v9] = VertexProperties(9, 1, TOP_PIXEL);
 }
 /*void build_corsen_graph(OrientedGraph& graph)
 {
@@ -651,6 +704,7 @@ void brhtg_exutoire(OrientedGraph *go,int nbr_vertex,int nbr_v_min, int nbr_v_ma
 
 void build_generator_graph(OrientedGraph *go, int nbr_vertex, int nbr_source, int nbr_v_min, int nbr_v_max,const std::vector<int> &niveau){
 	std::vector<vertex_to> Vertexs;
+	OrientedGraph::in_edge_iterator ei, edge_end;
 
 	int nbr_npb;
 	int nbr_branche = 0;
@@ -669,6 +723,7 @@ void build_generator_graph(OrientedGraph *go, int nbr_vertex, int nbr_source, in
 		}
 		nbr_branche += nbr_tmp;
 	}
+	std::cout<<nbr_branche<<std::endl;
 
 	nbr_npb = nbr_vertex/(nbr_branche);
 
@@ -725,18 +780,29 @@ void build_generator_graph(OrientedGraph *go, int nbr_vertex, int nbr_source, in
 		}
 	}
 	
+	int compteur = 0;
 	for(uint i = 0; i<num_vertices(*go); i++){
-		if(dg_in_vertex_list.at(i) == 0){
+		bool indic = false;
+		for(tie(ei,edge_end) = in_edges(i,*go); ei != edge_end; ++ei){
+			indic = true;
+			break;
+		}
+		if(dg_in_vertex_list.at(i) == 0 || indic == false){
+			compteur++;
 			(*go)[i] = VertexProperties(i, 1, TOP_PIXEL);
 		}else{
 			(*go)[i] = VertexProperties(i, 1, NORMAL_PIXEL);
 		}
+		//std::cout<<(*go)[i]._index<<" "<<indic<<" -> "<<(*go)[i]._type<<std::endl;
 	}
-
+	
+	std::cout<<"Compteur : "<<compteur<<std::endl;
 }
 
 void build_generator_graph_linked(OrientedGraph *go, int nbr_vertex, int nbr_couche, int nbr_v_min, int nbr_v_max){
 	std::vector<vertex_to> Vertexs;
+	OrientedGraph::in_edge_iterator ei, edge_end;
+	
 	for(int i =0; i<nbr_vertex; i++){
 		vertex_to vo = boost::add_vertex(*go);
 		Vertexs.push_back(vo);
@@ -746,7 +812,7 @@ void build_generator_graph_linked(OrientedGraph *go, int nbr_vertex, int nbr_cou
 	int midel_couche = nbr_couche-2;
 	int top_couche;
 	if(nbr_couche>5){
-		top_couche = floor(nbr_vertex/floor(midel_couche/2));
+		top_couche = floor(nbr_vertex/3);//floor(midel_couche/2));
 	}else{
 		top_couche = floor(nbr_vertex/2);
 	}
@@ -912,7 +978,12 @@ void build_generator_graph_linked(OrientedGraph *go, int nbr_vertex, int nbr_cou
 	}
 	
 	for(uint i = 0; i<num_vertices(*go); i++){
-		if(dg_in_vertex_list.at(i) == 0){
+		bool indic = false;
+		for(tie(ei,edge_end) = in_edges(i,*go); ei != edge_end; ++ei){
+			indic = true;
+			break;
+		}
+		if(dg_in_vertex_list.at(i) == 0 || indic == false){
 			(*go)[i] = VertexProperties(i, 1, TOP_PIXEL);
 		}else{
 			(*go)[i] = VertexProperties(i, 1, NORMAL_PIXEL);
@@ -1003,6 +1074,29 @@ void build_graph_grid(OrientedGraph *go, int side, const std::vector<std::pair<i
 	
 }
 
+/*void build_graph_grid_center(OrientedGraph *go, int side, const std::vector<std::pair<int,int>> &vertex_selection, const Entiers &weight_vertex,const char *edge_weight, bool rec){
+	int nbr_vertex = side*side;
+	std::vector<vertex_to> Vertexs;
+	for(int i =0; i<nbr_vertex; i++){
+		vertex_to vo = boost::add_vertex(*go);
+		Vertexs.push_back(vo);
+	}
+	
+	// Ité 0
+	for(uint i = 0; i < 4; i++){
+		boost::add_edge(0, 2 + 2*i ,EdgeProperties(1) , *go);
+	}
+	
+	// Ité 1 
+	
+	for(uint i = 1; i < 9; i++){
+		
+	}
+	
+	
+	
+}*/
+
 /*Vérification de la pondération + vérification des poids de la contraction + vérification de la structure de contraction*/
 
 } } } // namespace paradevs tests boost_graph

+ 1 - 0
src/tests/boost_graph/partitioning/graph_build.hpp

@@ -48,6 +48,7 @@ void build_graph_grid(OrientedGraph *go, int side,
 				const std::vector<std::pair<int,int>> &vertex_selection,
 				const Entiers &weight_vertex, const char *edge_weight, 
 				bool rec);
+void build_example_linked9(OrientedGraph& og);
 				
 //void build_corsen_graph(OrientedGraph& graph);
 

+ 25 - 13
src/tests/boost_graph/partitioning/main.cpp

@@ -48,11 +48,11 @@ int main()
 	/*** Génération du graphe ***/
 	
     OrientedGraph *go = new OrientedGraph();
-    std::string type_graph = "tree";
+    std::string type_graph = "linked";
     std::pair<bool,bool> Spectrale = {false,false};
     
     if(type_graph == "grid"){
-		int side = floor(sqrt(5000));
+		int side = floor(sqrt(100));
 		std::vector<std::pair<int,int>> vertex_selection;
 	    std::pair<int,int> tmp;
 	    tmp.first = 0;
@@ -64,14 +64,23 @@ int main()
 	    build_graph_grid(go, side, vertex_selection, weight_vertex,texte,true);
 	    Plot_OrientedGraph(go,"../../sortie_graphe/Tests/Graphes/Multiniveau/txt/grid_500.txt");
 	}else if (type_graph == "tree"){
-		int nbr_sommets = 5000;
-		int nbr_sources = nbr_sommets/100*1; 
-		Entiers niveau = {5,4,3,2};
-		build_generator_graph(go, nbr_sommets, nbr_sources , 2 , 4 ,niveau);
+		int nbr_sommets = 70;
+		int nbr_sources = 2; 
+		Entiers niveau = {2,2};
+		const char *texte;
+        //texte = "file/data_base/tree/tree_20000.txt";
+		build_generator_graph(go, nbr_sommets, nbr_sources, 2,
+												3, niveau);
+		Plot_OrientedGraph(go,"../../sortie_graphe/Tests/Graphes/Multiniveau/txt/grid_500.txt");
+		//Text_generator_graph(texte, go);
+        //Graph_constructor_txt(texte,go);
 	}else if (type_graph == "linked"){
-		int nbr_sommets = 1000;
-		int nbr_couches = 150;
-		build_generator_graph_linked(go, nbr_sommets, nbr_couches , 2, 3);
+		int nbr_sommets = 10;
+		int nbr_couches = 4;
+		build_example_linked9(*go);
+		//build_generator_graph_linked(go, nbr_sommets, nbr_couches , 2, 3);
+		//Text_generator_graph("file/data_base/linked/linked_50.txt",go);
+		Plot_OrientedGraph(go,"../../sortie_graphe/Tests/Graphes/Multiniveau/txt/grid_500.txt");
 	}else{
 		build_graph(*go, 38);
 	}
@@ -93,10 +102,11 @@ int main()
 	}
 
 	/*** Paramétrage du Multiniveau ***/
-	std::vector<uint> numeric_parameters = {num_vertices(*go)/20, 8, 10};
-	std::vector<std::string> parameters = {"HEM", "rand", "diff", "cut"};
+	std::vector<uint> numeric_parameters = {num_vertices(*go), 4, 10};
+	std::vector<std::string> parameters = {"HEM", "gggp", "diff", "ratio"};
 	
 	uint nbr_tirage = 1;
+
 	
 	for(uint i = 0 ; i < nbr_tirage ; i++){
 		Edges edge_partie;
@@ -111,16 +121,18 @@ int main()
 				Weight_Matrix_Txt(g,"../../Classif_R/Graphe/txt/Mwei.txt");
 				delete g;
 			}
+			
+			std::cout<<"Multiniveau"<<std::endl;
 			OrientedGraphs graphs = Multiniveau(go, numeric_parameters,
 												parameters, edge_partie ,
 												outputedgeslist, inputedgelist,
-												connections,true, i);  	
+												connections,true, 2);  	
 												std::cout<<std::endl;
 		}else{
 			OrientedGraphs graphs = Multiniveau(go, numeric_parameters,
 												parameters, edge_partie ,
 												outputedgeslist, inputedgelist,
-												connections,true, i); 
+												connections,true, 2); 
 												std::cout<<std::endl;
 		}
 	}

+ 86 - 201
src/tests/boost_graph/partitioning/utils.cpp

@@ -286,16 +286,7 @@ void Affinage_equilibrage_charge(UnorientedGraph *g, EntiersEntiers &Partition)
         /*
          * tirage aléatoire des sommets de la partie de poids maximum
          */
-        Entiers random_orders(Partition.at(cpt)->size());
-        for (uint i=0 ; i<Partition.at(cpt)->size() ; i++)
-            random_orders.at(i)=Partition.at(cpt)->at(i);
-
-        for (uint j=0 ; j<Partition.at(cpt)->size()-1 ; j++) {
-            int rand_pos = (rand() % Partition.at(cpt)->size()-j)+j;
-            int tmp = random_orders[j];
-            random_orders[j] = random_orders[rand_pos];
-            random_orders[rand_pos] = tmp;
-        }
+        Entiers random_orders = Random_Sort_Vector(Partition.at(cpt)->size());
 
         /*
          * Si le nombre de sommets d'une partie excéde les 400, on tire au hasar 400 sommets sans remise
@@ -433,17 +424,8 @@ Entiers Neigh_community(UnorientedGraph *g, EntiersEntiers &Partition, int verte
 
 void Affinage_recherche_locale(UnorientedGraph *g, EntiersEntiers &Partition, double &cut, std::string name)
 {
-    Entiers random_orders(num_vertices(*g)); //gestion d'un tableau contenant tout les sommets et ranger de façon aléatoire
-
-    for (uint i=0 ; i<num_vertices(*g) ; i++)
-        random_orders.at(i)=i;
+    Entiers random_orders = Random_Sort_Vector(num_vertices(*g)); //gestion d'un tableau contenant tout les sommets et ranger de façon aléatoire
 
-    for (uint j=0 ; j<num_vertices(*g)-1 ; j++) {
-        int rand_pos = (rand() % num_vertices(*g)-j)+j;
-        int tmp = random_orders[j];
-        random_orders[j] = random_orders[rand_pos];
-        random_orders[rand_pos] = tmp;
-    }
     uint size = random_orders.size();
 
     if(num_vertices(*g)>500)
@@ -671,36 +653,12 @@ void Modif_fonction_Gain_Cut(EntiersEntiers &Partition,UnorientedGraph *g, Entie
 			new_partition.push_back(tmp);
 		}
 
-		/*std::cout<<"Avant Modification partition"<<std::endl;
-		std::cout<<"************"<<std::endl;
-		for(uint t = 0; t< new_partition.size() ; t++)
-				{
-					for(uint j = 0 ; j<new_partition.at(t)->size() ; j++)
-					{
-						std::cout<<new_partition.at(t)->at(j)<<std::endl;
-					}
-					std::cout<<"\n"<<std::endl;
-				}
-		std::cout<<"************"<<std::endl;*/
-
 
 		new_partition.at(community.at(i))->push_back(val);
 		suprim_val(*new_partition.at(In_community_dichotomie(Partition,val)),val);
 		std::sort(new_partition.at(community.at(i))->begin(),
                     new_partition.at(community.at(i))->end());
 
-		/*std::cout<<"Modification partition"<<std::endl;
-		std::cout<<"************"<<std::endl;
-		for(uint t= 0; t< new_partition.size() ; t++)
-		{
-			for(uint j = 0 ; j<new_partition.at(t)->size() ; j++)
-			{
-				std::cout<<new_partition.at(t)->at(j)<<std::endl;
-			}
-			std::cout<<"\n"<<std::endl;
-		}
-		std::cout<<"************"<<std::endl;*/
-
 		double coupe = Cut_cluster(new_partition,*g,name);
 
 		//std::cout<<"cout de coupe : "<<coupe<<std::endl;
@@ -727,8 +685,7 @@ void Modif_fonction_Gain_Cut(EntiersEntiers &Partition,UnorientedGraph *g, Entie
 
 bool contraction_HEM(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEntiers &liste_corr, int val_reduc, int &val_cpt){
 	UnorientedGraph *gtmp = new UnorientedGraph();
-	boost::copy_graph(*g, *gtmp);
-	Entiers Random_list_vertices;//, Index_Vertex; // Initialisation du tableau de sommets rangés aléatoirements
+	boost::copy_graph(*g, *gtmp);//, Index_Vertex; // Initialisation du tableau de sommets rangés aléatoirements
 	EntiersEntiers *tableau_de_correspondance = new EntiersEntiers();
 	edge_t e1,e2; // Iterateurs sur les arcs
 	bool found;
@@ -738,16 +695,9 @@ bool contraction_HEM(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEntiers &
 	 * Création d'un vecteur contenant l'ensemble des sommets du graphe. Ces sommets sont rangés
 	 * aléatoirement afin de simuler un tirage aléatoire
 	 */
-	for (uint i=0 ; i<nbr_vertex ; i++)
-		Random_list_vertices.push_back(i);
-		//Index_Vertex.push_back(i);
-	for (uint j=0 ; j<nbr_vertex-1 ; j++) {
-		int rand_pos = rand()%(nbr_vertex-j)+j;
-		int tmp      = Random_list_vertices[j];
-		Random_list_vertices[j] = Random_list_vertices[rand_pos];
-		Random_list_vertices[rand_pos] = tmp;
-	}
-
+	 
+	Entiers Random_list_vertices = Random_Sort_Vector(nbr_vertex);
+	
 	/*
 	 * Pour chaque sommet non verrouiller faire ....
 	 */
@@ -850,17 +800,6 @@ bool contraction_HEM(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEntiers &
 				tableau_de_correspondance->push_back(couple);
 				Random_list_vertices[i]=-1;
 			}
-
-
-
-			/*std::cout<<"Poids noeud graphe contracté : "<<std::endl;
-			tie(vertexIt, vertexEnd) = vertices(*gtmp);
-			for (; vertexIt != vertexEnd; ++vertexIt) {
-				std::cout << (*gtmp)[*vertexIt]._index
-						<< " -> ";
-				std::cout << (*gtmp)[*vertexIt]._weight<<" ; ";
-			}
-			std::cout << std::endl;*/
 		}
 
 		if(val_cpt == val_reduc){
@@ -886,23 +825,8 @@ bool contraction_HEM(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEntiers &
 		remove_vertex(sommets_a_detruire[j],*gtmp);
 	}
 
-	// std::clog<<"Affichage avant tri "<<std::endl;
-	// for(uint k = 0;k<tableau_de_correspondance->size();k++){
-	// 	for(uint v = 0; v<tableau_de_correspondance->at(k)->size();v++){
-	// 		std::cout<<tableau_de_correspondance->at(k)->at(v)<<" ";
-	// 	}
-	// 	std::cout<<"\n"<<std::endl;
-	// }
 	std::sort(tableau_de_correspondance->begin(),tableau_de_correspondance->end(),myobject); // Trie dans l'ordre croissant des couples de sommets de la liste de correspondance
 
-	// std::clog<<"Tableau de correspondance "<<std::endl;
-	// for(uint k = 0;k<tableau_de_correspondance->size();k++){
-	// 	for(uint v = 0; v<tableau_de_correspondance->at(k)->size();v++){
-	// 		std::cout<<tableau_de_correspondance->at(k)->at(v)<<" ";
-	// 	}
-	// 	std::cout<<"\n"<<std::endl;
-	// }
-
 	liste_corr.push_back(tableau_de_correspondance);
 	// std::cout<<"\n"<<std::endl;
 	baseg.push_back(gtmp); // Ajout du graphe modifié à la "base des graphe"
@@ -914,29 +838,25 @@ bool contraction_HEM(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEntiers &
 
 }
 
-/*** Problème de segmentation avec cette méthode !!!  ***/
 bool contraction_HEM_tests(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEntiers &liste_corr, int val_reduc, int &val_cpt){
 	UnorientedGraph *gtmp = new UnorientedGraph();
 	boost::copy_graph(*g, *gtmp);
-	Entiers Random_list_vertices, Index_Vertex; // Initialisation du tableau de sommets rangés aléatoirements
+	Entiers Index_Vertex; // Initialisation du tableau de sommets rangés aléatoirements
 	EntiersEntiers *tableau_de_correspondance = new EntiersEntiers();
 	edge_t e1,e2; // Iterateurs sur les arcs
 	bool found;
 	uint nbr_vertex = num_vertices(*gtmp);
+	//std::cout<<"val_reduc  : "<<val_reduc<<std::endl;
+	//std::cout<<"nbr_vertex : "<<nbr_vertex<<std::endl;
 	Entiers sommets_a_detruire; // Initialisation d'un tableau pret à recevoir les "sommets à détruire"
 	/*
 	 * Création d'un vecteur contenant l'ensemble des sommets du graphe. Ces sommets sont rangés
 	 * aléatoirement afin de simuler un tirage aléatoire
 	 */
-	for (uint i=0 ; i<nbr_vertex ; i++){
-		Random_list_vertices.push_back(i);
-		Index_Vertex.push_back(i);}
-	for (uint j=0 ; j<nbr_vertex-1 ; j++) {
-		int rand_pos = rand()%(nbr_vertex-j)+j;
-		int tmp      = Random_list_vertices[j];
-		Random_list_vertices[j] = Random_list_vertices[rand_pos];
-		Random_list_vertices[rand_pos] = tmp;
-	}
+	for (uint i=0 ; i<nbr_vertex ; i++)
+		Index_Vertex.push_back(i);
+
+	Entiers Random_list_vertices = Random_Sort_Vector(nbr_vertex);
 
 	/*
 	 * Pour chaque sommet non verrouiller faire ....
@@ -946,7 +866,7 @@ bool contraction_HEM_tests(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEnt
 	//std::cout<<std::endl;
 	for(uint i=0; i<nbr_vertex; i++){
 		int vertexs = Index_Vertex.at(Random_list_vertices.at(i));
-		//std::cout<<"Le sommet tiré est : "<<vertexs<<" ça place est : "<<Random_list_vertices.at(i)<<" place : "<<i<<std::endl;
+		//std::cout<<"Le sommet tiré est : "<<(*gtmp)[vertexs]._index<<" ça place est : "<<vertexs<<" place : "<<i<<std::endl;
 		if(vertexs!=-1){
 			Entiers liste_voisin = Liste_adjacence_tests(*gtmp,vertexs,Index_Vertex); // Recherche des sommets adjacents au sommets  tiré
 			if(liste_voisin.size()!=0){
@@ -955,7 +875,7 @@ bool contraction_HEM_tests(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEnt
 				 * choisi celui dont l'arc les reliants est le plus fort. Dans le cas où les arcs ont tous
 				 * le même poids, on selectionne le sommet d'index le plus petit
 				 */
-				double poids_a = -1.;
+				double poids_a = 0.;
 				int best_vertexs = -1;
 				for(uint j=0;j<liste_voisin.size();j++){
 					tie(e1,found)=edge(vertex(vertexs,*gtmp),vertex(liste_voisin[j],*gtmp),*gtmp);
@@ -993,12 +913,15 @@ bool contraction_HEM_tests(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEnt
 				 */
 				for (; neighbourIt != neighbourEnd; ++neighbourIt){
 					neigh_vertex_save.push_back(*neighbourIt);
+					//std::cout<<(*gtmp)[*neighbourIt]._index<<" ";
 				}
-
+				//std::cout<<std::endl;
 				tie(neighbourIt, neighbourEnd) = adjacent_vertices(vertex_delete,*gtmp);
 				for (; neighbourIt != neighbourEnd; ++neighbourIt){
 					neigh_vertex_delete.push_back(*neighbourIt);
+					//std::cout<<(*gtmp)[*neighbourIt]._index<<" ";
 				}
+				//std::cout<<std::endl;
 				
 				sort(neigh_vertex_save.begin(),neigh_vertex_save.end());
 				sort(neigh_vertex_delete.begin(),neigh_vertex_delete.end());
@@ -1007,21 +930,32 @@ bool contraction_HEM_tests(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEnt
 				 * S'il existe un tel sommet "v" alors on ajoute le poids de l'arcs (vertex_delet,v)
 				 * à celui de l'arcs (vertex_save,v) et on détruit l'arcs reliant "v" au "sommet à détruire"
 				 */
+				 
 				for(uint j=0;j<neigh_vertex_delete.size();j++){
-					if(In_tab_dichotomie(neigh_vertex_save,neigh_vertex_delete[j])==1){
-						tie(e2,found)=edge(vertex(vertex_save,*gtmp),vertex(neigh_vertex_delete[j],*gtmp),*gtmp);
-						tie(e1,found)=edge(vertex(vertex_delete,*gtmp),vertex(neigh_vertex_delete[j],*gtmp),*gtmp);
-						(*gtmp)[e2]._weight+=(*gtmp)[e1]._weight;
-						remove_edge(vertex_delete,neigh_vertex_delete[j],*gtmp);
-					}
-					else
-					{
+					//std::cout<<"* "<<neigh_vertex_delete.size()<<" "<<(*gtmp)[neigh_vertex_delete[j]]._index<<std::endl;
+					if(neigh_vertex_save.size() != 0){
+						if(In_tab_dichotomie(neigh_vertex_save,neigh_vertex_delete[j])==1){
+						//	std::cout<<"*p"<<std::endl;
+							tie(e2,found)=edge(vertex(vertex_save,*gtmp),vertex(neigh_vertex_delete[j],*gtmp),*gtmp);
+							tie(e1,found)=edge(vertex(vertex_delete,*gtmp),vertex(neigh_vertex_delete[j],*gtmp),*gtmp);
+							(*gtmp)[e2]._weight+=(*gtmp)[e1]._weight;
+							remove_edge(vertex_delete,neigh_vertex_delete[j],*gtmp);
+						}
+						else
+						{
+							//std::cout<<"*t"<<std::endl;
+							tie(e1,found)=edge(vertex(vertex_delete,*gtmp),vertex(neigh_vertex_delete[j],*gtmp),*gtmp);
+							add_edge(vertex_save,neigh_vertex_delete[j],EdgeProperties((*gtmp)[e1]._weight),*gtmp);
+							remove_edge(vertex_delete,neigh_vertex_delete[j],*gtmp);
+						}
+					}else{
+						//std::cout<<"*t"<<std::endl;
 						tie(e1,found)=edge(vertex(vertex_delete,*gtmp),vertex(neigh_vertex_delete[j],*gtmp),*gtmp);
 						add_edge(vertex_save,neigh_vertex_delete[j],EdgeProperties((*gtmp)[e1]._weight),*gtmp);
 						remove_edge(vertex_delete,neigh_vertex_delete[j],*gtmp);
 					}
 				}
-
+				//std::cout<<"**"<<std::endl;
 				(*gtmp)[vertex_save]._weight+=(*gtmp)[vertex_delete]._weight; // ajout du poids du sommet détruit au sommet conservé
 				/*
 				 * Vérouillage du "sommet sauvegardé" et du "sommet à détruire"
@@ -1029,6 +963,7 @@ bool contraction_HEM_tests(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEnt
 				Index_Vertex.at(Random_list_vertices.at(i))=-1;
 				Index_Vertex.at(best_vertexs)=-1;
 				val_cpt--;
+				//std::cout<<"***"<<std::endl;
 				//std::cout<<std::endl;
 			}
 			else{
@@ -1042,20 +977,10 @@ bool contraction_HEM_tests(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEnt
 				tableau_de_correspondance->push_back(couple);
 				Index_Vertex.at(Random_list_vertices.at(i))=-1;
 			}
-
-
-
-			/*std::cout<<"Poids noeud graphe contracté : "<<std::endl;
-			tie(vertexIt, vertexEnd) = vertices(*gtmp);
-			for (; vertexIt != vertexEnd; ++vertexIt) {
-				std::cout << (*gtmp)[*vertexIt]._index
-						<< " -> ";
-				std::cout << (*gtmp)[*vertexIt]._weight<<" ; ";
-			}
-			std::cout << std::endl;*/
 		}
 
 		if(val_cpt == val_reduc){
+			//std::cout<<"égalité"<<std::endl;
 			for(uint j=i+1; j < nbr_vertex; j++){
 				if(Index_Vertex.at(Random_list_vertices.at(j)) != -1){
 				Entiers *couple = new Entiers();
@@ -1078,23 +1003,8 @@ bool contraction_HEM_tests(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEnt
 		remove_vertex(sommets_a_detruire[j],*gtmp);
 	}
 
-	// std::clog<<"Affichage avant tri "<<std::endl;
-	// for(uint k = 0;k<tableau_de_correspondance->size();k++){
-	// 	for(uint v = 0; v<tableau_de_correspondance->at(k)->size();v++){
-	// 		std::cout<<tableau_de_correspondance->at(k)->at(v)<<" ";
-	// 	}
-	// 	std::cout<<"\n"<<std::endl;
-	// }
 	std::sort(tableau_de_correspondance->begin(),tableau_de_correspondance->end(),myobject); // Trie dans l'ordre croissant des couples de sommets de la liste de correspondance
 
-	// std::clog<<"Tableau de correspondance "<<std::endl;
-	// for(uint k = 0;k<tableau_de_correspondance->size();k++){
-	// 	for(uint v = 0; v<tableau_de_correspondance->at(k)->size();v++){
-	// 		std::cout<<tableau_de_correspondance->at(k)->at(v)<<" ";
-	// 	}
-	// 	std::cout<<"\n"<<std::endl;
-	// }
-
 	liste_corr.push_back(tableau_de_correspondance);
 	// std::cout<<"\n"<<std::endl;
 	baseg.push_back(gtmp); // Ajout du graphe modifié à la "base des graphe"
@@ -1109,7 +1019,7 @@ bool contraction_HEM_tests(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEnt
 bool contraction_HEM_max_degree_selection(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEntiers &liste_corr, int val_reduc, int &val_cpt){
 	UnorientedGraph *gtmp = new UnorientedGraph();
 	boost::copy_graph(*g, *gtmp);
-	Entiers Random_list_vertices, Index_Vertex; // Initialisation du tableau de sommets rangés aléatoirements
+	Entiers Index_Vertex; // Initialisation du tableau de sommets rangés aléatoirements
 	EntiersEntiers *tableau_de_correspondance = new EntiersEntiers();
 	edge_t e1,e2; // Iterateurs sur les arcs
 	bool found;
@@ -1119,16 +1029,10 @@ bool contraction_HEM_max_degree_selection(UnorientedGraph *g, Base_Graph &baseg,
 	 * Création d'un vecteur contenant l'ensemble des sommets du graphe. Ces sommets sont rangés
 	 * aléatoirement afin de simuler un tirage aléatoire
 	 */
-	for (uint i=0 ; i<nbr_vertex ; i++){
-		Random_list_vertices.push_back(i);
-		Index_Vertex.push_back(i);}
-	for (uint j=0 ; j<nbr_vertex-1 ; j++) {
-		int rand_pos = rand()%(nbr_vertex-j)+j;
-		int tmp      = Random_list_vertices[j];
-		Random_list_vertices[j] = Random_list_vertices[rand_pos];
-		Random_list_vertices[rand_pos] = tmp;
-	}
-
+	for (uint i=0 ; i<nbr_vertex ; i++)
+		Index_Vertex.push_back(i);
+	
+	Entiers Random_list_vertices = Random_Sort_Vector(nbr_vertex);
 	/*
 	 * Pour chaque sommet non verrouiller faire ....
 	 */
@@ -1292,15 +1196,6 @@ bool contraction_HEM_degree(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEn
 	 * Création d'un vecteur contenant l'ensemble des sommets du graphe. Ces sommets sont rangés
 	 * aléatoirement afin de simuler un tirage aléatoire
 	 */
-	/*for (uint i=0 ; i<nbr_vertex ; i++){
-		Random_list_vertices.push_back(i);
-		Index_Vertex.push_back(i);}
-	for (uint j=0 ; j<nbr_vertex-1 ; j++) {
-		int rand_pos = rand()%(nbr_vertex-j)+j;
-		int tmp      = Random_list_vertices[j];
-		Random_list_vertices[j] = Random_list_vertices[rand_pos];
-		Random_list_vertices[rand_pos] = tmp;
-	}*/
 	
 	for (uint i=0 ; i<nbr_vertex ; i++){
 		Index_Vertex.push_back(i);
@@ -1412,14 +1307,20 @@ bool contraction_HEM_degree(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEn
 			 * à celui de l'arcs (vertex_save,v) et on détruit l'arcs reliant "v" au "sommet à détruire"
 			 */
 			for(uint j=0;j<neigh_vertex_delete.size();j++){
-				if(In_tab_dichotomie(neigh_vertex_save,neigh_vertex_delete[j])==1){
-					tie(e2,found)=edge(vertex(vertex_save,*gtmp),vertex(neigh_vertex_delete[j],*gtmp),*gtmp);
-					tie(e1,found)=edge(vertex(vertex_delete,*gtmp),vertex(neigh_vertex_delete[j],*gtmp),*gtmp);
-					(*gtmp)[e2]._weight+=(*gtmp)[e1]._weight;
-					remove_edge(vertex_delete,neigh_vertex_delete[j],*gtmp);
-				}
-				else
-				{
+				if(neigh_vertex_save.size() != 0){
+					if(In_tab_dichotomie(neigh_vertex_save,neigh_vertex_delete[j])==1){
+						tie(e2,found)=edge(vertex(vertex_save,*gtmp),vertex(neigh_vertex_delete[j],*gtmp),*gtmp);
+						tie(e1,found)=edge(vertex(vertex_delete,*gtmp),vertex(neigh_vertex_delete[j],*gtmp),*gtmp);
+						(*gtmp)[e2]._weight+=(*gtmp)[e1]._weight;
+						remove_edge(vertex_delete,neigh_vertex_delete[j],*gtmp);
+					}
+					else
+					{
+						tie(e1,found)=edge(vertex(vertex_delete,*gtmp),vertex(neigh_vertex_delete[j],*gtmp),*gtmp);
+						add_edge(vertex_save,neigh_vertex_delete[j],EdgeProperties((*gtmp)[e1]._weight),*gtmp);
+						remove_edge(vertex_delete,neigh_vertex_delete[j],*gtmp);
+					}
+				}else{
 					tie(e1,found)=edge(vertex(vertex_delete,*gtmp),vertex(neigh_vertex_delete[j],*gtmp),*gtmp);
 					add_edge(vertex_save,neigh_vertex_delete[j],EdgeProperties((*gtmp)[e1]._weight),*gtmp);
 					remove_edge(vertex_delete,neigh_vertex_delete[j],*gtmp);
@@ -1492,7 +1393,7 @@ bool contraction_HEM_degree(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEn
 bool contraction_HEM_mds_ameliore_KK(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEntiers &liste_corr, int val_reduc, int &val_cpt){
 	UnorientedGraph *gtmp = new UnorientedGraph();
 	boost::copy_graph(*g, *gtmp);
-	Entiers Random_list_vertices, Index_Vertex; // Initialisation du tableau de sommets rangés aléatoirements
+	Entiers Index_Vertex; // Initialisation du tableau de sommets rangés aléatoirements
 	EntiersEntiers *tableau_de_correspondance = new EntiersEntiers();
 	edge_t e1,e2; // Iterateurs sur les arcs
 	bool found;
@@ -1502,15 +1403,10 @@ bool contraction_HEM_mds_ameliore_KK(UnorientedGraph *g, Base_Graph &baseg, List
 	 * Création d'un vecteur contenant l'ensemble des sommets du graphe. Ces sommets sont rangés
 	 * aléatoirement afin de simuler un tirage aléatoire
 	 */
-	for (uint i=0 ; i<nbr_vertex ; i++){
-		Random_list_vertices.push_back(i);
-		Index_Vertex.push_back(i);}
-	for (uint j=0 ; j<nbr_vertex-1 ; j++) {
-		int rand_pos = rand()%(nbr_vertex-j)+j;
-		int tmp      = Random_list_vertices[j];
-		Random_list_vertices[j] = Random_list_vertices[rand_pos];
-		Random_list_vertices[rand_pos] = tmp;
-	}
+	for (uint i=0 ; i<nbr_vertex ; i++)
+		Index_Vertex.push_back(i);
+	
+	Entiers Random_list_vertices = Random_Sort_Vector(nbr_vertex);
 
 	/*
 	 * Pour chaque sommet non verrouiller faire ....
@@ -1731,25 +1627,18 @@ bool Est_voisin(UnorientedGraph *g, int vertex, int vertex_select){
 
 bool contraction_Random_Maching(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEntiers &liste_corr, int val_reduc, int &val_cpt){
 	UnorientedGraph *gtmp = new UnorientedGraph();
-	*gtmp=*g;
-	Entiers Random_list_vertices; // Initialisation du tableau de sommets rangés aléatoirements
+	boost::copy_graph(*g, *gtmp);
 	EntiersEntiers *tableau_de_correspondance = new EntiersEntiers();
 	edge_t e1,e2; // Iterateurs sur les arcs
 	bool found;
 	uint nbr_vertex = num_vertices(*gtmp);
 	Entiers sommets_a_detruire; // Initialisation d'un tableau pret à recevoir les "sommets à détruire"
+	
 	/*
 	 * Création d'un vecteur contenant l'ensemble des sommets du graphe. Ces sommets sont rangés
 	 * aléatoirement afin de simuler un tirage aléatoire
 	 */
-	for (uint i=0 ; i<nbr_vertex ; i++)
-		Random_list_vertices.push_back(i);
-	for (uint j=0 ; j<nbr_vertex-1 ; j++) {
-		int rand_pos = rand()%(nbr_vertex-j)+j;
-		int tmp      = Random_list_vertices[j];
-		Random_list_vertices[j] = Random_list_vertices[rand_pos];
-		Random_list_vertices[rand_pos] = tmp;
-	}
+	Entiers Random_list_vertices = Random_Sort_Vector(nbr_vertex);
 
 	/*
 	 * Pour chaque sommet non verrouiller faire ....
@@ -1774,9 +1663,7 @@ bool contraction_Random_Maching(UnorientedGraph *g, Base_Graph &baseg, ListEntie
 
 				Entiers * couple = new Entiers(); // Initialisation du vecteur contenant le couple de sommet fusionné
 				int vertex_delete = std::max(vertexs, best_vertexs); // Sommet d'indentifiant le plus grand (qui sera détruit)
-				//std::cout<<"sommet détruit : "<<vertex_delete<<std::endl;
 				int vertex_save = std::min(vertexs,best_vertexs); // Sommet d'identifiant le plus petit (qui sera conservé)
-				//std::cout<<"sommet sauvé : "<<vertex_save<<std::endl;
 
 				sommets_a_detruire.push_back(vertex_delete); // On ajoute le sommet détruit au tableau des sommets à détruire
 				/*
@@ -1870,28 +1757,11 @@ bool contraction_Random_Maching(UnorientedGraph *g, Base_Graph &baseg, ListEntie
 		remove_vertex(sommets_a_detruire[j],*gtmp);
 	}
 
-	/**std::clog<<"Affichage avant tri "<<std::endl;
-	for(uint k = 0;k<tableau_de_correspondance->size();k++){
-		for(uint v = 0; v<tableau_de_correspondance->at(k)->size();v++){
-			std::cout<<tableau_de_correspondance->at(k)->at(v)<<" ";
-		}
-		std::cout<<"\n"<<std::endl;
-	}*/
 	std::sort(tableau_de_correspondance->begin(),tableau_de_correspondance->end(),myobject); // Trie dans l'ordre croissant des couples de sommets de la liste de correspondance
-
-	// std::clog<<"Tableau de correspondance "<<std::endl;
-	// for(uint k = 0;k<tableau_de_correspondance->size();k++){
-	// 	for(uint v = 0; v<tableau_de_correspondance->at(k)->size();v++){
-	// 		std::cout<<tableau_de_correspondance->at(k)->at(v)<<" ";
-	// 	}
-	// 	std::cout<<"\n"<<std::endl;
-	// }
-
 	liste_corr.push_back(tableau_de_correspondance);
-	// std::cout<<"\n"<<std::endl;
 	baseg.push_back(gtmp); // Ajout du graphe modifié à la "base des graphe"
 
-
+	
 	if(val_cpt == val_reduc)
 		return true;
 	else
@@ -3270,7 +3140,7 @@ void Plot_UnorientedGraph_All(UnorientedGraph *g, const EntiersEntiers &Partitio
 	edge_t e1;
 	bool found;
 	
-	if(Partition.size()<16){
+	if(Partition.size()<17){
 		std::ofstream GRAPH2 (text, std::ios::out);
 		GRAPH2<<"graph G {"<<std::endl;   
 		tie(vertexIt, vertexEnd) = vertices(*g);
@@ -3324,7 +3194,7 @@ void Plot_OrientedGraph_All(OrientedGraph *go, const EntiersEntiers &Partition,
 	edge_to e1;
 	bool found;
 	
-	if(Partition.size()<16){
+	if(Partition.size()<17){
 		std::vector<std::string> color;
 		color.push_back("[color=blue2, fontcolor=blue2];");
 		color.push_back("[color=red, fontcolor=red];");
@@ -3476,4 +3346,19 @@ void Merge_Boost_Graph(OrientedGraph *go1, OrientedGraph *go2, std::vector<std::
 	
 }
 
+Entiers Random_Sort_Vector(uint size){
+	
+	Entiers random_order;
+	for (uint i = 0 ; i<  size ; i++)
+		random_order.push_back(i);
+	for (uint j=0 ; j < size-1 ; j++) {
+		int rand_pos = rand()%(size-j)+j;
+		int tmp      = random_order.at(j);
+		random_order.at(j) = random_order.at(rand_pos);
+		random_order.at(rand_pos) = tmp;
+	}
+	
+	return random_order;
+}
+
 } } } // namespace paradevs tests boost_graph

+ 1 - 0
src/tests/boost_graph/partitioning/utils.hpp

@@ -229,6 +229,7 @@ void Merge_Boost_Graph(OrientedGraph *go1, OrientedGraph *go2,
 						std::vector<std::pair<int,int>> &connection, 
 						std::vector<double> &connection_weight);
 
+Entiers Random_Sort_Vector(uint size);
 } } } // namespace paradevs tests boost_graph
 
 #endif