graph_partitioning.hpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /**
  2. * @file tests/boost_graph/graph_partitioning.hpp
  3. * @author The PARADEVS Development Team
  4. * See the AUTHORS or Authors.txt file
  5. */
  6. /*
  7. * PARADEVS - the multimodeling and simulation environment
  8. * This file is a part of the PARADEVS environment
  9. *
  10. * Copyright (C) 2013 ULCO http://www.univ-litoral.fr
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation, either version 3 of the License, or
  15. * (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. */
  25. #ifndef __TESTS_BOOST_GRAPH_GRAPH_PARTITIONING_HPP
  26. #define __TESTS_BOOST_GRAPH_GRAPH_PARTITIONING_HPP 1
  27. #include <tests/boost_graph/graph_defs.hpp>
  28. #include <tests/boost_graph/partitioning/graph_build.hpp>
  29. #include <tests/boost_graph/partitioning/gggp.hpp>
  30. namespace paradevs { namespace tests { namespace boost_graph {
  31. class PartitioningGraphBuilder
  32. {
  33. public:
  34. PartitioningGraphBuilder()
  35. { }
  36. void build(OrientedGraphs& graphs,
  37. InputEdgeList& input_edges,
  38. OutputEdgeList& output_edges,
  39. Connections& parent_connections)
  40. {
  41. srand((unsigned)time(NULL));
  42. //srand(7266);
  43. UnorientedGraph* g = new UnorientedGraph();
  44. OrientedGraph* go = new OrientedGraph();
  45. UnorientedGraph* graph_origin = new UnorientedGraph();
  46. OrientedGraph* gop = new OrientedGraph();
  47. build_graph(*g, *go);
  48. build_graph(*graph_origin, *gop);
  49. delete gop;
  50. int nbr_parties = 12;
  51. Edges edge_partie;
  52. Connections connections;
  53. output_edges = OutputEdgeList(nbr_parties);
  54. graphs = Multiniveau(num_vertices(*g)/2, g, graph_origin, go, nbr_parties,"rand", "gggp_pond",
  55. "cut_norm", "norm", edge_partie ,
  56. output_edges, input_edges,
  57. parent_connections);
  58. //std::cout<<"Sorti ! "<<std::endl;
  59. delete graph_origin;
  60. delete go;
  61. }
  62. };
  63. } } } // namespace paradevs tests boost_graph
  64. #endif