Parcourir la source

Add partitioning in boost_graph tests

Eric Ramat il y a 11 ans
Parent
commit
45521c1b8b

+ 4 - 4
src/CMakeLists.txt

@@ -1,9 +1,9 @@
-IF ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
-  message("TRACE off")
-ELSE ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
+IF ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
   message("TRACE on")
   add_definitions(-DWITH_TRACE)
-ENDIF ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
+ELSE ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
+  message("TRACE off")
+ENDIF ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
 
 ADD_SUBDIRECTORY(apps)
 ADD_SUBDIRECTORY(common)

+ 99 - 0
src/apps/main.cpp

@@ -162,3 +162,102 @@ int main()
     std::cout << "... OK -> "  << (t4 - t3) << std::endl;
     return 0;
 }
+
+// #include <condition_variable>
+// #include <iostream>
+// #include <mutex>
+// #include <thread>
+// #include <unistd.h>
+
+// struct _sb
+// {
+//     std::condition_variable wait_cv;
+//     std::mutex              wait_lk;
+//     int                     runners;
+// };
+
+// class Barrier
+// {
+// public:
+//     Barrier(int count)
+//     {
+//         maxcnt = count;
+//         CurrentSb = &sb[0];
+//         for (int i = 0; i < 2; ++i) {
+//             _sb *CurrentSb = &sb[i];
+
+//             CurrentSb->runners = count;
+//         }
+//     }
+
+//     virtual ~Barrier()
+//     { }
+
+//     int wait()
+//     {
+//         _sb *TempSb = CurrentSb;
+
+//         std::unique_lock < std::mutex > lck(TempSb->wait_lk);
+
+//         if (TempSb->runners == 1) {
+//             if (maxcnt != 1) {
+//                 TempSb->runners = maxcnt;
+//                 CurrentSb = (CurrentSb == &sb[0]) ? &sb[1] : &sb[0];
+//                 TempSb->wait_cv.notify_all();
+//             }
+//         } else {
+//             TempSb->runners--;
+//             while (TempSb->runners != maxcnt)
+//                 TempSb->wait_cv.wait(lck);
+//         }
+//         return 0;
+//     }
+
+// private:
+//     int maxcnt;
+//     _sb sb[2];
+//     _sb *CurrentSb;
+// };
+
+// Barrier ba(2);
+
+// void f1()
+// {
+//     for (unsigned int i = 1; i < 20; ++i) {
+//         std::cout << "*";
+//         usleep(50);
+//     }
+//     ba.wait();
+//     std::cout << std::endl;
+//     for (unsigned int i = 1; i < 20; ++i) {
+//         std::cout << "x";
+//         usleep(50);
+//     }
+//     std::cout << std::endl;
+// }
+
+// void f2()
+// {
+//     for (unsigned int i = 1; i < 20; ++i) {
+//         std::cout << "O";
+//         usleep(10);
+//     }
+//     ba.wait();
+//     std::cout << std::endl;
+//     for (unsigned int i = 1; i < 20; ++i) {
+//         std::cout << "o";
+//         usleep(10);
+//     }
+//     std::cout << std::endl;
+// }
+
+// int main()
+// {
+//     std::thread th1(f1);
+//     std::thread th2(f2);
+
+//     th1.join();
+//     th2.join();
+
+//     return 0;
+// }

+ 3 - 0
src/common/Coordinator.hpp

@@ -50,6 +50,9 @@ public :
     virtual ~Coordinator()
     { }
 
+    virtual bool is_atomic() const
+    { return false; }
+
 // DEVS methods
     virtual void observation(std::ostream& file) const =0;
     virtual void output(typename Time::type t) =0;

+ 1 - 0
src/common/Model.hpp

@@ -115,6 +115,7 @@ public:
     Model < Time, SchedulerHandle >* get_parent() const
     { return _parent; }
 
+    virtual bool is_atomic() const = 0;
 
     void set_parent(Model < Time, SchedulerHandle >* parent)
     { _parent = parent; }

+ 4 - 0
src/common/Simulator.hpp

@@ -40,6 +40,10 @@ public :
     virtual ~Simulator()
     { }
 
+    virtual bool is_atomic() const
+    { return true; }
+
+// DEVS methods
     virtual void observation(std::ostream& file) const =0;
     virtual void output(typename Time::type t) =0;
     virtual void post_event(typename Time::type t,

+ 3 - 1
src/kernel/pdevs/CMakeLists.txt

@@ -11,4 +11,6 @@ LINK_DIRECTORIES(
 
 SET(PDEVS_HPP Coordinator.hpp Dynamics.hpp GraphManager.hpp Simulator.hpp)
 
-INSTALL(FILES ${PDEVS_HPP} DESTINATION ${PARADEVS_INCLUDE_DIRS}/pdevs)
+INSTALL(FILES ${PDEVS_HPP} DESTINATION ${PARADEVS_INCLUDE_DIRS}/pdevs)
+
+ADD_SUBDIRECTORY(multithreading)

+ 1 - 1
src/kernel/pdevs/Coordinator.hpp

@@ -294,7 +294,7 @@ public:
         }
     }
 
-private:
+protected:
     GraphManager _graph_manager;
     Scheduler    _event_table;
 };

+ 3 - 0
src/kernel/pdevs/GraphManager.hpp

@@ -111,6 +111,9 @@ public:
         }
     }
 
+    common::Coordinator < Time, SchedulerHandle >* get_coordinator() const
+    { return _coordinator; }
+
     void post_event(typename Time::type t,
                     const common::ExternalEvent < Time,
                                                   SchedulerHandle >& event)

+ 15 - 0
src/kernel/pdevs/multithreading/CMakeLists.txt

@@ -0,0 +1,15 @@
+INCLUDE_DIRECTORIES(
+  ${PARADEVS_BINARY_DIR}/src
+  ${PARADEVS_SOURCE_DIR}/src
+  ${Boost_INCLUDE_DIRS}
+  ${GLIBMM_INCLUDE_DIRS}
+  ${LIBXML_INCLUDE_DIRS})
+
+LINK_DIRECTORIES(
+  ${GLIBMM_LIBRARY_DIRS}
+  ${LIBXML_LIBRARY_DIR})
+
+SET(PDEVS_MULTITHREADING_HPP Coordinator.hpp)
+
+INSTALL(FILES ${PDEVS_MULTITHREADING_HPP} DESTINATION
+  ${PARADEVS_INCLUDE_DIRS}/pdevs/multithreading)

+ 173 - 0
src/kernel/pdevs/multithreading/Coordinator.hpp

@@ -0,0 +1,173 @@
+/**
+ * @file kernel/pdevs/multithreading/Coordinator.hpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef PDEVS_MULTITHREADING_COORDINATOR
+#define PDEVS_MULTITHREADING_COORDINATOR 1
+
+#include <kernel/pdevs/Coordinator.hpp>
+
+#include <future>
+
+namespace paradevs { namespace pdevs { namespace multithreading {
+
+class Barrier
+{
+    struct SubBarrier
+    {
+        std::condition_variable _cv;
+        std::mutex              _lck;
+        int                     _runners;
+    };
+
+public:
+    Barrier(int count) : _max(count)
+    {
+        _current = &_sub_barriers[0];
+        for (int i = 0; i < 2; ++i) {
+            _sub_barriers[i]._runners = count;
+        }
+    }
+
+    virtual ~Barrier()
+    { }
+
+    int wait()
+    {
+        SubBarrier *sub_barrier = _current;
+
+        std::unique_lock < std::mutex > lck(sub_barrier->_lck);
+
+        if (sub_barrier->_runners == 1) {
+            if (_max != 1) {
+                sub_barrier->_runners = _max;
+                _current = (_current == &_sub_barriers[0]) ? &_sub_barriers[1] :
+                    &_sub_barriers[0];
+                sub_barrier->_cv.notify_all();
+            }
+        } else {
+            sub_barrier->_runners--;
+            while (sub_barrier->_runners != _max)
+                sub_barrier->_cv.wait(lck);
+        }
+        return 0;
+    }
+
+private:
+    int         _max;
+    SubBarrier  _sub_barriers[2];
+    SubBarrier* _current;
+};
+
+template < class Time,
+           class Scheduler,
+           class SchedulerHandle,
+           class GraphManager,
+           class Parameters = common::NoParameters,
+           class GraphParameters = common::NoParameters >
+class Coordinator : public pdevs::Coordinator < Time, Scheduler,
+                                                SchedulerHandle, GraphManager,
+                                                Parameters, GraphParameters >
+{
+    typedef pdevs::Coordinator < Time, Scheduler, SchedulerHandle, GraphManager,
+                                 Parameters, GraphParameters > parent_type;
+    typedef Coordinator < Time, Scheduler, SchedulerHandle, GraphManager,
+                          Parameters, GraphParameters > type;
+
+public:
+    Coordinator(const std::string& name,
+                const Parameters& parameters,
+                const GraphParameters& graph_parameters) :
+        pdevs::Coordinator < Time, Scheduler, SchedulerHandle, GraphManager,
+                             Parameters, GraphParameters >(name, parameters,
+                                                           graph_parameters)
+    {
+        for (auto & child : parent_type::_graph_manager.children()) {
+            if (not child->is_atomic()) {
+                type* coordinator = dynamic_cast < type* >(child);
+
+                _threads.push_back(std::thread([&]{ coordinator->loop(); }));
+            }
+        }
+    }
+
+    virtual ~Coordinator()
+    { }
+
+    void loop()
+    {
+        bool stop = false;
+
+        while (not stop) {
+
+        }
+    }
+
+    typename Time::type start(typename Time::type t)
+    {
+        for (auto & child : parent_type::_graph_manager.children()) {
+            if (child->is_atomic()) {
+                type::_event_table.init(child->start(type::_tn), child);
+            } else {
+
+            }
+        }
+        type::_tl = t;
+        type::_tn = type::_event_table.get_current_time();
+        return type::_tn;
+    }
+
+    void output(typename Time::type t)
+    {
+        parent_type::output(t);
+    }
+
+    typename Time::type transition(typename Time::type t)
+    {
+        return parent_type::transition(t);
+    }
+
+    void post_event(typename Time::type t,
+                    const common::ExternalEvent < Time,
+                                                  SchedulerHandle >& event)
+    {
+         parent_type::post_event(t, event);
+    }
+
+    typename Time::type dispatch_events(
+        common::Bag < Time, SchedulerHandle > bag, typename Time::type t)
+    {
+        return parent_type::dispatch_events(bag, t);
+    }
+
+private:
+    typedef std::vector < std::thread > Threads;
+
+    Threads _threads;
+};
+
+} } } // namespace paradevs pdevs multithreading
+
+#endif

+ 1 - 0
src/tests/CMakeLists.txt

@@ -12,4 +12,5 @@ LINK_DIRECTORIES(
 ADD_SUBDIRECTORY(boost_graph)
 ADD_SUBDIRECTORY(dtss)
 ADD_SUBDIRECTORY(mixed)
+ADD_SUBDIRECTORY(multithreading)
 ADD_SUBDIRECTORY(pdevs)

+ 5 - 2
src/tests/boost_graph/CMakeLists.txt

@@ -11,11 +11,14 @@ LINK_DIRECTORIES(
 
 # graph tests
 ADD_EXECUTABLE(graph-tests ${COMMON_HPP} ${COMMON_SCHEDULER_HPP} ${PDEVS_HPP}
-  graph_builder.hpp graph_defs.hpp graph_manager.hpp tests.cpp models.hpp)
+  graph_builder.hpp graph_defs.hpp graph_manager.hpp graph_partitioning.hpp
+  tests.cpp models.hpp)
 SET_TARGET_PROPERTIES(graph-tests PROPERTIES ${PARADEVS_APP_PROPERTIES})
 
-TARGET_LINK_LIBRARIES(graph-tests
+TARGET_LINK_LIBRARIES(graph-tests partitioning
   ${Boost_LIBRARIES}
   ${GLIBMM_LIBRARIES}
   ${LIBXML_LIBRARIES}
   ${GTHREAD_LIBRARIES})
+
+ADD_SUBDIRECTORY(partitioning)

+ 62 - 62
src/tests/boost_graph/graph_builder.hpp

@@ -37,41 +37,41 @@ public:
     FlatGraphBuilder()
     { }
 
-    void build(Graphs& graphs, InputEdgeList& /* input_edges */,
+    void build(OrientedGraphs& graphs, InputEdgeList& /* input_edges */,
                OutputEdgeList& /* output_edges */,
                Connections& /* parent_connections */)
     {
-        Graph graph;
-
-        Graph::vertex_descriptor v0 = boost::add_vertex(graph);
-        Graph::vertex_descriptor v1 = boost::add_vertex(graph);
-        Graph::vertex_descriptor v2 = boost::add_vertex(graph);
-        Graph::vertex_descriptor v3 = boost::add_vertex(graph);
-        Graph::vertex_descriptor v4 = boost::add_vertex(graph);
-        Graph::vertex_descriptor v5 = boost::add_vertex(graph);
-        Graph::vertex_descriptor v6 = boost::add_vertex(graph);
-        Graph::vertex_descriptor v7 = boost::add_vertex(graph);
-        Graph::vertex_descriptor v8 = boost::add_vertex(graph);
-        Graph::vertex_descriptor v9 = boost::add_vertex(graph);
-        Graph::vertex_descriptor v10 = boost::add_vertex(graph);
-
-        boost::add_edge(v0, v1, 1, graph);
-	boost::add_edge(v0, v2, 1, graph);
-	boost::add_edge(v0, v3, 1, graph);
-	boost::add_edge(v1, v2, 1, graph);
-	boost::add_edge(v1, v4, 1, graph);
-	boost::add_edge(v1, v5, 1, graph);
-	boost::add_edge(v1, v6, 1, graph);
-	boost::add_edge(v2, v6, 1, graph);
-	boost::add_edge(v2, v3, 1, graph);
-	boost::add_edge(v3, v9, 1, graph);
-	boost::add_edge(v3, v10, 1, graph);
-	boost::add_edge(v4, v5, 1, graph);
-	boost::add_edge(v5, v6, 1, graph);
-	boost::add_edge(v4, v7, 1, graph);
-	boost::add_edge(v4, v8, 1, graph);
-	boost::add_edge(v7, v8, 1, graph);
-	boost::add_edge(v9, v10, 1, graph);
+        OrientedGraph graph;
+
+        OrientedGraph::vertex_descriptor v0 = boost::add_vertex(graph);
+        OrientedGraph::vertex_descriptor v1 = boost::add_vertex(graph);
+        OrientedGraph::vertex_descriptor v2 = boost::add_vertex(graph);
+        OrientedGraph::vertex_descriptor v3 = boost::add_vertex(graph);
+        OrientedGraph::vertex_descriptor v4 = boost::add_vertex(graph);
+        OrientedGraph::vertex_descriptor v5 = boost::add_vertex(graph);
+        OrientedGraph::vertex_descriptor v6 = boost::add_vertex(graph);
+        OrientedGraph::vertex_descriptor v7 = boost::add_vertex(graph);
+        OrientedGraph::vertex_descriptor v8 = boost::add_vertex(graph);
+        OrientedGraph::vertex_descriptor v9 = boost::add_vertex(graph);
+        OrientedGraph::vertex_descriptor v10 = boost::add_vertex(graph);
+
+        boost::add_edge(v1, v0, 1, graph);
+	boost::add_edge(v2, v0, 1, graph);
+	boost::add_edge(v3, v0, 1, graph);
+	boost::add_edge(v2, v1, 1, graph);
+	boost::add_edge(v4, v1, 1, graph);
+	boost::add_edge(v5, v1, 1, graph);
+	boost::add_edge(v6, v1, 1, graph);
+	boost::add_edge(v6, v2, 1, graph);
+	boost::add_edge(v3, v2, 1, graph);
+	boost::add_edge(v9, v3, 1, graph);
+	boost::add_edge(v10, v3 , 1, graph);
+	boost::add_edge(v5, v4, 1, graph);
+	boost::add_edge(v6, v5, 1, graph);
+	boost::add_edge(v7, v4, 1, graph);
+	boost::add_edge(v8, v4, 1, graph);
+	boost::add_edge(v8, v7, 1, graph);
+	boost::add_edge(v10, v9 , 1, graph);
 
         graph[v6] = VertexProperties(6, 1, TOP_PIXEL);
         graph[v8] = VertexProperties(8, 1, TOP_PIXEL);
@@ -95,31 +95,31 @@ public:
     HierarchicalGraphBuilder()
     { }
 
-    void build(Graphs& graphs, InputEdgeList& input_edges,
+    void build(OrientedGraphs& graphs, InputEdgeList& input_edges,
                OutputEdgeList& output_edges, Connections& parent_connections)
     {
         // S1
         {
-            Graph graph;
-
-            Graph::vertex_descriptor v1 = boost::add_vertex(graph);
-            Graph::vertex_descriptor v2 = boost::add_vertex(graph);
-            Graph::vertex_descriptor v4 = boost::add_vertex(graph);
-            Graph::vertex_descriptor v5 = boost::add_vertex(graph);
-            Graph::vertex_descriptor v6 = boost::add_vertex(graph);
-            Graph::vertex_descriptor v7 = boost::add_vertex(graph);
-            Graph::vertex_descriptor v8 = boost::add_vertex(graph);
-
-            boost::add_edge(v1, v2, 1, graph);
-            boost::add_edge(v1, v4, 1, graph);
-            boost::add_edge(v1, v5, 1, graph);
-            boost::add_edge(v1, v6, 1, graph);
-            boost::add_edge(v2, v6, 1, graph);
-            boost::add_edge(v4, v5, 1, graph);
-            boost::add_edge(v5, v6, 1, graph);
-            boost::add_edge(v4, v7, 1, graph);
-            boost::add_edge(v4, v8, 1, graph);
-            boost::add_edge(v7, v8, 1, graph);
+            OrientedGraph graph;
+
+            OrientedGraph::vertex_descriptor v1 = boost::add_vertex(graph);
+            OrientedGraph::vertex_descriptor v2 = boost::add_vertex(graph);
+            OrientedGraph::vertex_descriptor v4 = boost::add_vertex(graph);
+            OrientedGraph::vertex_descriptor v5 = boost::add_vertex(graph);
+            OrientedGraph::vertex_descriptor v6 = boost::add_vertex(graph);
+            OrientedGraph::vertex_descriptor v7 = boost::add_vertex(graph);
+            OrientedGraph::vertex_descriptor v8 = boost::add_vertex(graph);
+
+            boost::add_edge(v2, v1, 1, graph);
+            boost::add_edge(v4, v1, 1, graph);
+            boost::add_edge(v5, v1, 1, graph);
+            boost::add_edge(v6, v1, 1, graph);
+            boost::add_edge(v6, v2, 1, graph);
+            boost::add_edge(v5, v4, 1, graph);
+            boost::add_edge(v6, v5, 1, graph);
+            boost::add_edge(v7, v4, 1, graph);
+            boost::add_edge(v8, v4, 1, graph);
+            boost::add_edge(v8, v7, 1, graph);
 
             graph[v6] = VertexProperties(6, 1, TOP_PIXEL);
             graph[v8] = VertexProperties(8, 1, TOP_PIXEL);
@@ -133,17 +133,17 @@ public:
         }
         // S2
         {
-            Graph graph;
+            OrientedGraph graph;
 
-            Graph::vertex_descriptor v0 = boost::add_vertex(graph);
-            Graph::vertex_descriptor v3 = boost::add_vertex(graph);
-            Graph::vertex_descriptor v9 = boost::add_vertex(graph);
-            Graph::vertex_descriptor v10 = boost::add_vertex(graph);
+            OrientedGraph::vertex_descriptor v0 = boost::add_vertex(graph);
+            OrientedGraph::vertex_descriptor v3 = boost::add_vertex(graph);
+            OrientedGraph::vertex_descriptor v9 = boost::add_vertex(graph);
+            OrientedGraph::vertex_descriptor v10 = boost::add_vertex(graph);
 
-            boost::add_edge(v0, v3, 1, graph);
-            boost::add_edge(v3, v10, 1, graph);
-            boost::add_edge(v9, v10, 1, graph);
-            boost::add_edge(v3, v9, 1, graph);
+            boost::add_edge(v3, v0, 1, graph);
+            boost::add_edge(v10, v3, 1, graph);
+            boost::add_edge(v10, v9, 1, graph);
+            boost::add_edge(v9, v3, 1, graph);
 
             graph[v10] = VertexProperties(10, 1, TOP_PIXEL);
             graph[v0] = VertexProperties(0, 1, NORMAL_PIXEL);

+ 6 - 2
src/tests/boost_graph/graph_defs.hpp

@@ -31,6 +31,10 @@
 
 namespace paradevs { namespace tests { namespace boost_graph {
 
+enum DynamicsType {
+    TOP_PIXEL = 0, NORMAL_PIXEL
+};
+
 struct VertexProperties
 {
     int          _index;
@@ -55,8 +59,8 @@ struct EdgeProperties
 };
 
 typedef boost::adjacency_list < boost::vecS, boost::vecS, boost::directedS,
-                                VertexProperties, EdgeProperties> Graph;
-typedef std::vector < Graph > Graphs;
+                                VertexProperties, EdgeProperties> OrientedGraph;
+typedef std::vector < OrientedGraph > OrientedGraphs;
 
 typedef std::pair < int, int > Edge;
 typedef std::vector < Edge > Edges;

+ 48 - 13
src/tests/boost_graph/graph_manager.hpp

@@ -35,7 +35,6 @@
 #include <kernel/pdevs/Simulator.hpp>
 
 #include <tests/boost_graph/models.hpp>
-#include <tests/boost_graph/graph_builder.hpp>
 
 namespace paradevs { namespace tests { namespace boost_graph {
 
@@ -64,11 +63,11 @@ struct SchedulerHandle
 
 struct GraphParameters
 {
-    Graph       _graph;
-    InputEdges  _input_edges;
-    OutputEdges _output_edges;
+    OrientedGraph _graph;
+    InputEdges    _input_edges;
+    OutputEdges   _output_edges;
 
-    GraphParameters(const Graph& graph,
+    GraphParameters(const OrientedGraph& graph,
                     const InputEdges& input_edges,
                     const OutputEdges& output_edges) :
         _graph(graph), _input_edges(input_edges), _output_edges(output_edges)
@@ -104,9 +103,9 @@ public:
         }
     }
 
-    void build_flat_graph(const Graph& g, const InputEdges& inputs)
+    void build_flat_graph(const OrientedGraph& g, const InputEdges& inputs)
     {
-        Graph::vertex_iterator vertexIt, vertexEnd;
+        OrientedGraph::vertex_iterator vertexIt, vertexEnd;
 
         boost::tie(vertexIt, vertexEnd) = boost::vertices(g);
 	for (; vertexIt != vertexEnd; ++vertexIt)
@@ -127,7 +126,7 @@ public:
                 break;
             case NORMAL_PIXEL:
                 unsigned int n = 0;
-                Graph::adjacency_iterator neighbourIt, neighbourEnd;
+                OrientedGraph::adjacency_iterator neighbourIt, neighbourEnd;
 
                 boost::tie(neighbourIt, neighbourEnd) =
                     boost::adjacent_vertices(*vertexIt, g);
@@ -154,10 +153,14 @@ public:
             };
         }
 
+        std::cout << FlatGraphManager <
+            SchedulerHandle,
+            Parameters >::get_coordinator()->get_name() << ":" << std::endl;
+
         boost::tie(vertexIt, vertexEnd) = boost::vertices(g);
 	for (; vertexIt != vertexEnd; ++vertexIt)
 	{
-            Graph::adjacency_iterator neighbourIt, neighbourEnd;
+            OrientedGraph::adjacency_iterator neighbourIt, neighbourEnd;
 
             boost::tie(neighbourIt, neighbourEnd) =
                 boost::adjacent_vertices(*vertexIt, g);
@@ -178,8 +181,12 @@ public:
                     b = _normal_simulators[g[*neighbourIt]._index];
                 }
                 FlatGraphManager < SchedulerHandle,
-                                   Parameters >::add_link(b, "out",
-                                                               a, "in");
+                                   Parameters >::add_link(a, "out",
+                                                          b, "in");
+
+                std::cout << "  " << a->get_name() << "::out -> "
+                          << b->get_name() << "::in" << std::endl;
+
             }
 	}
     }
@@ -227,6 +234,13 @@ public:
                 coordinator, ss_in.str(),
                 BuiltFlatGraphManager <
                     SchedulerHandle >::_normal_simulators[it->second], "in");
+
+            std::cout << coordinator->get_name() << "::" << ss_in.str()
+                      << " -> "
+                      << BuiltFlatGraphManager <
+                          SchedulerHandle >::_normal_simulators[
+                              it->second]->get_name() << "::in" << std::endl;
+
         }
         // output
         for (Edges::const_iterator it = parameters._output_edges.begin();
@@ -241,6 +255,12 @@ public:
                 BuiltFlatGraphManager <
                     SchedulerHandle >::_normal_simulators[it->first], "out",
                 coordinator, ss_out.str());
+
+            std::cout << BuiltFlatGraphManager <
+                SchedulerHandle >::_normal_simulators[it->first]->get_name()
+                      << "::out -> " << coordinator->get_name()
+                      << "::" << ss_out.str() << std::endl;
+
         }
     }
 
@@ -262,7 +282,7 @@ public:
             coordinator, parameters)
     {
         GraphBuilder   builder;
-        Graphs         graphs;
+        OrientedGraphs graphs;
         InputEdgeList  input_edges;
         OutputEdgeList output_edges;
         Connections    parent_connections;
@@ -293,7 +313,7 @@ public:
                                             coordinator, parameters)
     {
         GraphBuilder   graph_builder;
-        Graphs         graphs;
+        OrientedGraphs graphs;
         InputEdgeList  input_edges;
         OutputEdgeList output_edges;
         Connections    parent_connections;
@@ -318,6 +338,15 @@ public:
         }
 
         // builds internal connections (edges)
+        std::cout << "parent connections:" << std::endl;
+        for (unsigned int i = 0; i < parent_connections.size(); i++) {
+            std::cout << "  (" << parent_connections.at(i).first.first << ","
+                      << parent_connections.at(i).first.second << ") -> ("
+                      << parent_connections.at(i).second.first << ","
+                      << parent_connections.at(i).second.second << ")"
+                      << std::endl;
+        }
+
         for (Connections::const_iterator it = parent_connections.begin();
              it != parent_connections.end(); ++it) {
             const Connection& connection = *it;
@@ -330,6 +359,12 @@ public:
                 SchedulerHandle, GraphBuilder >::add_link(
                     _coordinators[connection.first.first - 1], ss_out.str(),
                     _coordinators[connection.second.first - 1], ss_in.str());
+
+            std::cout << _coordinators[connection.first.first - 1]->get_name()
+                      << "::" << ss_out.str() << " -> "
+                      << _coordinators[connection.second.first - 1]->get_name()
+                      << "::" << ss_in.str() << std::endl;
+
         }
     }
 

+ 70 - 0
src/tests/boost_graph/graph_partitioning.hpp

@@ -0,0 +1,70 @@
+/**
+ * @file tests/boost_graph/graph_partitioning.hpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __TESTS_BOOST_GRAPH_GRAPH_PARTITIONING_HPP
+#define __TESTS_BOOST_GRAPH_GRAPH_PARTITIONING_HPP 1
+
+#include <tests/boost_graph/graph_defs.hpp>
+#include <tests/boost_graph/partitioning/graph_build.hpp>
+#include <tests/boost_graph/partitioning/gggp.hpp>
+
+namespace paradevs { namespace tests { namespace boost_graph {
+
+class PartitioningGraphBuilder
+{
+public:
+    PartitioningGraphBuilder()
+    { }
+
+    void build(OrientedGraphs& graphs,
+               InputEdgeList& input_edges,
+               OutputEdgeList& output_edges,
+               Connections& parent_connections)
+    {
+        srand(7266);
+
+        UnorientedGraph* g = new UnorientedGraph();
+        OrientedGraph* go = new OrientedGraph();
+
+        build_graph(*g, *go);
+
+        int nbr_parties = 3;
+        Edges edge_partie;
+        Connections connections;
+
+        output_edges = OutputEdgeList(nbr_parties);
+
+        graphs = Multiniveau(4, g, go, nbr_parties, "gggp_pond",
+                             "cut_norm", "norm", edge_partie ,
+                             output_edges, input_edges,
+                             parent_connections);
+
+    }
+};
+
+} } } // namespace paradevs tests boost_graph
+
+#endif

+ 0 - 4
src/tests/boost_graph/models.hpp

@@ -193,10 +193,6 @@ private:
     unsigned int _received;
 };
 
-enum DynamicsType {
-    TOP_PIXEL = 0, NORMAL_PIXEL
-};
-
 } } } // namespace paradevs tests boost_graph
 
 #endif

+ 31 - 0
src/tests/boost_graph/partitioning/CMakeLists.txt

@@ -0,0 +1,31 @@
+INCLUDE_DIRECTORIES(
+  ${PARADEVS_BINARY_DIR}/src
+  ${PARADEVS_SOURCE_DIR}/src
+  ${Boost_INCLUDE_DIRS}
+  ${GLIBMM_INCLUDE_DIRS}
+  ${LIBXML_INCLUDE_DIRS})
+
+LINK_DIRECTORIES(
+  ${GLIBMM_LIBRARY_DIRS}
+  ${LIBXML_LIBRARY_DIR})
+
+SET(PARTITIONING_HPP utils.hpp gggp.hpp graph_build.hpp)
+
+SET(PARTITIONING_CPP utils.cpp gggp.cpp graph_build.cpp)
+
+ADD_LIBRARY(partitioning SHARED ${PARTITIONING_HPP};${PARTITIONING_CPP})
+
+TARGET_LINK_LIBRARIES(partitioning
+  ${Boost_LIBRARIES}
+  ${GLIBMM_LIBRARIES}
+  ${LIBXML_LIBRARIES}
+  ${GTHREAD_LIBRARIES})
+
+ADD_EXECUTABLE(partitioning-tests main.cpp)
+SET_TARGET_PROPERTIES(partitioning-tests PROPERTIES ${PARADEVS_APP_PROPERTIES})
+
+TARGET_LINK_LIBRARIES(partitioning-tests partitioning
+  ${Boost_LIBRARIES}
+  ${GLIBMM_LIBRARIES}
+  ${LIBXML_LIBRARIES}
+  ${GTHREAD_LIBRARIES})

+ 93 - 0
src/tests/boost_graph/partitioning/defs.hpp

@@ -0,0 +1,93 @@
+/**
+ * @file tests/boost_graph/partitioning/defs.hpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TESTS_BOOST_GRAPH_PARTITIONING_DEFS_H
+#define TESTS_BOOST_GRAPH_PARTITIONING_DEFS_H 1
+
+// #include <stdlib.h>
+// #include <stdio.h>
+// #include <iostream>
+// #include <iomanip>
+// #include <fstream>
+#include <list>
+#include <vector>
+// #include <map>
+// #include <exception>
+// #include <ctime>       /* clock_t, clock, CLOCKS_PER_SEC */
+// #include <cmath>
+// #include <algorithm>
+
+// #include <boost/graph/topological_sort.hpp>
+#include <boost/graph/adjacency_list.hpp>
+// #include <boost/graph/adjacency_matrix.hpp>
+// #include <boost/graph/graph_utility.hpp>
+// #include <boost/version.hpp>
+// #include <boost/graph/graph_traits.hpp>
+// #include <boost/graph/graph_concepts.hpp>
+// #include <boost/concept/assert.hpp>
+// #include <boost/graph/adjacency_iterator.hpp>
+// #include <boost/limits.hpp>
+// #include <boost/graph/breadth_first_search.hpp>
+// #include <boost/graph/graphviz.hpp>
+// #include <boost/graph/undirected_graph.hpp>
+
+#include <tests/boost_graph/graph_defs.hpp>
+
+namespace paradevs { namespace tests { namespace boost_graph {
+
+typedef unsigned int uint;
+
+typedef std::vector < int > Entiers;
+
+typedef std::vector < Entiers* > EntiersEntiers;
+typedef std::vector < EntiersEntiers > EntiersEntiersEntiers;
+typedef std::list < int > List;
+typedef std::list < EntiersEntiers* > ListEntiersEntiers;
+
+typedef boost::adjacency_list < boost::vecS, boost::vecS, boost::undirectedS,
+                                VertexProperties,
+                                EdgeProperties> UnorientedGraph;
+
+typedef std::vector < UnorientedGraph* > Base_Graph;
+
+typedef boost::graph_traits < UnorientedGraph >::vertex_descriptor vertex_t;
+typedef boost::graph_traits < UnorientedGraph >::edge_descriptor edge_t;
+
+typedef OrientedGraph::vertex_descriptor vertex_to;
+typedef OrientedGraph::edge_descriptor edge_to;
+
+template < class G >
+struct VertexAndEdgeListGraphConcept
+{
+    void constraints() {
+        boost::function_requires < boost::VertexListGraphConcept < G > >();
+        boost::function_requires < boost::EdgeListGraphConcept < G > >();
+    }
+};
+
+} } } // namespace paradevs tests boost_graph
+
+#endif

+ 480 - 0
src/tests/boost_graph/partitioning/gggp.cpp

@@ -0,0 +1,480 @@
+/**
+ * @file tests/boost_graph/partitioning/gggp.cpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <tests/boost_graph/partitioning/gggp.hpp>
+
+#include <algorithm>
+#include <iostream>
+
+namespace paradevs { namespace tests { namespace boost_graph {
+
+extern UnorientedGraph::vertex_iterator vertexIt, vertexEnd;
+extern UnorientedGraph::adjacency_iterator neighbourIt, neighbourEnd;
+
+extern OrientedGraph::vertex_iterator vertexIto, vertexEndo;
+extern OrientedGraph::adjacency_iterator neighbourIto, neighbourEndo;
+
+void gggp(UnorientedGraph *g, Entiers *sommetsSource,
+          Entiers *sommetsDestination, EntiersEntiers &Partition)
+{
+    int val;
+    Entiers sommets_adj;
+
+    if (sommetsSource->size() - 1 == 0) {
+        Entiers tailles;
+
+        val = 0;
+        for (uint i = 0;i < Partition.size(); i++) {
+            tailles.push_back(Partition.at(i)->size());
+        }
+
+        uint tmp = *max_element(tailles.begin(), tailles.end());
+
+        for (uint i = 0; i < Partition.size(); i++) {
+            if (Partition.at(i)->size() == tmp) {
+                gggp(g, Partition.at(i), sommetsDestination, Partition);
+            }
+            break;
+        }
+    } else {
+
+        // Tirage aléatoire de l'indice du premier sommet entre 0 et
+        // taille du tableau -1
+        val = rand_fini(0, sommetsSource->size() - 1);
+    }
+
+    float poids_max=sommetsSource->size()/2.;
+    float poids=1;
+    Entiers sommets_cut;
+
+    //clog<<"Etape 1 : "<<std::endl;
+    sommetsDestination->push_back(sommetsSource->at(val));
+    sommetsSource->erase(sommetsSource->begin() + val);
+
+    if (sommetsSource->size() < 2) {
+        return;
+    }
+
+    while (poids < poids_max) {
+//		for(uint i =0; i< sommetsDestination.size();i++){
+//			std::cout<<sommetsDestination.at(i)<<std::endl;
+//		}
+        Liste_Voisin(*sommetsDestination, sommets_adj, *g);
+        if (sommets_adj.size() == 0) {
+            std::cout<<"Je suis sorti !!!! "<<std::endl;
+            break;
+        } else {
+            /*clog<<"Liste voisin est : "<<std::endl;
+              for(int i=0;i<sommets_adj.size();i++)
+              {
+              std::cout<<sommets_adj[i]<<std::endl;
+              }*/
+            std::sort(sommets_adj.begin(), sommets_adj.end());
+            for (uint i = 0; i < sommets_adj.size(); i++) {
+                sommets_cut.push_back(Cout_coupe(*sommetsDestination,
+                                                 sommets_adj[i], *g));
+            }
+
+            int tmp = recherche_val(sommets_cut,
+                                    *min_element(sommets_cut.begin(),
+                                                 sommets_cut.end()));
+            sommetsDestination->push_back(sommets_adj[tmp]);
+            suprim_val(*sommetsSource, sommets_adj[tmp]);
+            suprim_val(sommets_adj, sommets_adj[tmp]);
+
+            sommets_cut.clear();
+            poids++;
+        }
+    }
+
+    for (uint i = 0; i < sommetsSource->size(); i++) {
+        for (uint j = 0; j < sommetsDestination->size(); j++) {
+            remove_edge(sommetsSource->at(i), sommetsDestination->at(j), *g);
+        }
+    }
+    sort(sommetsDestination->begin(), sommetsDestination->end());
+}
+
+void gggp_pond(UnorientedGraph *g, Entiers *sommetsSource,
+               Entiers *sommetsDestination, EntiersEntiers &Partition)
+{
+    int val;
+    Entiers sommets_adj;
+    if((sommetsSource->size()-1)==0){
+        val=0;
+        std::cout<<"Entré dans le debug ! "<<std::endl;
+        Entiers tailles;
+        for(uint i=0;i<Partition.size();i++){
+            tailles.push_back(Partition.at(i)->size());
+        }
+        uint tmp=*max_element(tailles.begin(),tailles.end());
+        for(uint i=0; i<Partition.size();i++){
+            if(Partition.at(i)->size()==tmp)
+                gggp_pond(g,Partition[i],sommetsDestination,Partition);
+            break;
+        }
+    }
+    else
+        val=rand_fini(0,sommetsSource->size()-1);//Tirage aléatoire de l'indice du premier sommet entre 0 et taille du tableau -1
+    double poids_max=0;
+    for(uint i=0;i<sommetsSource->size();i++){
+        poids_max+=(*g)[sommetsSource->at(i)]._weight;
+    }
+    poids_max/=2.;
+    double poids=(*g)[sommetsSource->at(val)]._weight;
+    std::vector<float> sommets_cut;
+
+    sommetsDestination->push_back(sommetsSource->at(val));
+    sommetsSource->erase(sommetsSource->begin() + val);
+
+    if(sommetsSource->size()<2)
+        return;
+
+    while(poids<poids_max)
+    {
+        Liste_Voisin(*sommetsDestination,sommets_adj,*g);
+        if((sommets_adj.size()==0))
+        {
+            std::cout<<"Je suis sorti !!!! "<<std::endl;
+            return;
+        }
+        else{
+            sort(sommets_adj.begin(), sommets_adj.end());
+
+            for(uint i=0;i<sommets_adj.size();i++)
+            {
+                sommets_cut.push_back(Cout_coupe_pond(*sommetsDestination,sommets_adj[i],*g));
+            }
+            sommetsDestination->push_back(sommets_adj[recherche_val2(sommets_cut,*min_element(sommets_cut.begin(),sommets_cut.end()))]);
+            poids+=(*g)[sommets_adj[recherche_val2(sommets_cut,*min_element(sommets_cut.begin(),sommets_cut.end()))]]._weight;
+            suprim_val(*sommetsSource, sommets_adj[recherche_val2(sommets_cut,*min_element(sommets_cut.begin(),sommets_cut.end()))]);
+            suprim_val(sommets_adj, sommets_adj[recherche_val2(sommets_cut,*min_element(sommets_cut.begin(),sommets_cut.end()))]);
+
+            sommets_cut.clear();
+
+        }
+    }
+
+    edge_t e1;
+    // bool found;
+
+    for (uint i=0; i<sommetsSource->size();i++)
+    {
+        for (uint j=0; j<sommetsDestination->size();j++)
+        {
+            //tie(e1,found)=edge(vertex(sommetsSource->at(i),*g),vertex(sommetsDestination->at(j),*g),*g);
+            //if((*g)[e1]._weight!=0){
+            remove_edge(sommetsSource->at(i),sommetsDestination->at(j),*g);
+            //}
+        }
+    }
+    sort(sommetsDestination->begin(), sommetsDestination->end());
+}
+
+void Iter_2l(EntiersEntiers &part, int nbr_parties, UnorientedGraph *g,
+             const std::string &nom)
+{
+    if (nom!="gggp_pond"){
+        //std::cout<<"je jsuis dans gggp"<<std::endl;
+
+        for(int i = 0; i<floor(log(nbr_parties)/log(2)); i++)
+        {
+            //std::cout<<"Et un tours de plus !!!! "<<std::endl;
+            for(int j = 0; j< pow(2,i);j++)
+            {
+                Entiers *Q = new Entiers();
+                gggp(g,part[j],Q,part);
+                part.push_back(Q);
+            }
+
+            /*std::cout<<"affichage de la partiton en cours : "<<std::endl;
+              for(int k=0; k<part.size(); k++)
+              {
+              for(int j=0; j<part[k].size(); j++)
+              {
+              std::cout<<part[k][j]<<std::endl;
+              }
+              std::cout<<"\n"<<std::endl;
+              }*/
+            //std::cout<<"taille du tableau : "<<part.size()<<std::endl;
+        }
+    } else {
+        //std::cout<<"je jsuis dans gggp_pond"<<std::endl;
+
+        for(int i = 0; i<floor(log(nbr_parties)/log(2)); i++)
+        {
+            std::cout<<"Et un tours de plus !!!! "<<std::endl;
+            for(int j = 0; j< pow(2,i);j++)
+            {
+                Entiers *Q = new Entiers();
+                gggp_pond(g,part.at(j),Q,part);
+                std::clog<<"sortie du gggp_pond"<<std::endl;
+                part.push_back(Q);
+            }
+
+            std::cout<<"****"<<std::endl;
+            for(uint k=0; k<part.size(); k++)
+            {
+                for(uint j=0; j<part[k]->size(); j++)
+                {
+                    std::cout<<part.at(k)->at(j)<<std::endl;
+                }
+                std::cout<<"\n"<<std::endl;
+            }
+            std::cout<<"****"<<std::endl;
+            std::cout<<"taille du tableau : "<<part.size()<<std::endl;
+        }
+    }
+}
+
+void bissectionRec(UnorientedGraph *g, EntiersEntiers &Partition,
+                   int nbr_parties, const std::string &nom)
+{
+    if((nbr_parties&(nbr_parties-1))==0)
+    {
+        //std::cout<<"C'est de la forme 2l : "<<nbr_parties<<std::endl;
+        Iter_2l(Partition,nbr_parties,g,nom);
+    } else {
+        int puissance_2=0;
+
+        Entiers tailles;
+
+        while(pow(2,puissance_2)<nbr_parties)
+            puissance_2++;
+
+
+        Iter_2l(Partition,pow(2,puissance_2-1),g,nom);
+
+        for(unsigned int i = 0; i< Partition.size() -1 ; i++)
+        {
+            for(EntiersEntiers::iterator it1 = Partition.begin() + i ; it1!=Partition.end(); it1++)
+            {
+                if((*it1)->size() > Partition.at(i)->size())
+                    Partition.at(i)->swap(**it1);
+            }
+        }
+        /*std::cout<<"****"<<std::endl;
+          for(int k=0; k<Partition.size(); k++)
+          {
+          for(int j=0; j<Partition[k]->size(); j++)
+          {
+          std::cout<<Partition[k]->at(j)<<std::endl;
+          }
+          std::cout<<"\n"<<std::endl;
+          }
+          std::cout<<"****"<<std::endl;
+          std::cout<<"Et on termine les dernières bissections !!!! "<<std::endl;*/
+        for(int j = 0; j<nbr_parties-pow(2,puissance_2-1);j++)
+        {
+            Entiers *Q = new Entiers();
+            if(nom!="gggp_pond")
+                gggp(g,Partition.at(j),Q,Partition);
+            else
+                gggp_pond(g,Partition.at(j),Q,Partition);
+            Partition.push_back(Q);
+            //Q.clear();
+        }
+    }
+}
+
+/**
+ * Fonction réalisant un partitionnement pseudo aléatoire suivant un voisinage.
+ * @param *g : adresse d'un graphe de type boost graphe undirected
+ * @param Partition : vecteur contenant des vecteurs d'entiers [tableau contenant les parties de la partition]
+ * @param nbr_partie : entier correspondant au nombre de parties voulues pour la partition
+ * @return
+ */
+
+void Pseudo_random_partitioning(UnorientedGraph *g, EntiersEntiers &Partition,
+                                uint nbr_parties)
+{
+    /*
+     * Principe : distribution des sommets de la première partie en plusieurs autres parties
+     * Le partitionnement étant pseudo aléatoire il n'y a pas de contrainte stricte sur le nombre
+     * de sommets par partie
+     */
+
+
+    uint size = Partition.at(0)->size();
+    uint cpt_sommets=1;
+    int val;
+    uint cpt;
+
+    if(nbr_parties==size){
+        for(uint i = 0; i < nbr_parties;i++){
+            if(Partition.at(0)->size()!=1)
+            {
+                val=rand_fini(0,Partition.at(0)->size()-1);//tirage aléatoire d'un sommets
+            }
+            else
+                val=0;
+
+            int vertex = Partition.at(0)->at(val);
+            Entiers *part = new Entiers();
+            part->push_back(vertex);// ajout du sommet tiré
+            suprim_val(*Partition.at(0),vertex);//suppression du sommet dans la premiere partie
+
+
+        }
+    }
+    /*
+     * Boucle sur le nombre de partie à réaliser
+     */
+    for(uint i = 0; i < nbr_parties-1;i++){
+        if(Partition.at(0)->size()!=1)
+        {
+            val=rand_fini(0,Partition.at(0)->size()-1);//tirage aléatoire d'un sommets
+        }
+        else
+            val=0;
+        int vertex = Partition.at(0)->at(val);
+        /*
+         * Initialisation d'un pointeur sur un vecteur d'entier, dans notre cas
+         * la n+1 ième partie de la partition
+         */
+        Entiers *part = new Entiers();
+        part->push_back(vertex);// ajout du sommet tiré
+        suprim_val(*Partition.at(0),vertex);//suppression du sommet dans la premiere partie
+        cpt=1;
+
+        /*
+         * Pour chaque element de la nouvelle partie faire
+         */
+        for(uint j = 0; j<part->size();j++){
+            /*
+             * Détermination des voisins de chacun des sommets de cette nouvelle
+             * partie et ajoue de ce voisin si celui-ci est présent dans la première partie (Partition[0])
+             */
+            tie(neighbourIt, neighbourEnd) = adjacent_vertices(part->at(j),*g);
+            for (; neighbourIt != neighbourEnd; ++neighbourIt){
+                if(In_tab(*Partition.at(0),*neighbourIt)==1){
+                    std::cout<<"le voisin déplacé est : "<<*neighbourIt<<std::endl;
+                    part->push_back(*neighbourIt);
+                    cpt_sommets++;
+                    suprim_val(*Partition.at(0),*neighbourIt);
+                    cpt++;
+                }
+                /*
+                 * Si le nombre moyen de sommets est atteind dans la partie on sort de la boucle des voisins
+                 * Même chose si l'on a rencontré le nombre total de sommets
+                 */
+                if(cpt==(size/nbr_parties)+1)
+                    break;
+                if(cpt_sommets==size)
+                    break;
+            }
+
+            /*
+             * Même chose
+             */
+            if(cpt==(size/nbr_parties)+1)
+                break;
+            if(cpt_sommets==size)
+                break;
+        }
+        Partition.push_back(part);// ajoue de la nouvelle partie à la partition
+        if(cpt_sommets==size)
+            break;
+    }
+}
+
+OrientedGraphs Multiniveau(uint niveau_contraction,
+                           UnorientedGraph *g,
+                           OrientedGraph *go,
+                           int nbr_parties,
+                           std::string type_methode,
+                           std::string choix_affinage,
+                           std::string type_cut,
+                           Edges& /* edge_partie */,
+                           OutputEdgeList& outputedgeslist,
+                           InputEdgeList& inputedgelist,
+                           Connections& connections)
+{
+    EntiersEntiers Partition;
+    Entiers *part = new Entiers();
+    Base_Graph baseg;
+    baseg.push_back(g);
+    ListEntiersEntiers liste_corr;
+    uint cpt =0;
+    while(num_vertices(*baseg.at(cpt))>niveau_contraction)
+    {
+        contraction_HEM(baseg.at(cpt),baseg,liste_corr);
+        cpt++;
+    }
+
+    for(uint i = 0;i < num_vertices(*baseg.at(baseg.size() - 1)); i++)
+    {
+        part->push_back(i);
+    }
+    Partition.push_back(part);
+
+    bissectionRec(baseg.at(baseg.size()-1),Partition,nbr_parties,type_methode);
+
+    ListEntiersEntiers::iterator lit(liste_corr.end());
+    lit--;
+    for(uint y =0; y<liste_corr.size();y++){
+        projection(Partition,lit);
+        double cut = Cut_cluster(Partition,*baseg.at(baseg.size()-2-y),type_cut);
+        std::cout<<"Cout de coupe avant affinage : "<<cut<<std::endl;
+
+        if(choix_affinage=="charge")
+            Affinage_equilibrage_charge(baseg.at(baseg.size()-2-y),Partition);
+        else
+            Affinage_recherche_locale(baseg.at(baseg.size()-2-y),Partition,cut,type_cut);
+
+        std::cout<<"Cout de coupe après affinage : "<<cut<<std::endl;
+        lit--;
+    }
+
+    OrientedGraphs Graphes = Graph_Partition(Partition, go, g, outputedgeslist,
+                                             inputedgelist, connections);
+
+    for(EntiersEntiers::iterator it = Partition.begin(); it != Partition.end(); it++)
+    {
+        delete *it;
+        *it = NULL;
+    }
+
+    for(ListEntiersEntiers::iterator it = liste_corr.begin(); it != liste_corr.end(); it++)
+    {
+        for(EntiersEntiers::iterator it1 = (*it)->begin(); it1 != (*it)->end(); it1++)
+        {
+            delete *it1;
+            *it1 = NULL;
+        }
+        delete *it;
+        *it = NULL;
+    }
+
+    for(Base_Graph::iterator it = baseg.begin(); it != baseg.end(); it++)
+    {
+        delete *it;
+        *it = NULL;
+    }
+    return Graphes;
+}
+
+} } } // namespace paradevs tests boost_graph

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

@@ -0,0 +1,61 @@
+/**
+ * @file tests/boost_graph/partitioning/gggp.hpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TESTS_BOOST_GRAPH_PARTITIONING_GGGP_H
+#define TESTS_BOOST_GRAPH_PARTITIONING_GGGP_H 1
+
+#include <tests/boost_graph/partitioning/utils.hpp>
+
+namespace paradevs { namespace tests { namespace boost_graph {
+
+void gggp(UnorientedGraph *g, Entiers *sommetsSource,
+          Entiers *sommetsDestination, EntiersEntiers &Partition);
+
+void gggp_pond(UnorientedGraph *g, Entiers *sommetsSource,
+               Entiers *sommetsDestination, EntiersEntiers &Partition);
+
+void Iter_2l(EntiersEntiers &part, int nbr_parties, UnorientedGraph *g,
+             const std::string &nom);
+
+void bissectionRec(UnorientedGraph *g, EntiersEntiers &Partition,
+                   int nbr_parties, const std::string &nom);
+
+void Pseudo_random_partitioning(UnorientedGraph *g, EntiersEntiers &Partition,
+                                uint nbr_parties);
+
+OrientedGraphs Multiniveau(uint niveau_contraction, UnorientedGraph *g,
+                           OrientedGraph *go, int nbr_parties,
+                           std::string type_methode,
+                           std::string choix_affinage,
+                           std::string type_cut,
+                           Edges &edge_partie,
+                           OutputEdgeList &outputedgeslist,
+                           InputEdgeList &inputedgelist,
+                           Connections &connections);
+
+} } } // namespace paradevs tests boost_graph
+
+#endif

+ 201 - 0
src/tests/boost_graph/partitioning/graph_build.cpp

@@ -0,0 +1,201 @@
+/**
+ * @file tests/boost_graph/partitioning/graph_build.cpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <tests/boost_graph/partitioning/graph_build.hpp>
+
+namespace paradevs { namespace tests { namespace boost_graph {
+
+void build_graph(UnorientedGraph& ug, OrientedGraph& og)
+{
+
+    /*
+     * construction graphe Oriente
+     */
+    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(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.), 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.), og);
+    add_edge(v9, v10, EdgeProperties(1.), og);
+
+    og[v6] = VertexProperties(6, 1.5, TOP_PIXEL);
+    og[v8] = VertexProperties(8, 1., TOP_PIXEL);
+    og[v10] = VertexProperties(10, 1.5, TOP_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[v7] = VertexProperties(7, 1., NORMAL_PIXEL);
+    og[v9] = VertexProperties(9, 1.5, NORMAL_PIXEL);
+
+    /*
+     * construction graphe Non Oriente
+     */
+
+    vertex_t v01 = boost::add_vertex(ug);
+    vertex_t v11 = boost::add_vertex(ug);
+    vertex_t v21 = boost::add_vertex(ug);
+    vertex_t v31 = boost::add_vertex(ug);
+    vertex_t v41 = boost::add_vertex(ug);
+    vertex_t v51 = boost::add_vertex(ug);
+    vertex_t v61 = boost::add_vertex(ug);
+    vertex_t v71 = boost::add_vertex(ug);
+    vertex_t v81 = boost::add_vertex(ug);
+    vertex_t v91 = boost::add_vertex(ug);
+    vertex_t v101 = boost::add_vertex(ug);
+
+    boost::add_edge(v01, v11, EdgeProperties(1.), ug);
+    boost::add_edge(v01, v21, EdgeProperties(1.), ug);
+    boost::add_edge(v01, v31, EdgeProperties(1.), ug);
+    boost::add_edge(v11, v21, EdgeProperties(1.), ug);
+    boost::add_edge(v11, v41, EdgeProperties(1.), ug);
+    boost::add_edge(v11, v51, EdgeProperties(1.), ug);
+    boost::add_edge(v11, v61, EdgeProperties(1.), ug);
+    boost::add_edge(v21, v61, EdgeProperties(1.), ug);
+    boost::add_edge(v21, v31, EdgeProperties(1.), ug);
+    boost::add_edge(v31, v91, EdgeProperties(1.), ug);
+    boost::add_edge(v31, v101, EdgeProperties(1.), ug);
+    boost::add_edge(v41, v51, EdgeProperties(1.), ug);
+    boost::add_edge(v51, v61, EdgeProperties(1.), ug);
+    boost::add_edge(v41, v71, EdgeProperties(1.), ug);
+    boost::add_edge(v41, v81, EdgeProperties(1.), ug);
+    boost::add_edge(v71, v81, EdgeProperties(1.), ug);
+    boost::add_edge(v91, v101, EdgeProperties(1.), ug);
+
+    ug[v61] = VertexProperties(60, 1.5, TOP_PIXEL);
+    ug[v81] = VertexProperties(80, 1, TOP_PIXEL);
+    ug[v101] = VertexProperties(100, 1.5, TOP_PIXEL);
+    ug[v01] = VertexProperties(0, 3, NORMAL_PIXEL);
+    ug[v11] = VertexProperties(10, 2, NORMAL_PIXEL);
+    ug[v21] = VertexProperties(20, 2, NORMAL_PIXEL);
+    ug[v31] = VertexProperties(30, 2, NORMAL_PIXEL);
+    ug[v41] = VertexProperties(40, 1.5, NORMAL_PIXEL);
+    ug[v51] = VertexProperties(50, 1.5, NORMAL_PIXEL);
+    ug[v71] = VertexProperties(70, 1, NORMAL_PIXEL);
+    ug[v91] = VertexProperties(90, 1.5, NORMAL_PIXEL);
+
+    /* property_map<UnorientedGraph,vertex_degree_t>::type
+     * poids_sommets=get(vertex_degree_t(),*g);
+
+     add_edge(0,1,1,*g);
+     add_edge(0,2,1,*g);
+     add_edge(0,3,1,*g);
+     add_edge(1,2,1,*g);
+     add_edge(1,4,1,*g);
+     add_edge(1,5,1,*g);
+     add_edge(1,6,1,*g);
+     add_edge(2,6,1,*g);
+     add_edge(2,3,1,*g);
+     add_edge(3,18,1,*g);
+     add_edge(3,21,1,*g);
+     add_edge(4,5,1,*g);
+     add_edge(4,7,1,*g);
+     add_edge(4,8,1,*g);
+     add_edge(4,9,1,*g);
+     add_edge(5,6,1,*g);
+     add_edge(6,15,1,*g);
+     add_edge(6,16,1,*g);
+     add_edge(6,17,1,*g);
+     add_edge(7,8,1,*g);
+     add_edge(7,10,1,*g);
+     add_edge(7,11,1,*g);
+     add_edge(8,9,1,*g);
+     add_edge(8,11,1,*g);
+     add_edge(8,12,1,*g);
+     add_edge(9,13,1,*g);
+     add_edge(9,14,1,*g);
+     add_edge(10,11,1,*g);
+     add_edge(11,12,1,*g);
+     add_edge(13,14,1,*g);
+     add_edge(15,16,1,*g);
+     add_edge(16,17,1,*g);
+     add_edge(17,19,1,*g);
+     add_edge(19,20,1,*g);
+     add_edge(22,23,1,*g);
+     add_edge(18,17,1,*g);
+     add_edge(18,19,1,*g);
+     add_edge(18,20,1,*g);
+     add_edge(18,21,1,*g);
+     add_edge(21,22,1,*g);
+     add_edge(21,23,1,*g);
+
+     put(poids_sommets,0,3);
+
+     for(int i=1;i<4;i++)
+     put(poids_sommets,i,2.5);
+     for(int i=4;i<7;i++)
+     put(poids_sommets,i,2);
+     put(poids_sommets,18,2);
+     put(poids_sommets,21,2);
+     for(int i=7;i<10;i++)
+     put(poids_sommets,i,1.5);
+     for(int i=15;i<18;i++)
+     put(poids_sommets,i,1.5);
+     put(poids_sommets,19,1.5);
+     put(poids_sommets,20,1.5);
+     put(poids_sommets,22,1.5);
+     put(poids_sommets,23,1.5);
+     for(int i=10;i<15;i++)
+     put(poids_sommets,i,1);
+
+     tie(vertexIt, vertexEnd) = vertices(*g);
+     for (; vertexIt != vertexEnd; ++vertexIt)
+     {
+     std::cout << *vertexIt << " est connecté avec ";
+     tie(neighbourIt, neighbourEnd) = adjacent_vertices(*vertexIt, *g);
+     for (; neighbourIt != neighbourEnd; ++neighbourIt)
+     std::cout << *neighbourIt << " ";
+     std::cout<<" et son poids est de "<< poids_sommets[*vertexIt];
+     std::cout << "\n";
+     }*/
+}
+
+} } } // namespace paradevs tests boost_graph

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

@@ -0,0 +1,38 @@
+/**
+ * @file tests/boost_graph/partitioning/graph_build.hpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TESTS_BOOST_GRAPH_PARTITIONING_GRAPH_BUILD_H
+#define TESTS_BOOST_GRAPH_PARTITIONING_GRAPH_BUILD_H
+
+#include <tests/boost_graph/partitioning/defs.hpp>
+
+namespace paradevs { namespace tests { namespace boost_graph {
+
+void build_graph(UnorientedGraph& g, OrientedGraph& graph);
+
+} } } // namespace paradevs tests boost_graph
+
+#endif

+ 289 - 0
src/tests/boost_graph/partitioning/main.cpp

@@ -0,0 +1,289 @@
+/**
+ * @file tests/boost_graph/partitioning/main.cpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <tests/boost_graph/partitioning/gggp.hpp>
+#include <tests/boost_graph/partitioning/graph_build.hpp>
+
+#include <boost/timer.hpp>
+
+#include <iostream>
+
+using namespace paradevs::tests::boost_graph;
+
+UnorientedGraph::vertex_iterator vertexIt, vertexEnd;
+UnorientedGraph::adjacency_iterator neighbourIt, neighbourEnd;
+
+OrientedGraph::vertex_iterator vertexIto, vertexEndo;
+OrientedGraph::adjacency_iterator neighbourIto, neighbourEndo;
+
+int main()
+{
+    boost::timer t;
+
+    srand((unsigned)time(NULL));
+
+    UnorientedGraph* g = new UnorientedGraph();
+    OrientedGraph* go = new OrientedGraph();
+
+    build_graph(*g, *go);
+
+    int nbr_parties = 3;
+    Edges edge_partie;
+    OutputEdgeList outputedgeslist(nbr_parties);
+    InputEdgeList inputedgelist;
+    Connections connections;
+
+    /*EntiersEntiers Partition;
+      Entiers *part = new Entiers();
+      Base_Graph baseg;
+      baseg.push_back(g);
+      ListEntiersEntiers liste_corr;
+      uint cpt=0;
+      while(num_vertices(*baseg.at(cpt))>4)
+      {
+      contraction_HEM(baseg.at(cpt),baseg,liste_corr);
+      cpt++;
+      }
+
+      edge_t e1;
+      bool found;
+      for(uint i=0;i<baseg.size();i++){
+      tie(vertexIt, vertexEnd) = vertices((*baseg.at(i)));
+      for (; vertexIt != vertexEnd; ++vertexIt)
+      {
+      std::cout << *vertexIt << " est connecté avec ";
+      tie(neighbourIt, neighbourEnd) = adjacent_vertices(*vertexIt, (*baseg.at(i)));
+      for (; neighbourIt != neighbourEnd; ++neighbourIt){
+      std::cout << *neighbourIt << " ";
+      tie(e1,found)=edge(vertex(*vertexIt,*baseg.at(i)),vertex(*neighbourIt,*baseg.at(i)),*baseg.at(i));
+      std::cout << "poids arc : "<<(*baseg.at(i))[e1]._weight<<"\n";
+      }
+      std::cout<<" et son poids est de "<< (*baseg.at(i))[*vertexIt]._weight<<std::endl;
+      }
+      std::cout<<"\n"<<std::endl;
+      }
+
+
+      for(int i =0;i<num_vertices(*baseg.at(baseg.size()-1));i++)
+      {
+      part->push_back(i);
+      }
+      Partition.push_back(part);
+
+      bissectionRec(baseg.at(baseg.size()-1),Partition,3,"gggp_pond");
+      //Pseudo_random_partitioning(g,Partition,3);
+      std::cout<<"Nombre de parties : "<<Partition.size()<<std::endl;
+
+      std::clog<<"Resultat de la partition : "<<std::endl;
+      std::cout<<"****"<<std::endl;
+      for(uint i = 0; i< Partition.size() ; i++)
+      {
+      for(uint j = 0 ; j<Partition.at(i)->size() ; j++)
+      {
+      std::cout<<(*baseg.at(baseg.size()-1))[Partition.at(i)->at(j)]._index<<std::endl;
+      }
+      std::cout<<"\n"<<std::endl;
+      }
+      std::cout<<"****"<<std::endl;
+
+
+      ListEntiersEntiers::iterator lit(liste_corr.end());
+      lit--;
+      for(uint y =0; y<liste_corr.size();y++){
+      projection(Partition,lit);
+
+      std::clog<<"liste de correspondance : "<<std::endl;
+      for(uint i = 0; i < (*lit)->size(); i++)
+      {
+      for(uint j = 0; j < (*lit)->at(i)->size();j++){
+      std::cout<<(*lit)->at(i)->at(j)<<std::endl;;
+      }
+      std::cout<<"\n"<<std::endl;
+      }
+
+      std::clog<<"Resultat projection : "<<std::endl;
+      for(uint i = 0; i< Partition.size() ; i++)
+      {
+      for(uint j = 0 ; j<Partition.at(i)->size() ; j++)
+      {
+      std::cout<<Partition.at(i)->at(j)<<std::endl;
+      }
+      std::cout<<"\n"<<std::endl;
+      }
+
+      double cut = Cut_cluster(Partition,*baseg.at(baseg.size()-2-y),"norm");
+
+      std::cout<<"Cout de coupe avant affinage : "<<cut<<std::endl;
+
+      Affinage_recherche_locale(baseg.at(baseg.size()-2-y),Partition,cut,"norm");
+      //Affinage_equilibrage_charge(baseg.at(baseg.size()-2-y),Partition);
+      std::cout<<"Cout de coupe après affinage : "<<cut<<std::endl;
+      std::cout<<"\n"<<std::endl;
+      double tmp = Cut_cluster(Partition,*baseg.at(baseg.size()-2-y),"norm");
+      std::cout<<"verification cout de coupe après affinage : "<<tmp<<std::endl;
+      std::cout<<"\n"<<std::endl;
+      std::clog<<"Partition après affinage : "<<std::endl;
+      for(uint i = 0; i< Partition.size() ; i++)
+      {
+      for(uint j = 0 ; j<Partition.at(i)->size() ; j++)
+      {
+      std::cout<<Partition.at(i)->at(j)<<std::endl;
+      }
+      std::cout<<"\n"<<std::endl;
+      }
+
+      lit--;
+      }
+      std::cout<<"mathieu va me buter ! et en plus c'est walker !!!"<<std::endl;
+      std::cout<<"\n"<<std::endl;
+
+      OrientedGraphs Graphes = Graph_Partition(Partition,go,g,outputedgeslist,inputedgelist,connections);*/
+
+    OrientedGraphs graphs = Multiniveau(4, g, go, nbr_parties, "gggp_pond",
+                                        "cut_norm", "norm", edge_partie ,
+                                        outputedgeslist, inputedgelist,
+                                        connections);
+
+    std::cout << std::endl;
+    std::cout << "Sous Graphes :" << std::endl;
+    for (uint i = 0; i< graphs.size(); i++) {
+        tie(vertexIto, vertexEndo) = vertices(graphs[i]);
+        for (; vertexIto != vertexEndo; ++vertexIto) {
+            std::cout << graphs[i][*vertexIto]._index
+                      << " est connecté avec ";
+            tie(neighbourIto, neighbourEndo) = adjacent_vertices(*vertexIto,
+                                                                 graphs[i]);
+            for (; neighbourIto != neighbourEndo; ++neighbourIto)
+                std::cout << graphs[i][*neighbourIto]._index << " ";
+            std::cout << " et son poids est de "
+                      << graphs[i][*vertexIto]._weight<<std::endl;
+        }
+        std::cout << std::endl;
+    }
+
+    std::clog << "OutputEdgeList :" << std::endl;
+    for (uint i = 0; i < outputedgeslist.size(); i++) {
+        for (uint j = 0; j < outputedgeslist.at(i).size(); j++){
+            std::cout << outputedgeslist.at(i).at(j).first << " "
+                      << outputedgeslist.at(i).at(j).second << std::endl;
+        }
+    }
+    std::cout << std::endl;
+
+    std::clog << "InputEdgeList :" << std::endl;
+    for (uint i = 0; i < inputedgelist.size(); i++) {
+        for (uint j = 0; j < inputedgelist.at(i).size(); j++){
+            std::cout << inputedgelist.at(i).at(j).first << " "
+                      << inputedgelist.at(i).at(j).second << std::endl;
+        }
+    }
+    std::cout << std::endl;
+
+    std::clog << "Connections :" << std::endl;
+    for (uint i = 0; i < connections.size(); i++) {
+        std::cout << "(" << connections.at(i).first.first << ","
+                  << connections.at(i).first.second << ") -> ("
+                  << connections.at(i).second.first << ","
+                  << connections.at(i).second.second << ")"
+                  << std::endl;
+    }
+
+    /*for(EntiersEntiers::iterator it = Partition.begin(); it != Partition.end(); it++)
+      {
+      delete *it;
+      *it = NULL;
+      }
+
+      for(ListEntiersEntiers::iterator it = liste_corr.begin(); it != liste_corr.end(); it++)
+      {
+      for(EntiersEntiers::iterator it1 = (*it)->begin(); it1 != (*it)->end(); it1++)
+      {
+      delete *it1;
+      *it1 = NULL;
+      }
+      delete *it;
+      *it = NULL;
+      }
+
+      for(Base_Graph::iterator it = baseg.begin(); it != baseg.end(); it++)
+      {
+      delete *it;
+      *it = NULL;
+      }*/
+
+    // for(OrientedGraphs::iterator it = Graphes.begin(); it != Graphes.end();
+    //     it++) {
+    //     delete *it;
+    //     *it = NULL;
+    // }
+
+    std::cout << "Duration : " << t.elapsed() << " seconds" << std::endl;
+
+    //EntiersEntiersEntiers Stock_Partition;
+    /*for(int i=0;i<11;i++){
+      g1=g;
+      Partition1=Partition;
+      bissectionRec(g1,Partition1,4,"gggp");
+      Stock_Partition.push_back(Partition1);
+      Cut.push_back(Cut_cluster(Partition1,g));
+      Partition1.clear();
+      g1.clear();
+      }
+
+      for(int i =0;i<Cut.size();i++){
+      std::cout<<Cut[i]<<std::endl;
+      }
+      std::cout<<"\n"<<std::endl;
+      std::cout<<recherche_val_double(Cut,*min_element(Cut.begin(),Cut.end()))<<std::endl;
+      std::cout<<"\n"<<std::endl;
+      EntiersEntiers tmp = Stock_Partition[recherche_val_double(Cut,*min_element(Cut.begin(),Cut.end()))];
+      for(int i =0; i<tmp.size();i++){
+      for(int j=0; j<tmp[i].size();j++){
+      std::cout<<tmp[i][j]<<std::endl;
+      }
+      std::cout<<"\n"<<std::endl;
+      }*/
+
+    /*EntiersEntiers liste_corr;
+    //double cut = Cut_cluster(Partition,g);
+    Base_Graph baseg;
+    baseg.push_back(g);
+
+
+
+
+    std::cout<<"LIste des noeuds fusionés : "<<std::endl;
+    for(uint i = 0; i< liste_corr.size() ; i++)
+    {
+    for(uint j = 0 ; j<liste_corr.at(i).size() ; j++)
+    {
+    std::cout<<liste_corr[i][j]<<std::endl;
+    }
+    std::cout<<"\n"<<std::endl;
+    }*/
+
+
+}

+ 1302 - 0
src/tests/boost_graph/partitioning/utils.cpp

@@ -0,0 +1,1302 @@
+/**
+ * @file tests/boost_graph/partitioning/utils.cpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <tests/boost_graph/partitioning/utils.hpp>
+
+#include <algorithm>
+#include <iostream>
+
+namespace paradevs { namespace tests { namespace boost_graph {
+
+UnorientedGraph::vertex_iterator vertexIt, vertexEnd;
+UnorientedGraph::adjacency_iterator neighbourIt, neighbourEnd;
+
+OrientedGraph::vertex_iterator vertexIto, vertexEndo;
+OrientedGraph::adjacency_iterator neighbourIto, neighbourEndo;
+
+struct myclass
+{
+    bool operator() (Entiers *i, Entiers *j)
+    { return i->at(0) < j->at(0); }
+} myobject;
+
+struct myclass2
+{
+    bool operator() (Entiers *i, Entiers *j, UnorientedGraph *g)
+    { return Calcul_poids(i,g) < Calcul_poids(j,g); }
+} mon_tri;
+
+/**
+ * Fonction de verification de la connexité d'un graphe
+ * @param *g : adresse d'un graphe de type boost graphe undirected
+ * @param Partition : vecteur contenant des vecteurs d'entiers [tableau contenant les parties de la partition]
+ * @param part : vecteur d'entier (une partie de la partition)
+ * @return un booleen
+ */
+bool Est_connexe(UnorientedGraph *g, EntiersEntiers Partition, Entiers &part)
+{
+    /*
+     * Copie du graphe contenu par l'adresse *g
+     */
+    UnorientedGraph copie_g;
+    copie_g = *g;
+
+    /*
+     * Modification du graphe copié afin de générer des sous graphes liés aux différentes parties
+     */
+    for (uint i=0; i<Partition.size()-1;i++)
+    {
+        for (uint j=1+i; j<Partition.size();j++)
+        {
+            for (uint k=0; k<Partition.at(i)->size();k++)
+            {
+                for (uint y=0; y<Partition.at(j)->size();y++)
+                {
+                    remove_edge(Partition.at(i)->at(k),Partition.at(j)->at(y),copie_g); //suppression de certains arcs
+                }
+            }
+        }
+    }
+
+    /*
+     * Objectif : déterminer s'il existe un chemin reliant tous les noeuds d'une même partie
+     * Méthode : partir d'un sommet de départ tiré aléatoirement dans la partie "part" et parcourir l'ensemble de ces voisins.
+     * Si le voisin recontré n'est pas contenu dans le vecteur "sommets" il est ajouté. Le processus est répété pour chaque
+     * nouveau sommet ajouté au vecteur.
+     * Résultat : si le nombre de sommets contenu dans le vecteur "part" est égale au nombre de sommets du vecteur "sommets"
+     * alors le graphe est connexe
+     */
+
+    int val;
+    Entiers sommets;
+
+    if(part.size()==1)
+        val = 0;
+    else
+        val=rand_fini(0,part.size()-1); //tirage aléatoire d'un sommets
+
+    int vertex = part.at(val);
+    sommets.push_back(vertex); //ajout du sommets à la lsite des sommets parcouru
+
+    /*
+     * Recherche de voisins n'appartenant pas à la liste des sommets parcourus
+     */
+    for(uint i = 0;i<sommets.size();i++){
+        tie(neighbourIt, neighbourEnd) = adjacent_vertices(sommets.at(i),copie_g);
+        for (; neighbourIt != neighbourEnd; ++neighbourIt){
+            if(In_tab(sommets,*neighbourIt)!=1)
+                sommets.push_back(*neighbourIt);
+        }
+    }
+
+    /*
+     * Retour de la réponse vrai ou faux
+     */
+    if(part.size()!=sommets.size())
+        return false;
+    else
+        return true;
+
+}
+
+/**
+ * Fonction de projection
+ * @param Partition : vecteur contenant des vecteurs d'entiers [tableau contenant les parties de la partition]
+ * @param lit : itérateur sur une liste contenant une vecteur de vecteur d'entier
+ * @return
+ */
+
+/*
+ * Objectif : obtenir la correspondance entre les sommets d'un graphe Gn et celui de Gn-1
+ * Méthode : modification des sommets contenus dans "Partition" à l'aide de la liste de correspondance *lit
+ */
+
+void projection(EntiersEntiers &Partition,ListEntiersEntiers::iterator lit)
+{
+
+    /*
+     * Création d'un nouveau vecteur contenant les adresses d'autres vecteur d'entiers.
+     * Celui-ci est conçu pour recevoir les sommets contenus dans la liste de correspondance,
+     * correspondant à la projection des sommets du graphe Gn à celui de Gn-1
+     */
+    EntiersEntiers new_partition;
+    for(uint i = 0; i< Partition.size() ; i++)
+    {
+        Entiers *new_part = new Entiers();
+        for(uint j = 0 ; j<Partition.at(i)->size() ; j++)
+        {
+            for(uint k = 0; k<((*lit)->at(Partition.at(i)->at(j)))->size();k++){
+                new_part->push_back((*lit)->at(Partition.at(i)->at(j))->at(k));
+            }
+
+        }
+        new_partition.push_back(new_part);
+    }
+
+
+    /*
+     * Désalocation mémoire des pointeurs que contient "Partition"
+     */
+    for(EntiersEntiers::iterator it = Partition.begin(); it != Partition.end(); it++)
+    {
+        delete *it;
+        *it = NULL;
+    }
+
+    Partition = new_partition; // copie de new_partition dans Partition
+    for(uint i =0; i<Partition.size(); i++) {
+        // permet de trier chaque  sous vecteur de "Partition"
+        std::sort(Partition[i]->begin(),Partition[i]->end());
+    }
+
+    new_partition.clear();
+}
+
+/**
+ * Fonction qui calcul le poids d'une partie
+ * @param * part : adresse d'un vecteur d'entier, ici une partie de la partition
+ * @param *g : adresse d'un graphe de type boost graphe undirected
+ * @return un type double contenant le poids associé à la partie
+ */
+double Calcul_poids(Entiers *partie, UnorientedGraph *g)
+{
+    double poids=0; // initialisation du poids à 0
+
+    /*
+     * Pour chaque sommet de la partie concerné on ajoute son poids au poids total
+     */
+    for(uint j = 0; j<partie->size();j++){
+        poids+=(*g)[partie->at(j)]._weight;
+    }
+
+    return poids;
+}
+
+/**
+ * Fonction d'affinage suivant un critère de poids
+ * @param *g : adresse d'un graphe de type boost graphe undirected
+ * @param Partition : vecteur contenant des vecteurs d'entiers [tableau contenant les parties de la partition]
+ * @return modification de la partition
+ */
+void Affinage_equilibrage_charge(UnorientedGraph *g, EntiersEntiers &Partition)
+{
+    /*
+     * Calcule de la somme des poids du graphe et le poids moyen à atteindre
+     */
+    double poids_moyen = 0.;
+
+    for(uint i = 0; i < num_vertices(*g); i++) {
+        poids_moyen += (*g)[i]._weight;
+    }
+
+    // détermination du poids moyen à atteindre pour chaque partie
+    poids_moyen /= Partition.size();
+
+    std::vector < double > poids_parties;
+
+    /*
+     * Calcul du poids de chaque partie de la partition
+     */
+    for (uint i = 0; i < Partition.size(); i++) {
+        double tmp = Calcul_poids(Partition.at(i),g);
+
+        poids_parties.push_back(tmp);
+    }
+
+    std::clog << "Poids initial des parties : " << std::endl;
+
+    for (uint i = 0; i < poids_parties.size(); i++){
+        std::cout << poids_parties.at(i) << " ";
+    }
+    std::cout << "\n" << std::endl;
+
+    /*
+     * Le critère d'amélioration consiste à faire tendre vers 0 la somme
+     * des écarts entre le poids des parties et le poids moyen
+     * le "critere" est la somme pour chaque partie de la différence
+     * en valeurs absolues du poids
+     * d'une partie moins le poids moyen divisé par le nombre de parties
+     */
+
+    double critere = 0.;
+
+    for (uint i = 0; i < poids_parties.size(); i++){
+        critere += abs(poids_parties.at(i) - poids_moyen);
+    }
+    critere /= Partition.size();
+
+    // on conserve le poids maximum
+    double p_max = *max_element(poids_parties.begin(), poids_parties.end());
+
+    std::cout << "Valeurs du criètre de départ : " << critere << std::endl;
+
+    // création d'un second critère légérement plsu faible que le premier
+    double best_critere = critere - 1e-7;
+    uint nbr_passage = 1; // initialisation du nombre de passages à 1
+
+    /*
+     * Tant que le critère n'est pas amélioré etque le nombre de
+     * passage est inférieur au nombre de parties on réalise
+     * des modifications sur la partition
+     */
+    while (best_critere < critere or nbr_passage < Partition.size()) {
+        critere = best_critere; //critere devient best_critere
+
+        // recherche la partie associé au poids maximum
+        int cpt = recherche_val_double(poids_parties,p_max);
+        bool decision = false; //initialisatio d'un booleen a false
+        int nbr_pass_interne = 0;
+
+        /*
+         * 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;
+        }
+
+        /*
+         * Si le nombre de sommets d'une partie excéde les 400, on tire au hasar 400 sommets sans remise
+         * et on effectue les modifications (ceci permet d'eviter une explosion des temps de calcul)
+         */
+        int size;
+
+        if(Partition.at(cpt)->size()>400)
+            size = 400;
+        else
+            size = Partition.at(cpt)->size();
+
+        /*
+         * Seconde boucle Tant que sur les sommets d'une partie.
+         * Tant que le critere booleen est vrai et que le nombre de passe interne est inférieur au seuil size faire
+         */
+        while(decision!=true && nbr_pass_interne < size){
+            int vertex = random_orders.at(nbr_pass_interne); //tirage d'un sommets dans la parite de poids maximum
+            Entiers community = Neigh_community(g,Partition,vertex,cpt); // recherche des communautés voisines à ce sommet (s'il est au bord)
+            if(community.size()!=0) // s'il existe au moins une communauté voisine
+            {
+                std::vector<double> new_poids_parties; // initialisation d'un nouveau vecteur contenant des doubles
+                std::vector<double> tmp_critere; // initialisation d'un nouveau vecteur contenant des doubles
+
+                /*
+                 * Pour chacune des parties (communauté) voisine au sommet vertexs faire
+                 */
+                for(uint k = 0; k < community.size();k++)
+                {
+                    new_poids_parties = poids_parties; //copie du tableau de poids des parties dans new_poids_parties
+
+                    /*
+                     * Modification des poids des parties :
+                     * on ajoute le poids du sommets à la partie voisine
+                     * et on soustrait son poids à sa partie d'origine
+                     */
+                    new_poids_parties.at(community.at(k))+=(*g)[vertex]._weight;
+                    new_poids_parties.at(cpt)-=(*g)[vertex]._weight;
+
+                    /*
+                     * Calcul ldu nouveau critère associé à cette modification
+                     */
+                    double new_critere = 0.;
+
+                    for(uint i = 0; i<poids_parties.size();i++){
+                        new_critere += abs(new_poids_parties.at(i)-poids_moyen);
+                    }
+                    new_critere/=Partition.size();
+                    tmp_critere.push_back(new_critere); // enregistrement du résutlat dans le tableau tmp_critere
+                }
+                double val_min = *min_element(tmp_critere.begin(),tmp_critere.end()); // enregistrement de la valeur minimale du tableau tmp_critere
+                int val = recherche_val_double(tmp_critere,val_min); // recherche de la communauté correspondant à cette valeur
+
+                /*
+                 * Si la valeur associé est plus petite et que la partie selectionné n'est pas vérouillée faire
+                 */
+                if(val_min<critere && poids_parties.at(val)!=-1)
+                {
+                    /*
+                     * On change le sommet vertex de partie, il est déplacé vers la partie
+                     * qui permet la meilleure amélioration du critère
+                     */
+                    Partition.at(community.at(val))->push_back(vertex);
+                    suprim_val(*Partition.at(cpt),vertex);
+                    std::sort(Partition.at(community.at(val))->begin(), Partition.at(community.at(val))->end());
+
+                    /*
+                     * Vérification de la sauvegarde de la connexsité,
+                     * si se n'est pas le cas retour à l'état précédent
+                     */
+                    if(Est_connexe(g,Partition,*Partition.at(cpt))!=1)
+                    {
+                        suprim_val(*Partition.at(community.at(val)),vertex);
+                        Partition.at(cpt)->push_back(vertex);
+                        std::sort(Partition.at(cpt)->begin(), Partition.at(cpt)->end());
+                        std::cout<<" C'EST MORT RETOUR EN ARRIERE ! "<<std::endl;
+                    }
+                    else
+                    {
+                        poids_parties = new_poids_parties;
+                        decision = true;
+                        std::cout<<" Modification reussi ! "<<std::endl;
+                    }
+                }
+            }
+            nbr_pass_interne++;
+        }
+        /*
+         * Si aucune modification n'a été réalisé pour cett partie de poids maximum
+         */
+        if(decision==false)
+        {
+            nbr_passage++; // augmentation du nombre de passage
+            poids_parties.at(cpt)=-1; // vérrouillage de la partie
+            std::clog<<"nouveau passag ! "<<std::endl;
+        }
+        else
+        {
+            best_critere = 0.;
+
+            for(uint i = 0; i<poids_parties.size();i++){
+                best_critere += abs(poids_parties.at(i)-poids_moyen);
+            }
+            best_critere/=Partition.size();
+            nbr_passage = 0;
+        }
+
+        std::clog<<"Poids des parties modifié : "<<std::endl;
+        for(uint i = 0; i<poids_parties.size(); i++){
+            std::cout<<poids_parties.at(i)<<" ";
+        }
+        std::cout<<"\n"<<std::endl;
+        p_max = *max_element(poids_parties.begin(),poids_parties.end());
+        std::cout<<"Valeurs du criètre : "<<critere<<std::endl;
+        std::cout<<"Valeurs du best_criètre : "<<best_critere<<std::endl;
+        std::cout<<"Nombre de passage : "<<nbr_passage<<std::endl;
+        std::cout<<"\n"<<std::endl;
+
+    }
+}
+
+Entiers Neigh_community(UnorientedGraph *g, EntiersEntiers &Partition, int vertex, int comm_in)
+{
+    Entiers community;
+    int comm;
+    tie(neighbourIt, neighbourEnd) = adjacent_vertices(vertex,*g);
+    for (; neighbourIt != neighbourEnd; ++neighbourIt){
+        comm = In_community_dichotomie(Partition,*neighbourIt);
+        if(In_tab(community,comm)!=1 && comm!=comm_in)
+            community.push_back(comm);
+    }
+    return community;
+}
+
+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<random_orders.size() ; i++)
+        random_orders.at(i)=i;
+
+    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(random_orders.size()>500)
+        size=500;
+
+    std::vector<std::vector<double> > tabe_cut;
+
+    for(uint k = 0; k < Partition.size();k++){
+        std::vector<double> tmp;
+        double vol = 0.;
+        double cut = Modif_Cut_one_cluster(*Partition.at(k), *g, vol);
+        tmp.push_back(cut);
+        tmp.push_back(vol);
+        tabe_cut.push_back(tmp);
+    }
+
+
+    for(uint i = 0; i < size; i++){
+        if(random_orders.at(i)!=-1){
+            int vertex = random_orders.at(i);
+
+            int comm = In_community_dichotomie(Partition, vertex);
+            Entiers community = Neigh_community(g,Partition,vertex,comm);
+            std::vector<double> tmp_cut;
+
+            if(community.size()!=0 && Partition.at(comm)->size()!=1){
+                tmp_cut = modif_cut_tmp(g,Partition,tabe_cut,vertex,comm,community,cut,name);
+                for(uint z = 0; z<tmp_cut.size(); z++){
+                    std::cout<<tmp_cut.at(z)<<std::endl;
+                }
+                std::cout<<"\n"<<std::endl;
+                double cut_min = *min_element(tmp_cut.begin(),tmp_cut.end());
+                std::cout<<"cout de coupe minimum de la liste : "<<cut_min<<std::endl;
+                if(cut_min<cut){
+                    std::clog<<"Changement ! "<<std::endl;
+                    int tmp = recherche_val_double(tmp_cut,cut_min);
+                    cut=cut_min;
+                    Partition.at(community.at(tmp))->push_back(vertex);
+                    suprim_val(*Partition.at(comm),vertex);
+                    std::sort(Partition.at(community.at(tmp))->begin(), Partition.at(community.at(tmp))->end());
+                    tabe_cut.clear();
+                    for(uint k = 0; k < Partition.size();k++){
+                        std::vector<double> tmp;
+                        double vol = 0.;
+                        double cut = Modif_Cut_one_cluster(*Partition.at(k), *g, vol);
+                        tmp.push_back(cut);
+                        tmp.push_back(vol);
+                        tabe_cut.push_back(tmp);
+                    }
+
+                }
+            }
+
+            //Modif_fonction_Gain_Cut(Partition,g,community,vertex,cut,name);
+
+
+            /*if(Est_connexe(g,Partition,*Partition.at(comm))!=1)
+              {
+              suprim_val(*Partition.at(community.at(tmp)),vertex);
+              Partition.at(comm)->push_back(vertex);
+              std::sort(*Partition.at(comm));
+              std::cout<<" C'EST MORT RETOUR EN ARRIERE ! "<<std::endl;
+              }*/
+
+        }
+    }
+}
+
+double Modif_Cut_one_cluster(Entiers &cluster, UnorientedGraph &g, double &vol)
+{
+	edge_t e1;
+	bool found;
+	double cpt=0.;
+	for(uint i=0;i<cluster.size();i++){
+		tie(neighbourIt, neighbourEnd) = adjacent_vertices(cluster.at(i), g);
+		for (; neighbourIt != neighbourEnd; ++neighbourIt){
+			tie(e1,found)=edge(vertex(cluster[i],g),vertex(*neighbourIt,g),g);
+			if(In_tab(cluster,*neighbourIt)!=1){
+				cpt+=g[e1]._weight;
+			}
+		}
+	}
+	vol = Cluster_Degree(g,cluster);
+	return cpt/2.;
+
+}
+
+std::vector<double> modif_cut_tmp(UnorientedGraph *g, EntiersEntiers &Partition, std::vector<std::vector<double> > tabe_cut, int vertexs, int comm_in, Entiers community, double cut,std::string name){
+	edge_t e1;
+	bool found;
+	std::cout<<"le sommet tiré est : "<<vertexs<<std::endl;
+
+	if(name!="norm")
+	{
+		std::vector<double> modif_cut(community.size());
+		double cpt_comm_in;
+		double cpt_comm_out;
+		for(uint i =0; i<community.size(); i++){
+			double tmp_cut = cut;
+			cpt_comm_in=0;
+			cpt_comm_out=0;
+
+			tie(neighbourIt, neighbourEnd) = adjacent_vertices(vertexs,*g);
+			for (; neighbourIt != neighbourEnd; ++neighbourIt){
+				tie(e1,found)=edge(vertex(vertexs,*g),vertex(*neighbourIt,*g),*g);
+				if(In_tab(*Partition.at(comm_in),*neighbourIt)==1)
+					cpt_comm_in+=(*g)[e1]._weight;
+				else if(In_tab(*Partition.at(community.at(i)),*neighbourIt)==1)
+					cpt_comm_out+=(*g)[e1]._weight;
+			}
+
+			tmp_cut+=cpt_comm_in;
+			tmp_cut-=cpt_comm_out;
+
+			modif_cut.at(i)=tmp_cut;
+		}
+		return modif_cut;
+	}
+	else{
+		std::vector<double> modif_cut(community.size());
+		double cpt_comm_in;
+		double cpt_comm_out;
+		double tmp_cut;
+
+		for(uint i =0; i<community.size(); i++){
+			std::vector<std::vector<double> > tab_cut = tabe_cut;
+
+			tmp_cut =0.;
+			cpt_comm_in=0.;
+			cpt_comm_out=0.;
+
+			tie(neighbourIt, neighbourEnd) = adjacent_vertices(vertexs,*g);
+			for (; neighbourIt != neighbourEnd; ++neighbourIt){
+				tie(e1,found)=edge(vertex(vertexs,*g),vertex(*neighbourIt,*g),*g);
+				if(In_tab(*Partition.at(comm_in),*neighbourIt)==1)
+					cpt_comm_in+=(*g)[e1]._weight;
+				else if(In_tab(*Partition.at(community.at(i)),*neighbourIt)==1)
+					cpt_comm_out+=(*g)[e1]._weight;
+			}
+
+			cpt_comm_in/=2.;
+			cpt_comm_out/=2.;
+
+			tab_cut.at(comm_in).at(0)+=cpt_comm_in;
+			tab_cut.at(comm_in).at(0)-=cpt_comm_out;
+			tab_cut.at(comm_in).at(1)-= Degree(*g ,vertexs);
+
+			tab_cut.at(community.at(i)).at(0)+=cpt_comm_in;
+			tab_cut.at(community.at(i)).at(0)-=cpt_comm_out;
+			tab_cut.at(community.at(i)).at(1)+= Degree(*g ,vertexs);
+
+			for(uint j = 0; j < tab_cut.size();j++){
+				tmp_cut+=((tab_cut.at(j).at(0))/(tab_cut.at(j).at(1)));
+			}
+
+			modif_cut.at(i)=tmp_cut;
+		}
+		return modif_cut;
+	}
+}
+void Modif_fonction_Gain_Cut(EntiersEntiers &Partition,UnorientedGraph *g, Entiers &community, int val, double &cut,std::string name)
+{
+	/*std::cout<<"Nombre de communauté voisine : "<<community.size()<<std::endl;
+	std::cout<<"\n"<<std::endl;*/
+	for(uint i = 0; i<community.size();i++){
+		EntiersEntiers new_partition;
+		for(uint k = 0; k < Partition.size();k++){
+			Entiers * tmp = new Entiers();
+			for(uint j = 0;j<Partition.at(k)->size();j++){
+				tmp->push_back(Partition.at(k)->at(j));
+			}
+			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;
+		if(coupe<cut)
+		{
+			for(EntiersEntiers::iterator it = Partition.begin(); it != Partition.end(); it++)
+			{
+				delete *it;
+				*it = NULL;
+			}
+			Partition = new_partition;
+			cut = coupe;
+		}
+		else
+		{
+			for(EntiersEntiers::iterator it = new_partition.begin(); it != new_partition.end(); it++)
+			{
+				delete *it;
+				*it = NULL;
+			}
+		}
+	}
+}
+
+void contraction_HEM(UnorientedGraph *g, Base_Graph &baseg, ListEntiersEntiers &liste_corr){
+	UnorientedGraph *gtmp = new UnorientedGraph();
+	*gtmp=*g;
+	Entiers Random_list_vertices; // 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);
+	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;
+	}
+
+	/*
+	 * Pour chaque sommet non verrouiller faire ....
+	 */
+	for(uint i=0; i<nbr_vertex; i++){
+		int vertexs = Random_list_vertices[i];
+		if(vertexs!=-1){
+			Entiers liste_voisin = Liste_adjacence(*gtmp,vertexs,Random_list_vertices); // Recherche des sommets adjacents au sommets  tiré
+			if(liste_voisin.size()!=0){
+				/*
+				 * S'il en existe au mois un sommet adjacent au sommet tiré qui n'est pas verrouillé, on
+				 * 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'identifiant le plus petit
+				 */
+				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);
+					if((*gtmp)[e1]._weight>poids_a){
+						best_vertexs = liste_voisin[j];
+						poids_a = (*gtmp)[e1]._weight;
+					}
+				}
+
+
+				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
+				/*
+				 * On ajoute au tableau "couple" le couple de sommet à fusionner
+				 */
+				couple->push_back(vertex_save);
+				couple->push_back(vertex_delete);
+				tableau_de_correspondance->push_back(couple); // Ajout du "couple" à la liste de correspondance
+
+				remove_edge(vertex_save,vertex_delete,*gtmp); // Suppression de l'arc reliant le couple de sommets
+
+				Entiers neigh_vertex_save; // Initialisation du vecteur contenant les somemts adjacents au "sommet sauvegardé"
+				Entiers neigh_vertex_delete; // Initialisation du vecteur contenant les somemts adjacents au "sommet à détruire"
+				tie(neighbourIt, neighbourEnd) = adjacent_vertices(vertex_save,*gtmp);
+
+				/*
+				 * Remplissage de ces deux tableaux à l'aide de la fonction adjacent_vertices de boost graph
+				 * [La création de ces tableaux est nécéssaire du fait que certains arcs sont détruit au cours
+				 * du processus]
+				 */
+				for (; neighbourIt != neighbourEnd; ++neighbourIt){
+					neigh_vertex_save.push_back(*neighbourIt);
+				}
+
+				tie(neighbourIt, neighbourEnd) = adjacent_vertices(vertex_delete,*gtmp);
+				for (; neighbourIt != neighbourEnd; ++neighbourIt){
+					neigh_vertex_delete.push_back(*neighbourIt);
+				}
+
+				/*
+				 * Recherche de sommets communs entre le "sommet sauvegardé" et le "sommet à détruire"
+				 * 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(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);
+					}
+				}
+
+				(*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"
+				 */
+				Random_list_vertices[i]=-1;
+				Random_list_vertices[recherche_val(Random_list_vertices,best_vertexs)]=-1;
+			}
+			else{
+				/*
+				 * Et si le sommet tiré ne possède pas de sommet adjacent non verrouillé
+				 * alors on l'ajoute à la liste de correspondance des sommets et on
+				 * le verrouille
+				 */
+				Entiers *couple = new Entiers();
+				couple->push_back(Random_list_vertices.at(i));
+				tableau_de_correspondance->push_back(couple);
+				Random_list_vertices[i]=-1;
+			}
+		}
+	}
+
+	std::sort(sommets_a_detruire.begin(), sommets_a_detruire.end()); // Trie dans l'ordre croissant des "sommets à détruire"
+	//std::cout<<"\n"<<std::endl;
+	/*
+	 * Suppression des sommets de la liste "sommets à détruire". Cette suppression est
+	 * effectuée dans l'ordre décroissant afin à maintenir à jour la renumérotation
+	 * des sommets
+	 */
+	for(int j=(sommets_a_detruire.size()-1);j>-1;j--){
+		//std::cout<<"Noeuds a supprimer : "<<sommets_a_detruire.at(j)<<std::endl;
+		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"
+}
+
+Entiers Liste_adjacence(UnorientedGraph &g, int vertexs,const Entiers &random_vertices){ // a revoir !!!!
+	Entiers liste_voisin;
+	tie(neighbourIt, neighbourEnd) = adjacent_vertices(vertexs, g);
+	for (; neighbourIt != neighbourEnd; ++neighbourIt){
+		if(In_tab(random_vertices,*neighbourIt)==1)
+			liste_voisin.push_back(*neighbourIt);
+	}
+	return liste_voisin;
+}
+
+int rand_fini(int a, int b){
+	return rand()%(b-a)+a;
+}
+
+/**
+ * Fonction de recherche d'une valeur dans un tableau.
+ * @param tab
+ * @param val
+ * @return
+ */
+int recherche_val2(const std::vector<float> &tab,float val){
+	int cpt=0;
+	while(tab[cpt]!=val)
+		cpt++;
+	return cpt;
+}
+
+int recherche_val_double(const std::vector<double> &tab,double val){
+	int cpt=0;
+	while(tab[cpt]!=val)
+		cpt++;
+	return cpt;
+}
+
+int recherche_val(const Entiers &tab,int val){
+	int cpt=0;
+	while(tab[cpt]!=val)
+		cpt++;
+	return cpt;
+}
+/**
+ * @param tab
+ * @param i
+ * @return
+ */
+int dichotomie(const Entiers &tab, int i){
+
+	/* déclaration des variables locales à la fonction */
+	int id;  //indice de début
+	int ifin;  //indice de fin
+	int im;  //indice de "milieu"
+
+	/* initialisation de ces variables avant la boucle de recherche */
+	id = 0;  //intervalle de recherche compris entre 0...
+	ifin = tab.size();  //...et nbVal
+
+	/* boucle de recherche */
+	while ((ifin - id) > 1){
+		im = (id + ifin)/2;  //on détermine l'indice de milieu
+		if(tab[im] > i) ifin = im;  //si la valeur qui est à la case "im" est supérieure à la valeur recherchée, l'indice de fin "ifin" << devient >> l'indice de milieu, ainsi l'intervalle de recherche est restreint lors du prochain tour de boucle
+		else id = im;  //sinon l'indice de début << devient >> l'indice de milieu et l'intervalle est de la même façon restreint
+	}
+
+	/* test conditionnant la valeur que la fonction va renvoyer */
+	if (tab[id] == i) return id;  //si on a trouvé la bonne valeur, on retourne l'indice
+	else return -1;  //sinon on retourne -1
+
+}
+
+/**
+ * Fonction permettant de supprimer une case d'un tableau.
+ * @param tab une référence sur un tableau d'entiers
+ * @param i un indice dans tab
+ */
+void suprim_val(Entiers &tab,int i) {
+	tab.erase(tab.begin() + dichotomie(tab,i));
+}
+
+/**
+ * Détermine si une valeur se trouve dans un tableau.
+ * @param tab une référence sur un tableau d'entiers
+ * @param val une valeur
+ * @return true si la valeur a été trouvée, false sinon
+ */
+bool In_tab(const Entiers &tab, int val)
+{
+	for (uint i=0; i < tab.size(); i++)
+		if(tab[i]==val)
+			return true;
+	return false;
+}
+
+bool In_tab_dichotomie(const Entiers &tab, int val)
+{
+	if(dichotomie(tab,val)!=-1)
+		return true;
+	else
+		return false;
+}
+
+
+void Liste_Voisin(Entiers &P,Entiers &tab,const UnorientedGraph &g)
+{
+	tie(neighbourIt, neighbourEnd) = adjacent_vertices(P[P.size()-1], g);
+	for (; neighbourIt != neighbourEnd; ++neighbourIt)
+	{
+		if((In_tab(tab,*neighbourIt) == false ) && (In_tab(P,*neighbourIt) == false ))
+			tab.push_back(*neighbourIt);
+	}
+}
+
+int Cout_coupe(Entiers P,int val, UnorientedGraph &g)
+{
+	int cpt=0;
+	P.push_back(val);
+	for(uint i=0;i<P.size();i++){
+		tie(neighbourIt, neighbourEnd) = adjacent_vertices(P[i], g);
+		for (; neighbourIt != neighbourEnd; ++neighbourIt){
+			if(In_tab(P,*neighbourIt)!=1){
+				cpt++;
+			}
+		}
+	}
+	return cpt;
+}
+
+double Cut_one_cluster(const Entiers &cluster, UnorientedGraph &g, std::string name)
+{
+	if(name=="norm"){
+		edge_t e1;
+		bool found;
+		double cpt=0.;
+		for(uint i=0;i<cluster.size();i++){
+			tie(neighbourIt, neighbourEnd) = adjacent_vertices(cluster[i], g);
+			for (; neighbourIt != neighbourEnd; ++neighbourIt){
+				tie(e1,found)=edge(vertex(cluster[i],g),vertex(*neighbourIt,g),g);
+				if(In_tab(cluster,*neighbourIt)!=1){
+					cpt+=g[e1]._weight;
+				}
+			}
+		}
+		double vol = Cluster_Degree(g,cluster);
+		return (cpt/2.)/vol;
+	}
+	else{
+		edge_t e1;
+		bool found;
+		double cpt=0.;
+		for(uint i=0;i<cluster.size();i++){
+			tie(neighbourIt, neighbourEnd) = adjacent_vertices(cluster.at(i), g);
+			for (; neighbourIt != neighbourEnd; ++neighbourIt){
+				tie(e1,found)=edge(vertex(cluster.at(i),g),vertex(*neighbourIt,g),g);
+				if(In_tab(cluster,*neighbourIt)!=1){
+					cpt+=g[e1]._weight;
+				}
+			}
+		}
+		return cpt/2.;
+	}
+}
+
+double Cut_cluster(const EntiersEntiers &tab_cluster,UnorientedGraph &g,std::string name)
+{
+	double cpt=0.;
+	for(uint i=0;i<tab_cluster.size();i++){
+		cpt+=Cut_one_cluster(*tab_cluster[i],g,name);
+	}
+	return cpt;
+}
+
+double Cout_coupe_pond(Entiers P, int val, UnorientedGraph &g)
+{
+    edge_t e1;
+    bool found;
+    double cpt=0;
+
+    P.push_back(val);
+    for(uint i=0;i<P.size();i++){
+        tie(neighbourIt, neighbourEnd) = adjacent_vertices(P[i], g);
+        for (; neighbourIt != neighbourEnd; ++neighbourIt){
+            tie(e1,found)=edge(vertex(P[i],g),vertex(*neighbourIt,g),g);
+            if(In_tab(P,*neighbourIt)!=1){
+                cpt+=g[e1]._weight;
+            }
+        }
+    }
+    return cpt;
+}
+
+
+int In_community_dichotomie(const EntiersEntiers &part, int val)
+{
+    for (uint i = 0; i < part.size() ; i++) {
+        if (In_tab_dichotomie(*part[i], val)) {
+            return i;
+        }
+    }
+    return -1;
+}
+
+double Degree(UnorientedGraph& g, int node)
+{
+    edge_t e1;
+    bool found;
+    double val = 0.;
+
+    tie(neighbourIt, neighbourEnd) = adjacent_vertices(node, g);
+    for (; neighbourIt != neighbourEnd; ++neighbourIt) {
+        tie(e1, found) = edge(vertex(node, g), vertex(*neighbourIt, g), g);
+        val += g[e1]._weight;
+    }
+    return val;
+}
+
+double Cluster_Degree(UnorientedGraph &g , const Entiers &cluster)
+{
+    double val = 0.;
+
+    for(uint i = 0; i < cluster.size(); i++){
+        val += Degree(g, cluster.at(i));
+    }
+    return val;
+}
+
+void List_edge_partie(Entiers *Partie, OrientedGraph *go, Edges &edge_partie,
+                      OutputEdges &outputedgespartie){
+    edge_to e1;
+    //bool found;
+
+    for(uint i = 0; i < Partie->size(); i++) {
+        tie(neighbourIto, neighbourEndo) = adjacent_vertices(Partie->at(i),
+                                                             *go);
+        for (; neighbourIto != neighbourEndo; ++neighbourIto) {
+            if(In_tab_dichotomie(*Partie,*neighbourIto)) {
+                Edge new_edge;
+
+                new_edge.first = Partie->at(i);
+                new_edge.second = *neighbourIto;
+                edge_partie.push_back(new_edge);
+            } else {
+                Edge new_edge;
+
+                new_edge.first = Partie->at(i);
+                new_edge.second = *neighbourIto;
+                outputedgespartie.push_back(new_edge);
+            }
+        }
+    }
+}
+
+void Global_Neigh_community(UnorientedGraph *g,
+                            const EntiersEntiers &Partition,
+                            Entiers *community, int vertex, int comm_in)
+{
+    int comm;
+
+    tie(neighbourIt, neighbourEnd) = adjacent_vertices(vertex, *g);
+    for (; neighbourIt != neighbourEnd; ++neighbourIt){
+        comm = In_community_dichotomie(Partition, *neighbourIt);
+        if (In_tab(*community,comm) != 1 and comm != comm_in)
+            community->push_back(comm);
+    }
+}
+
+OrientedGraphs Graph_Partition(const EntiersEntiers& Partition,
+                               OrientedGraph *go,
+                               UnorientedGraph *g,
+                               OutputEdgeList &outputedgelist,
+                               InputEdgeList &inputedgelist,
+                               Connections &connections)
+{
+    OrientedGraphs graph_partie;
+    EntiersEntiers neigh_community;
+
+    for (uint i = 0; i < Partition.size();i++){
+        Edges edge_partie;
+        List_edge_partie(Partition.at(i),go,edge_partie,outputedgelist.at(i));
+        OrientedGraph graph;
+        std::vector<vertex_to> tab_vertex_to;
+        Entiers *community = new Entiers();
+
+        for (uint j = 0; j < Partition.at(i)->size(); j++) {
+            Global_Neigh_community(g, Partition, community,
+                                   Partition.at(i)->at(j),i);
+            vertex_to v = add_vertex(graph);
+
+            tab_vertex_to.push_back(v);
+            graph[v] = VertexProperties((*go)[Partition.at(i)->at(j)]._index,
+                                        (*go)[Partition.at(i)->at(j)]._weight,
+                                        (*go)[Partition.at(i)->at(j)]._type);
+        }
+        neigh_community.push_back(community);
+
+        for(uint k = 0; k < edge_partie.size(); k++) {
+            add_edge(tab_vertex_to.at(recherche_val(*Partition.at(i),
+                                                    edge_partie.at(k).first)),
+                     tab_vertex_to.at(recherche_val(*Partition.at(i),
+                                                    edge_partie.at(k).second)),
+                     graph);
+        }
+        graph_partie.push_back(graph);
+    }
+
+    for (uint i = 0; i < neigh_community.size(); i++) {
+        InputEdges inputedges;
+
+        for (uint j = 0; j < neigh_community.at(i)->size(); j++) {
+            for (uint k = 0;
+                 k < outputedgelist.at(neigh_community.at(i)->at(j)).size();
+                 k++) {
+                if (In_tab_dichotomie(
+                        *Partition.at(i),
+                        outputedgelist.at(
+                            neigh_community.at(i)->at(j)).at(k).second))
+                    inputedges.push_back(
+                        outputedgelist.at(
+                            neigh_community.at(i)->at(j)).at(k));
+            }
+        }
+        inputedgelist.push_back(inputedges);
+    }
+
+    for (uint i = 0; i < outputedgelist.size(); i++){
+        Connection connec;
+
+        for(uint j = 0; j < outputedgelist.at(i).size(); j++){
+            Port port1;
+
+            port1.first = i + 1;
+            port1.second = outputedgelist.at(i).at(j).first;
+
+            Port port2;
+
+            port2.first = In_community_dichotomie(
+                Partition,outputedgelist.at(i).at(j).second) + 1;
+            port2.second = outputedgelist.at(i).at(j).second;
+
+            connec.first = port1;
+            connec.second = port2;
+
+            connections.push_back(connec);
+        }
+    }
+
+    for (EntiersEntiers::iterator it = neigh_community.begin();
+        it != neigh_community.end(); it++) {
+        delete *it;
+        *it = NULL;
+    }
+
+    return graph_partie;
+}
+
+/*double In_modularity(UnorientedGraph &g , const Entiers &cluster){
+	property_map<UnorientedGraph,edge_weight_t>::type poids_arc=get(edge_weight_t(),g);
+	edge_t e1;
+	bool found;
+	int val=0;
+
+	for(uint i=0;i<cluster.size();i++){
+		tie(neighbourIt, neighbourEnd) = adjacent_vertices(cluster[i],g);
+		for (; neighbourIt != neighbourEnd; ++neighbourIt){
+			tie(e1,found)=edge(vertex(cluster[i],g),vertex(*neighbourIt,g),g);
+			if(In_tab(cluster,*neighbourIt)==1)
+				val+=get(poids_arc,e1);
+		}
+	}
+	return val/2.;
+}*/
+
+/**
+ *
+ * @param g
+ * @param cluster
+ * @return
+ */
+
+
+
+/**
+ *
+ * @param g
+ * @param part
+ * @return
+ */
+
+/*double Modularity(UnorientedGraph &g,const EntiersEntiers &part) {
+  double q  = 0.;
+  int tmp=num_edges(g);
+  for(uint i=0;i<part.size();i++){
+	  q+=In_modularity(g,*part[i])/tmp-(Cluster_Degree(g,*part[i])/(2*tmp))*(Cluster_Degree(g,*part[i])/(2*tmp));
+  	}
+
+  return q;
+}*/
+
+/**
+ *
+ * @param part
+ * @param val
+ * @return
+ */
+
+
+
+/**
+ * Fonction de calcul du gain de modularité de déplacement d'un sommet d'une communoté à une autre !!!!!
+ *  ajoute le sommet à part[val] et on calcul la nouvelle modularité
+ *  on prend la différence entre la modularité et la nouvouvelle !
+ * @param cur_mod
+ * @param val
+ * @param neight
+ * @param node_comm
+ * @param part
+ * @param g
+ */
+/*double Modularity_gain(double cur_mod , int val , int neight , int node_comm , EntiersEntiers part , UnorientedGraph &g) {
+	double q;
+	part[neight]->push_back(val);
+	std::sort(*part[neight]);
+	q=Modularity(g,part);
+
+	return q-cur_mod;
+}*/
+
+/**
+ * Fonction de calcul du gain de modularité de déplacement d'un sommet d'une communoté à une autre !!!!!
+ *  ajoute le sommet à part[val] et on calcul la nouvelle modularité
+ *  on prend la différence entre la modularité et la nouvouvelle !
+ * @param cur_mod
+ * @param tmp_community
+ * @param neight
+ * @param node_comm
+ * @param part
+ * @param g
+ */
+/*double Modularity_gain_phase_2(double cur_mod, Entiers tmp_community, int neight, int node_comm, EntiersEntiers part, UnorientedGraph &g) {
+	double q;
+	for (uint i=0;i<tmp_community.size();i++)
+		part[neight]->push_back(tmp_community[i]);
+	std::sort(*part[neight]);
+	q = Modularity(g,part);
+	return q - cur_mod;
+}*/
+
+/**
+ * Donne la liste des communautés voisines à celle contenant le sommet val.
+ * @param part
+ * @param val
+ * @param g
+ * @return
+ */
+/*Entiers Neight_community(const EntiersEntiers &part, int val , UnorientedGraph &g){
+	Entiers Neight;
+	tie(neighbourIt, neighbourEnd) = adjacent_vertices(val, g);
+	for (; neighbourIt != neighbourEnd; ++neighbourIt){
+		int tmp=In_community(part,*neighbourIt);
+		if(In_tab(Neight,tmp)!=1 && In_tab(*part[In_community(part,val)],*neighbourIt)!=1)
+			Neight.push_back(tmp);
+	}
+	std::sort(Neight);
+	return Neight;
+}*/
+
+/**
+ *
+ * @param part
+ * @param community
+ * @param g
+ * @return
+ */
+/*Entiers Part_Neight_community(const EntiersEntiers &part,int community, UnorientedGraph &g){
+	Entiers Neight;
+	for(uint i =0;i<part[community]->size();i++){
+		tie(neighbourIt, neighbourEnd) = adjacent_vertices(part[community]->at(i), g);
+		for (; neighbourIt != neighbourEnd; ++neighbourIt){
+			int tmp=In_community(part,*neighbourIt);
+			if(In_tab(Neight,tmp)!=1 && tmp!=community)
+				Neight.push_back(tmp);
+		}
+	}
+	std::sort(Neight);
+	return Neight;
+}*/
+
+} } } // namespace paradevs tests boost_graph

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

@@ -0,0 +1,104 @@
+/**
+ * @file tests/boost_graph/partitioning/utils.hpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TESTS_BOOST_GRAPH_PARTITIONING_UTILS_H
+#define TESTS_BOOST_GRAPH_PARTITIONING_UTILS_H 1
+
+#include <tests/boost_graph/partitioning/defs.hpp>
+
+namespace paradevs { namespace tests { namespace boost_graph {
+
+void Global_Neigh_community(UnorientedGraph *g,
+                            const EntiersEntiers &Partition,
+                            Entiers *community, int vertex, int comm_in);
+
+OrientedGraphs Graph_Partition(const EntiersEntiers &Partition,
+                               OrientedGraph *go,
+                               UnorientedGraph *g,
+                               OutputEdgeList &outputedgelist,
+                               InputEdgeList &inputedgelist,
+                               Connections &connections);
+
+void List_edge_partie(Entiers *Partie, OrientedGraph *go, Edges &edge_partie,
+                      OutputEdges &outputedgespartie);
+
+void construire_graph(UnorientedGraph *g, OrientedGraph *graph);
+
+double Modif_Cut_one_cluster(Entiers &cluster, UnorientedGraph &g, double &vol);
+
+std::vector<double> modif_cut_tmp(UnorientedGraph *g, EntiersEntiers &Partition,
+                             std::vector<std::vector<double> > tabe_cut,
+                                  int vertexs,
+                             int comm_in, Entiers community, double cut,
+                             std::string name);
+
+double Calcul_poids(Entiers *partie, UnorientedGraph *g);
+
+bool Est_connexe(UnorientedGraph *g, EntiersEntiers Partition, Entiers &part);
+
+void Affinage_equilibrage_charge(UnorientedGraph *g, EntiersEntiers &Partition);
+
+Entiers Neigh_community(UnorientedGraph *g, EntiersEntiers &Partition,
+                        int vertex, int comm_in);
+
+void Modif_fonction_Gain_Cut(EntiersEntiers &Partition,UnorientedGraph *g,
+                             Entiers &community, int val, double &cut,
+                             std::string name);
+
+void Affinage_recherche_locale(UnorientedGraph *g, EntiersEntiers &Partition,
+                               double &cut, std::string name);
+
+void projection(EntiersEntiers &Partition,ListEntiersEntiers::iterator lit);
+
+void contraction_HEM(UnorientedGraph *g, Base_Graph &baseg,
+                     ListEntiersEntiers &liste_corr);
+
+Entiers Liste_adjacence(UnorientedGraph &g, int vertexs,
+                        const Entiers &random_vertices);
+
+int rand_fini(int a, int b);
+int recherche_val2(const std::vector<float> &tab,float val);
+int recherche_val_double(const std::vector<double> &tab,double val);
+int recherche_val(const std::vector<int> &tab,int val);
+int dichotomie(const Entiers &tab,int i);
+void suprim_val(Entiers &tab,int i);
+bool In_tab(const Entiers &tab, int val);
+bool In_tab_dichotomie(const Entiers &tab, int val);
+double Cut_cluster(const EntiersEntiers &tab_cluster,UnorientedGraph &g,
+                   std::string name);
+void Modif_fonction_Gain_Cut(EntiersEntiers &Partition,UnorientedGraph *g,
+                             int community_out,int community_in,int val,
+                             double &cut);
+void Liste_Voisin(Entiers &P,Entiers &tab,const UnorientedGraph &g);
+int Cout_coupe(Entiers P,int val, UnorientedGraph &g);
+double Cout_coupe_pond(Entiers P,int val, UnorientedGraph &g);
+int In_community_dichotomie(const EntiersEntiers &part, int val);
+double Degree(UnorientedGraph &g , int node);
+double Cluster_Degree(UnorientedGraph &g , const Entiers &cluster);
+
+} } } // namespace paradevs tests boost_graph
+
+#endif

+ 28 - 73
src/tests/boost_graph/tests.cpp

@@ -27,7 +27,9 @@
 #include <common/RootCoordinator.hpp>
 
 #include <tests/boost_graph/models.hpp>
+#include <tests/boost_graph/graph_builder.hpp>
 #include <tests/boost_graph/graph_manager.hpp>
+#include <tests/boost_graph/graph_partitioning.hpp>
 
 using namespace paradevs::common;
 using namespace paradevs::common::scheduler;
@@ -42,7 +44,9 @@ void flat_test()
             DoubleTime,
             SchedulerType,
             SchedulerHandle,
-            InBuildFlatGraphManager < SchedulerHandle, FlatGraphBuilder >,
+            InBuildFlatGraphManager <
+                SchedulerHandle,
+                FlatGraphBuilder >,
             paradevs::common::NoParameters,
             paradevs::common::NoParameters >
     > rc(0, 100, "root", NoParameters(), NoParameters());
@@ -58,8 +62,9 @@ void hierarchical_test()
             DoubleTime,
             SchedulerType,
             SchedulerHandle,
-            HierarchicalGraphManager < SchedulerHandle,
-                                       HierarchicalGraphBuilder >,
+            HierarchicalGraphManager <
+                SchedulerHandle,
+                HierarchicalGraphBuilder >,
             paradevs::common::NoParameters,
             paradevs::common::NoParameters >
         > rc(0, 100, "root", NoParameters(), NoParameters());
@@ -67,78 +72,28 @@ void hierarchical_test()
     rc.run();
 }
 
-int main()
+void partitionning_test()
 {
-    flat_test();
-    hierarchical_test();
-
-    // class M;
-
-    // struct A
-    // {
-    //     double time;
-    //     M*     model;
-
-    //     A(double _time, M* _model)
-    //     {
-    //         time = _time;
-    //         model = _model;
-    //     }
-    // };
-
-    // struct ACompare
-    //     : std::binary_function < A, A, bool >
-    // {
-    //     bool operator()(const A &left, const A &right) const
-    //     { return left.time > right.time; }
-    // };
-
-    // typedef boost::heap::fibonacci_heap < A, boost::heap::compare <
-    //     ACompare > > Heap;
-
-    // typedef Heap::handle_type HeapHandle;
-
-    // class M
-    // {
-    // public:
-    //     M(int a)
-    //     {
-    //         _a = a;
-    //     }
-
-    //     int a() const
-    //     { return _a; }
-
-    //     HeapHandle heap_id() const
-    //     { return _heap_id; }
-
-    //     void heap_id(HeapHandle id)
-    //     { _heap_id = id; }
-
-    // private:
-    //     int _a;
-    //     HeapHandle _heap_id;
-    // };
-
-    // Heap heap;
-    // M* m1 = new M(1);
-    // M* m2 = new M(2);
-
-    // m1->heap_id(heap.push(A(0, m1)));
-    // m2->heap_id(heap.push(A(0, m2)));
-
-    // (*m1->heap_id()).time = 1;
-    // heap.decrease(m1->heap_id());
-    // (*m2->heap_id()).time = 1;
-    // heap.decrease(m2->heap_id());
+    RootCoordinator <
+        DoubleTime,
+        paradevs::pdevs::Coordinator <
+            DoubleTime,
+            SchedulerType,
+            SchedulerHandle,
+            HierarchicalGraphManager <
+                SchedulerHandle,
+                PartitioningGraphBuilder >,
+            paradevs::common::NoParameters,
+            paradevs::common::NoParameters >
+        > rc(0, 100, "root", NoParameters(), NoParameters());
 
-    // std::cout << "Scheduler = { ";
-    // while (not heap.empty()) {
-    //     std::cout << "(" << heap.top().time << "," << heap.top().model->a()
-    //               << ") ";
-    //     heap.pop();
-    // }
-    // std::cout << "}" << std::endl;
+//    rc.run();
+}
 
+int main()
+{
+    // flat_test();
+    // hierarchical_test();
+    partitionning_test();
     return 0;
 }

+ 20 - 0
src/tests/multithreading/CMakeLists.txt

@@ -0,0 +1,20 @@
+INCLUDE_DIRECTORIES(
+  ${PARADEVS_BINARY_DIR}/src
+  ${PARADEVS_SOURCE_DIR}/src
+  ${Boost_INCLUDE_DIRS}
+  ${GLIBMM_INCLUDE_DIRS}
+  ${LIBXML_INCLUDE_DIRS})
+
+LINK_DIRECTORIES(
+  ${GLIBMM_LIBRARY_DIRS}
+  ${LIBXML_LIBRARY_DIR})
+
+ADD_EXECUTABLE(pdevs-multithreading-tests ${COMMON_HPP} ${COMMON_SCHEDULER_HPP}
+  ${PDEVS_HPP} ${PDEVS_MULTITHREADING_HPP} graph_manager.hpp tests.cpp)
+SET_TARGET_PROPERTIES(pdevs-multithreading-tests PROPERTIES
+  ${PARADEVS_APP_PROPERTIES})
+
+TARGET_LINK_LIBRARIES(pdevs-multithreading-tests
+  ${GLIBMM_LIBRARIES}
+  ${LIBXML_LIBRARIES}
+  ${GTHREAD_LIBRARIES})

+ 158 - 0
src/tests/multithreading/graph_manager.hpp

@@ -0,0 +1,158 @@
+/**
+ * @file tests/multithreading/graph_manager.cpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TESTS_PDEVS_MULTITHREADING_GRAPH_MANAGER_HPP
+#define TESTS_PDEVS_MULTITHREADING_GRAPH_MANAGER_HPP 1
+
+#include <tests/pdevs/models.hpp>
+#include <tests/pdevs/graph_manager.hpp>
+
+#include <kernel/pdevs/multithreading/Coordinator.hpp>
+#include <kernel/pdevs/GraphManager.hpp>
+#include <kernel/pdevs/Simulator.hpp>
+
+namespace paradevs { namespace tests { namespace multithreading {
+
+template < class SchedulerHandle >
+class S1GraphManager :
+        public paradevs::pdevs::GraphManager < common::DoubleTime,
+                                               SchedulerHandle >
+{
+public:
+    S1GraphManager(common::Coordinator < common::DoubleTime,
+                                         SchedulerHandle >* coordinator,
+                   const paradevs::common::NoParameters& parameters) :
+        paradevs::pdevs::GraphManager < common::DoubleTime,
+                                        SchedulerHandle >(coordinator,
+                                                          parameters),
+        a("a1", common::NoParameters()), b("b1", common::NoParameters())
+    {
+        S1GraphManager < SchedulerHandle >::add_child(&a);
+        S1GraphManager < SchedulerHandle >::add_child(&b);
+
+        a.add_out_port("out");
+        b.add_in_port("in");
+        b.add_out_port("out");
+        coordinator->add_out_port("out");
+
+        S1GraphManager < SchedulerHandle >::add_link(&a, "out", &b, "in");
+        S1GraphManager < SchedulerHandle >::add_link(&b, "out",
+                                                     coordinator, "out");
+    }
+
+    virtual ~S1GraphManager()
+    { }
+
+private:
+    paradevs::pdevs::Simulator < common::DoubleTime,
+                                 pdevs::A < SchedulerHandle >,
+                                 SchedulerHandle > a;
+    paradevs::pdevs::Simulator < common::DoubleTime,
+                                 pdevs::B < SchedulerHandle >,
+                                 SchedulerHandle > b;
+};
+
+template < class SchedulerHandle >
+class S2GraphManager :
+        public paradevs::pdevs::GraphManager < common::DoubleTime,
+                                               SchedulerHandle >
+{
+public:
+    S2GraphManager(common::Coordinator < common::DoubleTime,
+                                         SchedulerHandle >* coordinator,
+                   const paradevs::common::NoParameters& parameters) :
+        paradevs::pdevs::GraphManager < common::DoubleTime,
+                                        SchedulerHandle >(coordinator,
+                                                          parameters),
+        a("a2", common::NoParameters()), b("b2", common::NoParameters())
+    {
+        S2GraphManager < SchedulerHandle >::add_child(&a);
+        S2GraphManager < SchedulerHandle >::add_child(&b);
+
+        a.add_in_port("in");
+        a.add_out_port("out");
+        b.add_in_port("in");
+        coordinator->add_in_port("in");
+
+        S2GraphManager < SchedulerHandle >::add_link(&a, "out", &b, "in");
+        S2GraphManager < SchedulerHandle >::add_link(coordinator, "in",
+                                                     &a, "in");
+    }
+
+    virtual ~S2GraphManager()
+    { }
+
+private:
+    paradevs::pdevs::Simulator < common::DoubleTime,
+                                 pdevs::A < SchedulerHandle >,
+                                 SchedulerHandle > a;
+    paradevs::pdevs::Simulator < common::DoubleTime,
+                                 pdevs::B < SchedulerHandle >,
+                                 SchedulerHandle > b;
+};
+
+class RootGraphManager :
+        public paradevs::pdevs::GraphManager < common::DoubleTime,
+                                               pdevs::SchedulerHandle >
+{
+public:
+    RootGraphManager(
+        common::Coordinator < common::DoubleTime,
+                              pdevs::SchedulerHandle >* coordinator,
+        const paradevs::common::NoParameters& parameters) :
+        paradevs::pdevs::GraphManager < common::DoubleTime,
+                                        pdevs::SchedulerHandle >(
+                                            coordinator, parameters),
+        S1("S1", paradevs::common::NoParameters(),
+           paradevs::common::NoParameters()),
+        S2("S2", paradevs::common::NoParameters(),
+           paradevs::common::NoParameters())
+    {
+        add_child(&S1);
+        add_child(&S2);
+
+        add_link(&S1, "out", &S2, "in");
+    }
+
+    virtual ~RootGraphManager()
+    { }
+
+private:
+    paradevs::pdevs::multithreading::Coordinator <
+        common::DoubleTime,
+        pdevs::SchedulerType,
+        pdevs::SchedulerHandle,
+        S1GraphManager < pdevs::SchedulerHandle > > S1;
+    paradevs::pdevs::multithreading::Coordinator <
+        common::DoubleTime,
+        pdevs::SchedulerType,
+        pdevs::SchedulerHandle,
+        S2GraphManager < pdevs::SchedulerHandle > > S2;
+};
+
+} } } // namespace paradevs tests multithreading
+
+#endif

+ 53 - 0
src/tests/multithreading/tests.cpp

@@ -0,0 +1,53 @@
+/**
+ * @file tests/multithreading/tests.cpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <tests/multithreading/graph_manager.hpp>
+#include <tests/pdevs/models.hpp>
+#include <tests/pdevs/graph_manager.hpp>
+
+#include <common/RootCoordinator.hpp>
+
+#define CATCH_CONFIG_MAIN
+#include <tests/catch.hpp>
+
+using namespace paradevs::tests::pdevs;
+using namespace paradevs::tests::multithreading;
+using namespace paradevs::common;
+
+TEST_CASE("pdevs/hierachical", "run")
+{
+    paradevs::common::RootCoordinator <
+        DoubleTime, paradevs::pdevs::multithreading::Coordinator <
+            DoubleTime,
+            paradevs::common::scheduler::HeapScheduler <
+                DoubleTime, SchedulerHandle >,
+            SchedulerHandle,
+            paradevs::tests::multithreading::RootGraphManager >
+        > rc(0, 10000, "root", paradevs::common::NoParameters(),
+             paradevs::common::NoParameters());
+
+    rc.run();
+}