graph_build.hpp 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500
  1. /**
  2. * @file tests/boost_graph/partitioning/graph_build.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-2015 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_PARTITIONING_GRAPH_BUILD_H
  26. #define TESTS_BOOST_GRAPH_PARTITIONING_GRAPH_BUILD_H
  27. #include <tests/boost_graph/partitioning/defs.hpp>
  28. #include <tests/boost_graph/partitioning/utils.hpp>
  29. #include <fstream>
  30. namespace paradevs { namespace tests { namespace boost_graph {
  31. enum DynamicsType {
  32. TOP_PIXEL = 0, NORMAL_PIXEL
  33. };
  34. void build_graph(OrientedGraph& og, unsigned int edge_number);
  35. void build_generator_graph(OrientedGraph *go, int nbr_vertex,
  36. int nbr_source, int nbr_v_min, int nbr_v_max,
  37. const std::vector<int> &niveau);
  38. void build_generator_graph_linked(OrientedGraph *go, int nbr_vertex,
  39. int nbr_couche, int nbr_v_min, int nbr_v_max);
  40. void build_graph_cyclique(OrientedGraph& og);
  41. void build_graph_grid(OrientedGraph *go, int side,
  42. const std::vector<std::pair<int,int>> &vertex_selection,
  43. const Entiers &weight_vertex, const char *edge_weight,
  44. bool rec);
  45. void build_example_linked9(OrientedGraph& og);
  46. void build_example_ligne(OrientedGraph& og);
  47. void build_example_grid(OrientedGraph& og);
  48. void build_parcellaire_graph(OrientedGraph *go, uint size_max, std::string name);
  49. void build_graph(OrientedGraph& og, unsigned int edge_number)
  50. {
  51. if(edge_number == 11){
  52. vertex_to v0 = boost::add_vertex(og);
  53. vertex_to v1 = boost::add_vertex(og);
  54. vertex_to v2 = boost::add_vertex(og);
  55. vertex_to v3 = boost::add_vertex(og);
  56. vertex_to v4 = boost::add_vertex(og);
  57. vertex_to v5 = boost::add_vertex(og);
  58. vertex_to v6 = boost::add_vertex(og);
  59. vertex_to v7 = boost::add_vertex(og);
  60. vertex_to v8 = boost::add_vertex(og);
  61. vertex_to v9 = boost::add_vertex(og);
  62. vertex_to v10 = boost::add_vertex(og);
  63. add_edge(v1, v0, EdgeProperties(1), og);
  64. add_edge(v2, v0, EdgeProperties(1), og);
  65. add_edge(v3, v0, EdgeProperties(1), og);
  66. add_edge(v1, v2, EdgeProperties(1), og);
  67. add_edge(v4, v1, EdgeProperties(1.), og);
  68. add_edge(v5, v1, EdgeProperties(1.), og);
  69. add_edge(v6, v1, EdgeProperties(1.), og);
  70. add_edge(v6, v2, EdgeProperties(1.), og);
  71. add_edge(v2, v3, EdgeProperties(1.), og);
  72. add_edge(v9, v3, EdgeProperties(1.), og);
  73. add_edge(v10, v3, EdgeProperties(1.), og);
  74. add_edge(v4, v5, EdgeProperties(1), og);
  75. add_edge(v5, v6, EdgeProperties(1), og);
  76. add_edge(v7, v4, EdgeProperties(1.), og);
  77. add_edge(v8, v4, EdgeProperties(1.), og);
  78. add_edge(v7, v8, EdgeProperties(1), og);
  79. add_edge(v9, v10, EdgeProperties(1.), og);
  80. og[v6] = VertexProperties(6, 1, NORMAL_PIXEL);
  81. og[v8] = VertexProperties(8, 1., NORMAL_PIXEL);
  82. og[v10] = VertexProperties(10, 1, NORMAL_PIXEL);
  83. og[v0] = VertexProperties(0, 1, NORMAL_PIXEL);
  84. og[v1] = VertexProperties(1, 1, NORMAL_PIXEL);
  85. og[v2] = VertexProperties(2, 1, NORMAL_PIXEL);
  86. og[v3] = VertexProperties(3, 1, NORMAL_PIXEL);
  87. og[v4] = VertexProperties(4, 1, NORMAL_PIXEL);
  88. og[v5] = VertexProperties(5, 1, NORMAL_PIXEL);
  89. og[v7] = VertexProperties(7, 1., TOP_PIXEL);
  90. og[v9] = VertexProperties(9, 1., TOP_PIXEL);
  91. } else if(edge_number == 38){
  92. vertex_to v0 = boost::add_vertex(og);
  93. vertex_to v1 = boost::add_vertex(og);
  94. vertex_to v2 = boost::add_vertex(og);
  95. vertex_to v3 = boost::add_vertex(og);
  96. vertex_to v4 = boost::add_vertex(og);
  97. vertex_to v5 = boost::add_vertex(og);
  98. vertex_to v6 = boost::add_vertex(og);
  99. vertex_to v7 = boost::add_vertex(og);
  100. vertex_to v8 = boost::add_vertex(og);
  101. vertex_to v9 = boost::add_vertex(og);
  102. vertex_to v10 = boost::add_vertex(og);
  103. vertex_to v11 = boost::add_vertex(og);
  104. vertex_to v12 = boost::add_vertex(og);
  105. vertex_to v13 = boost::add_vertex(og);
  106. vertex_to v14 = boost::add_vertex(og);
  107. vertex_to v15 = boost::add_vertex(og);
  108. vertex_to v16 = boost::add_vertex(og);
  109. vertex_to v17 = boost::add_vertex(og);
  110. vertex_to v18 = boost::add_vertex(og);
  111. vertex_to v19 = boost::add_vertex(og);
  112. vertex_to v20 = boost::add_vertex(og);
  113. vertex_to v21 = boost::add_vertex(og);
  114. vertex_to v22 = boost::add_vertex(og);
  115. vertex_to v23 = boost::add_vertex(og);
  116. vertex_to v24 = boost::add_vertex(og);
  117. vertex_to v25 = boost::add_vertex(og);
  118. vertex_to v26 = boost::add_vertex(og);
  119. vertex_to v27 = boost::add_vertex(og);
  120. vertex_to v28 = boost::add_vertex(og);
  121. vertex_to v29 = boost::add_vertex(og);
  122. vertex_to v30 = boost::add_vertex(og);
  123. vertex_to v31 = boost::add_vertex(og);
  124. vertex_to v32 = boost::add_vertex(og);
  125. vertex_to v33 = boost::add_vertex(og);
  126. vertex_to v34 = boost::add_vertex(og);
  127. vertex_to v35 = boost::add_vertex(og);
  128. vertex_to v36 = boost::add_vertex(og);
  129. vertex_to v37 = boost::add_vertex(og);
  130. add_edge(v1, v0, EdgeProperties(1.), og);
  131. add_edge(v2, v0, EdgeProperties(1.), og);
  132. add_edge(v3, v0, EdgeProperties(1.), og);
  133. add_edge(v1, v2, EdgeProperties(1.), og);
  134. add_edge(v4, v1, EdgeProperties(1.), og);
  135. add_edge(v5, v1, EdgeProperties(1.), og);
  136. add_edge(v6, v1, EdgeProperties(1.), og);
  137. add_edge(v6, v2, EdgeProperties(1.), og);
  138. add_edge(v2, v3, EdgeProperties(1.), og);
  139. add_edge(v9, v3, EdgeProperties(1.), og);
  140. add_edge(v10, v3, EdgeProperties(1.), og);
  141. add_edge(v4, v5, EdgeProperties(1.), og);
  142. add_edge(v5, v6, EdgeProperties(1.), og);
  143. add_edge(v7, v4, EdgeProperties(1.), og);
  144. add_edge(v8, v4, EdgeProperties(1.), og);
  145. add_edge(v7, v8, EdgeProperties(1.), og);
  146. add_edge(v9, v10, EdgeProperties(1.), og);
  147. add_edge(v8, v11, EdgeProperties(1.), og);
  148. add_edge(v11, v4, EdgeProperties(1.), og);
  149. add_edge(v12, v13, EdgeProperties(1.), og);
  150. add_edge(v12, v7, EdgeProperties(1.), og);
  151. add_edge(v13, v7, EdgeProperties(1.), og);
  152. add_edge(v14, v15, EdgeProperties(1.), og);
  153. add_edge(v14, v12, EdgeProperties(1.), og);
  154. add_edge(v15, v16, EdgeProperties(1.), og);
  155. add_edge(v15, v12, EdgeProperties(1.), og);
  156. add_edge(v16, v17, EdgeProperties(1.), og);
  157. add_edge(v16, v12, EdgeProperties(1.), og);
  158. add_edge(v17, v12, EdgeProperties(1.), og);
  159. add_edge(v18, v19, EdgeProperties(1.), og);
  160. add_edge(v18, v8, EdgeProperties(1.), og);
  161. add_edge(v19, v20, EdgeProperties(1.), og);
  162. add_edge(v19, v8, EdgeProperties(1.), og);
  163. add_edge(v20, v8, EdgeProperties(1.), og);
  164. add_edge(v21, v22, EdgeProperties(1.), og);
  165. add_edge(v21, v19, EdgeProperties(1.), og);
  166. add_edge(v22, v23, EdgeProperties(1.), og);
  167. add_edge(v22, v19, EdgeProperties(1.), og);
  168. add_edge(v23, v19, EdgeProperties(1.), og);
  169. add_edge(v24, v25, EdgeProperties(1.), og);
  170. add_edge(v24, v6, EdgeProperties(1.), og);
  171. add_edge(v25, v6, EdgeProperties(1.), og);
  172. add_edge(v26, v11, EdgeProperties(1.), og);
  173. add_edge(v26, v27, EdgeProperties(1.), og);
  174. add_edge(v26, v24, EdgeProperties(1.), og);
  175. add_edge(v27, v24, EdgeProperties(1.), og);
  176. add_edge(v28, v25, EdgeProperties(1.), og);
  177. add_edge(v29, v27, EdgeProperties(1.), og);
  178. add_edge(v29, v28, EdgeProperties(1.), og);
  179. add_edge(v30, v27, EdgeProperties(1.), og);
  180. add_edge(v30, v28, EdgeProperties(1.), og);
  181. add_edge(v31, v32, EdgeProperties(1.), og);
  182. add_edge(v31, v10, EdgeProperties(1.), og);
  183. add_edge(v32, v33, EdgeProperties(1.), og);
  184. add_edge(v32, v10, EdgeProperties(1.), og);
  185. add_edge(v33, v10, EdgeProperties(1.), og);
  186. add_edge(v34, v31, EdgeProperties(1.), og);
  187. add_edge(v34, v35, EdgeProperties(1.), og);
  188. add_edge(v35, v31, EdgeProperties(1.), og);
  189. add_edge(v35, v32, EdgeProperties(1.), og);
  190. add_edge(v36, v32, EdgeProperties(1.), og);
  191. add_edge(v36, v37, EdgeProperties(1.), og);
  192. add_edge(v36, v33, EdgeProperties(1.), og);
  193. add_edge(v37, v33, EdgeProperties(1.), og);
  194. add_edge(v4, v0, EdgeProperties(1.), og);
  195. add_edge(v9, v2, EdgeProperties(1.), og);
  196. add_edge(v28, v24, EdgeProperties(1.), og);
  197. add_edge(v28, v31, EdgeProperties(1.), og);
  198. add_edge(v33, v3, EdgeProperties(1.), og);
  199. add_edge(v33, v0, EdgeProperties(1.), og);
  200. add_edge(v36, v3, EdgeProperties(1.), og);
  201. add_edge(v17, v13, EdgeProperties(1.), og);
  202. add_edge(v17, v7, EdgeProperties(1.), og);
  203. add_edge(v21, v23, EdgeProperties(1.), og);
  204. add_edge(v23, v20, EdgeProperties(1.), og);
  205. add_edge(v26, v4, EdgeProperties(1.), og);
  206. og[v6] = VertexProperties(6, 1, NORMAL_PIXEL);
  207. og[v8] = VertexProperties(8, 1, NORMAL_PIXEL);
  208. og[v10] = VertexProperties(10, 1, NORMAL_PIXEL);
  209. og[v0] = VertexProperties(0, 1, NORMAL_PIXEL);
  210. og[v1] = VertexProperties(1, 1, NORMAL_PIXEL);
  211. og[v2] = VertexProperties(2, 1, NORMAL_PIXEL);
  212. og[v3] = VertexProperties(3, 1, NORMAL_PIXEL);
  213. og[v4] = VertexProperties(4, 1, NORMAL_PIXEL);
  214. og[v5] = VertexProperties(5, 1, NORMAL_PIXEL);
  215. og[v7] = VertexProperties(7, 1, NORMAL_PIXEL);
  216. og[v9] = VertexProperties(9, 1, TOP_PIXEL);
  217. og[v11] = VertexProperties(11, 1, NORMAL_PIXEL);
  218. og[v12] = VertexProperties(12, 1, NORMAL_PIXEL);
  219. og[v13] = VertexProperties(13, 1, NORMAL_PIXEL);
  220. og[v14] = VertexProperties(14, 1, TOP_PIXEL);
  221. og[v15] = VertexProperties(15, 1, NORMAL_PIXEL);
  222. og[v16] = VertexProperties(16, 1, NORMAL_PIXEL);
  223. og[v17] = VertexProperties(17, 1, NORMAL_PIXEL);
  224. og[v18] = VertexProperties(18, 1, TOP_PIXEL);
  225. og[v19] = VertexProperties(19, 1, NORMAL_PIXEL);
  226. og[v20] = VertexProperties(20, 1, NORMAL_PIXEL);
  227. og[v21] = VertexProperties(21, 1, TOP_PIXEL);
  228. og[v22] = VertexProperties(22, 1, NORMAL_PIXEL);
  229. og[v23] = VertexProperties(23, 1, NORMAL_PIXEL);
  230. og[v24] = VertexProperties(24, 1, NORMAL_PIXEL);
  231. og[v25] = VertexProperties(25, 1, NORMAL_PIXEL);
  232. og[v26] = VertexProperties(26, 1, TOP_PIXEL);
  233. og[v27] = VertexProperties(27, 1, NORMAL_PIXEL);
  234. og[v28] = VertexProperties(28, 1, NORMAL_PIXEL);
  235. og[v29] = VertexProperties(29, 1, TOP_PIXEL);
  236. og[v30] = VertexProperties(30, 1, TOP_PIXEL);
  237. og[v31] = VertexProperties(31, 1, NORMAL_PIXEL);
  238. og[v32] = VertexProperties(32, 1, NORMAL_PIXEL);
  239. og[v33] = VertexProperties(33, 1, NORMAL_PIXEL);
  240. og[v34] = VertexProperties(34, 1, TOP_PIXEL);
  241. og[v35] = VertexProperties(35, 1, NORMAL_PIXEL);
  242. og[v36] = VertexProperties(36, 1, TOP_PIXEL);
  243. og[v37] = VertexProperties(37, 1, NORMAL_PIXEL);
  244. }else{
  245. // std::cout<<"Le type de artificiel graphe choisi n'existe pas ! "<<std::endl;
  246. }
  247. }
  248. void modify_file_paths(std::string& absolutePath,
  249. std::vector < std::string* >& files)
  250. {
  251. for (std::vector < std::string* >::iterator it = files.begin();
  252. it != files.end(); it++) {
  253. (*it)->insert(0, absolutePath);
  254. }
  255. }
  256. void build_graph_cyclique(OrientedGraph& og)
  257. {
  258. vertex_to v0 = boost::add_vertex(og);
  259. vertex_to v1 = boost::add_vertex(og);
  260. vertex_to v2 = boost::add_vertex(og);
  261. vertex_to v3 = boost::add_vertex(og);
  262. vertex_to v4 = boost::add_vertex(og);
  263. vertex_to v5 = boost::add_vertex(og);
  264. vertex_to v6 = boost::add_vertex(og);
  265. vertex_to v7 = boost::add_vertex(og);
  266. vertex_to v8 = boost::add_vertex(og);
  267. vertex_to v9 = boost::add_vertex(og);
  268. vertex_to v10 = boost::add_vertex(og);
  269. add_edge(v0, v1, EdgeProperties(1.), og);
  270. add_edge(v0, v2, EdgeProperties(1.), og);
  271. add_edge(v0, v3, EdgeProperties(1.), og);
  272. add_edge(v1, v3, EdgeProperties(1.), og);
  273. add_edge(v2, v1, EdgeProperties(1.), og);
  274. add_edge(v2, v3, EdgeProperties(1.), og);
  275. add_edge(v2, v4, EdgeProperties(1.), og);
  276. add_edge(v2, v5, EdgeProperties(1.), og);
  277. add_edge(v2, v7, EdgeProperties(1.), og);
  278. add_edge(v2, v9, EdgeProperties(1.), og);
  279. add_edge(v3, v4, EdgeProperties(1.), og);
  280. add_edge(v3, v5, EdgeProperties(1.), og);
  281. add_edge(v3, v7, EdgeProperties(1.), og);
  282. add_edge(v3, v9, EdgeProperties(1.), og);
  283. add_edge(v4, v6, EdgeProperties(1.), og);
  284. add_edge(v5, v4, EdgeProperties(1.), og);
  285. add_edge(v5, v6, EdgeProperties(1.), og);
  286. add_edge(v6, v7, EdgeProperties(1.), og);
  287. add_edge(v7, v8, EdgeProperties(1.), og);
  288. add_edge(v7, v10, EdgeProperties(1.), og);
  289. add_edge(v8, v9, EdgeProperties(1.), og);
  290. add_edge(v8, v10, EdgeProperties(1.), og);
  291. add_edge(v9, v10, EdgeProperties(1.), og);
  292. add_edge(v10, v0, EdgeProperties(1.), og);
  293. og[v6] = VertexProperties(6, 1, NORMAL_PIXEL);
  294. og[v8] = VertexProperties(8, 1, NORMAL_PIXEL);
  295. og[v10] = VertexProperties(10, 1, NORMAL_PIXEL);
  296. og[v0] = VertexProperties(0, 1, NORMAL_PIXEL);
  297. og[v1] = VertexProperties(1, 1, NORMAL_PIXEL);
  298. og[v2] = VertexProperties(2, 1, NORMAL_PIXEL);
  299. og[v3] = VertexProperties(3, 1, NORMAL_PIXEL);
  300. og[v4] = VertexProperties(4, 1, NORMAL_PIXEL);
  301. og[v5] = VertexProperties(5, 1, NORMAL_PIXEL);
  302. og[v7] = VertexProperties(7, 1, NORMAL_PIXEL);
  303. og[v9] = VertexProperties(9, 1, NORMAL_PIXEL);
  304. }
  305. void build_example_linked9(OrientedGraph& og)
  306. {
  307. vertex_to v0 = boost::add_vertex(og);
  308. vertex_to v1 = boost::add_vertex(og);
  309. vertex_to v2 = boost::add_vertex(og);
  310. vertex_to v3 = boost::add_vertex(og);
  311. vertex_to v4 = boost::add_vertex(og);
  312. vertex_to v5 = boost::add_vertex(og);
  313. vertex_to v6 = boost::add_vertex(og);
  314. vertex_to v7 = boost::add_vertex(og);
  315. vertex_to v8 = boost::add_vertex(og);
  316. vertex_to v9 = boost::add_vertex(og);
  317. add_edge(v1, v0, EdgeProperties(1.), og);
  318. add_edge(v2, v0, EdgeProperties(1.), og);
  319. add_edge(v3, v0, EdgeProperties(1.), og);
  320. add_edge(v4, v1, EdgeProperties(1.), og);
  321. add_edge(v4, v2, EdgeProperties(1.), og);
  322. add_edge(v5, v1, EdgeProperties(1.), og);
  323. add_edge(v6, v1, EdgeProperties(1.), og);
  324. add_edge(v6, v2, EdgeProperties(1.), og);
  325. add_edge(v6, v3, EdgeProperties(1.), og);
  326. add_edge(v7, v2, EdgeProperties(1.), og);
  327. add_edge(v7, v3, EdgeProperties(1.), og);
  328. add_edge(v8, v2, EdgeProperties(1.), og);
  329. add_edge(v9, v1, EdgeProperties(1.), og);
  330. add_edge(v9, v3, EdgeProperties(1.), og);
  331. og[v6] = VertexProperties(6, 1, TOP_PIXEL);
  332. og[v8] = VertexProperties(8, 1, TOP_PIXEL);
  333. og[v0] = VertexProperties(0, 1, NORMAL_PIXEL);
  334. og[v1] = VertexProperties(1, 1, NORMAL_PIXEL);
  335. og[v2] = VertexProperties(2, 1, NORMAL_PIXEL);
  336. og[v3] = VertexProperties(3, 1, NORMAL_PIXEL);
  337. og[v4] = VertexProperties(4, 1, TOP_PIXEL);
  338. og[v5] = VertexProperties(5, 1, TOP_PIXEL);
  339. og[v7] = VertexProperties(7, 1, TOP_PIXEL);
  340. og[v9] = VertexProperties(9, 1, TOP_PIXEL);
  341. }
  342. /*void build_corsen_graph(OrientedGraph& graph)
  343. {
  344. std::string absolutePath(
  345. "/home/eric/vle/vle-labs/paradevs/src/tests/corsen/data_s/");
  346. std::string modeFile(".mode");
  347. std::string parametersFile("par.txt");
  348. std::string elevationFile("alt");
  349. std::string outletFile("arbre");
  350. std::string layersFile("couche");
  351. std::string contextFile("contexte_yar_scenario.xml");
  352. std::string slopeFile("pav");
  353. std::vector < std::string* > files;
  354. Corsen c;
  355. files.push_back(&parametersFile);
  356. files.push_back(&modeFile);
  357. files.push_back(&elevationFile);
  358. files.push_back(&outletFile);
  359. files.push_back(&slopeFile);
  360. files.push_back(&contextFile);
  361. files.push_back(&layersFile);
  362. modify_file_paths(absolutePath, files);
  363. c.read(files, absolutePath);
  364. c.buildGraph();
  365. const DirectedGraph& g = c.getGraph().graph();
  366. std::vector < vertex_t > og_vertex_list;
  367. std::vector < vertex_t > dg_vertex_list;
  368. std::vector < int > dg_in_vertex_list;
  369. DirectedGraph::vertex_iterator it_dg, end_dg;
  370. tie(it_dg, end_dg) = vertices(g);
  371. for (uint i = 0; it_dg != end_dg; ++it_dg, ++i) {
  372. og_vertex_list.push_back(add_vertex(graph));
  373. dg_vertex_list.push_back(*it_dg);
  374. dg_in_vertex_list.push_back(0);
  375. }
  376. tie(it_dg, end_dg) = vertices(g);
  377. for (uint i = 0; it_dg != end_dg; ++it_dg, ++i) {
  378. DirectedGraph::adjacency_iterator neighbour_it, neighbour_end;
  379. tie(neighbour_it, neighbour_end) = adjacent_vertices(*it_dg, g);
  380. for (; neighbour_it != neighbour_end; ++neighbour_it) {
  381. uint index = 0;
  382. while (dg_vertex_list[index] != *neighbour_it) {
  383. ++index;
  384. }
  385. ++dg_in_vertex_list[index];
  386. boost::add_edge(og_vertex_list[i], og_vertex_list[index],
  387. EdgeProperties(1.), graph);
  388. }
  389. }
  390. tie(it_dg, end_dg) = vertices(g);
  391. for (uint i = 0; it_dg != end_dg; ++it_dg, ++i) {
  392. if (dg_in_vertex_list[i] == 0) {
  393. graph[og_vertex_list[i]] = VertexProperties(i, 1., TOP_PIXEL);
  394. } else {
  395. graph[og_vertex_list[i]] = VertexProperties(i, 1., NORMAL_PIXEL);
  396. }
  397. }
  398. }*/
  399. void brhtg_source(OrientedGraph *go,int nbr_vertex, int nbr_source,
  400. int nbr_v_min, int nbr_v_max, const std::vector<int> &niveau,
  401. std::vector<int> &Ram, std::vector<int> &Exu,
  402. const std::vector<vertex_to> &Vertexs,
  403. int nbr_passe, int nbr_npb)
  404. {
  405. uint nbr_voisin;
  406. int niv=1;
  407. for(uint j =0; j<niveau.size()-1; j++){
  408. niv *= niveau.at(j);
  409. }
  410. int niv_tot=1;
  411. for(uint j =0; j<niveau.size(); j++){
  412. niv_tot *= niveau.at(j);
  413. }
  414. for(int b = 0; b<niv; b++){
  415. std::vector<uint> branche;
  416. int cpt = 0;
  417. while(cpt != niveau.at(niveau.size()-1)+1){
  418. branche.push_back((b*niveau.at(niveau.size()-1)+cpt)*nbr_npb);
  419. cpt++;
  420. }
  421. for(uint i =0; i<branche.size()-1;i++){
  422. for(uint j = branche.at(i); j<branche.at(i+1); j++){
  423. if(j==branche.at(branche.size()-1)-1){
  424. break;
  425. }
  426. else{
  427. nbr_voisin = rand_fini(nbr_v_min, nbr_v_max+1);
  428. uint cpt=0;
  429. Entiers ensemble;
  430. int cpt_nbr_s = 0;
  431. while(cpt != nbr_voisin){
  432. int val;
  433. if(j<branche.at(i)+nbr_source){ // Les sommets sont des sources donc imossible de recevoir des données
  434. val = rand_fini(j + 4, j + nbr_v_max + nbr_passe);
  435. }
  436. else if(j>=branche.at(i)+nbr_npb-nbr_passe && i!= (branche.size()-2)){ // Les sommets sont en fin de branche, nécessité de raccordement avec les autres branches
  437. val = rand_fini(branche.at(branche.size()-1)-4, branche.at(branche.size()-1));
  438. }
  439. else if(j>=branche.at(i)+nbr_npb-nbr_passe && i== (branche.size()-2)){ // Les sommets sont proche de l'exutoire
  440. val = rand_fini(j+1,branche.at(branche.size()-1));
  441. }
  442. else{ // Les sommets sont en plein milieu d'une branche
  443. val = rand_fini(j+1, j+nbr_passe);
  444. }
  445. if(In_tab(ensemble,val) != 1){
  446. ensemble.push_back(val);
  447. boost::add_edge(Vertexs.at(j), Vertexs.at(val), EdgeProperties(1.), *go);
  448. cpt++;
  449. }
  450. else{
  451. if((nbr_vertex-j) == cpt)
  452. break;
  453. else
  454. cpt_nbr_s++;
  455. }
  456. if(cpt_nbr_s>2*nbr_passe)
  457. break;
  458. }
  459. }
  460. }
  461. }
  462. /*for(int i =0; i<branche.size()-1; i++){
  463. for(int j = branche.at(i)+nbr_source; j<branche.at(i+1); j++){
  464. (*go)[Vertexs.at(j)] = VertexProperties(j, 1, NORMAL_PIXEL);
  465. }
  466. }
  467. for(int i =0; i<branche.size()-1; i++){
  468. for(int j = branche.at(i); j<branche.at(i)+nbr_source; j++){
  469. (*go)[Vertexs.at(j)] = VertexProperties(j, 1, TOP_PIXEL);
  470. }
  471. }*/
  472. Ram.push_back((niv_tot+b)*nbr_npb);
  473. Exu.push_back(branche.at(branche.size()-1)-1);
  474. }
  475. Ram.push_back(Ram.at(Ram.size()-1)+nbr_npb);
  476. if(niveau.size()>1){
  477. nbr_voisin = 2;
  478. for(uint k =0; k<Exu.size(); k++){
  479. for(uint l = Exu.at(k)-2; l<Exu.at(k)+1; l++){
  480. int cpt=0;
  481. Entiers ensemble;
  482. int cpt_nbr_s = 0;
  483. while(cpt!=nbr_voisin){
  484. int val = rand_fini(Ram.at(k),Ram.at(k)+2);
  485. if(In_tab(ensemble,val)!=1){
  486. ensemble.push_back(val);
  487. boost::add_edge(Vertexs.at(l), Vertexs.at(val), EdgeProperties(1.), *go);
  488. cpt++;
  489. }
  490. else{
  491. if((nbr_vertex-l)==cpt)
  492. break;
  493. else
  494. cpt_nbr_s++;
  495. }
  496. if(cpt_nbr_s>2*nbr_passe)
  497. break;
  498. }
  499. }
  500. }
  501. }
  502. }
  503. void brhtg_ramification(OrientedGraph *go, int nbr_vertex, int nbr_v_min,
  504. int nbr_v_max, const std::vector<int> &niveau,
  505. std::vector<int> &Ram, std::vector<int> &Exu,
  506. const std::vector<vertex_to> &Vertexs,
  507. int nbr_passe, int nbr_npb)
  508. {
  509. int nbr_voisin;
  510. int cpt_ram = 1;
  511. while(cpt_ram != niveau.size()-1){
  512. int niv=1;
  513. for(int j =0; j<niveau.size()-1-cpt_ram; j++){
  514. niv *= niveau.at(j);
  515. }
  516. int niv_tot=0;
  517. for(int i =0; i<=cpt_ram; i++){
  518. int tmp_niv_tot=1;
  519. for(int j =0; j<niveau.size()-i; j++){
  520. tmp_niv_tot *= niveau.at(j);
  521. }
  522. niv_tot+=tmp_niv_tot;
  523. }
  524. std::vector<std::vector<int> > branche;
  525. int cpt_b=0;
  526. for(int j = 0; j<(Ram.size()-1)/niveau.at(niveau.size()-1-cpt_ram); j++){
  527. std::vector<int> tmp_branche;
  528. for(int i =0; i< niveau.at(niveau.size()-1-cpt_ram); i++){
  529. tmp_branche.push_back(Ram.at(i+cpt_b));
  530. }
  531. tmp_branche.push_back(tmp_branche.at(tmp_branche.size()-1)+nbr_npb);
  532. branche.push_back(tmp_branche);
  533. cpt_b+=niveau.at(niveau.size()-1-cpt_ram);
  534. }
  535. Ram.clear();
  536. Exu.clear();
  537. for(int b = 0; b<niv; b++){
  538. for(int i =0; i<branche.at(b).size()-1;i++){
  539. for(int j = branche.at(b).at(i); j<branche.at(b).at(i+1); j++){
  540. if(j==branche.at(b).at(branche.at(b).size()-1)-1){
  541. break;
  542. }
  543. else{
  544. nbr_voisin = rand_fini(nbr_v_min, nbr_v_max+1);
  545. int cpt=0;
  546. Entiers ensemble;
  547. int cpt_nbr_s = 0;
  548. while(cpt!=nbr_voisin){
  549. int val;
  550. if(j>=branche.at(b).at(i)+nbr_npb-nbr_passe && i!= (branche.at(b).size()-2)){ // Les sommets sont en fin de branche, nécessité de raccordement avec les autres branches
  551. val = rand_fini(branche.at(b).at(branche.at(b).size()-1)-4, branche.at(b).at(branche.at(b).size()-1));
  552. }
  553. else if(j>=branche.at(b).at(i)+nbr_npb-nbr_passe && i== (branche.at(b).size()-2)){ // Les sommets sont proche de l'exutoire
  554. val = rand_fini(j+1,branche.at(b).at(branche.at(b).size()-1));
  555. }
  556. else{ // Les sommets sont en plein milieu d'une branche
  557. val = rand_fini(j+1, j+nbr_passe);
  558. }
  559. if(In_tab(ensemble,val)!=1){
  560. ensemble.push_back(val);
  561. boost::add_edge(Vertexs.at(j), Vertexs.at(val), EdgeProperties(1.), *go);
  562. cpt++;
  563. }
  564. else{
  565. if((nbr_vertex-j)==cpt)
  566. break;
  567. else
  568. cpt_nbr_s++;
  569. }
  570. if(cpt_nbr_s>2*nbr_passe)
  571. break;
  572. }
  573. }
  574. }
  575. }
  576. Ram.push_back((niv_tot+b)*nbr_npb);
  577. Exu.push_back(branche.at(b).at(branche.at(b).size()-1)-1);
  578. /*for(int y =0; y<branche.at(b).size()-1; y++){
  579. for(int x = branche.at(b).at(y); x<branche.at(b).at(y+1); x++){
  580. (*go)[Vertexs.at(x)] = VertexProperties(x, 1, NORMAL_PIXEL);
  581. }
  582. }*/
  583. }
  584. Ram.push_back(Ram.at(Ram.size()-1)+nbr_npb);
  585. nbr_voisin = 2;
  586. for(int k =0; k<Exu.size(); k++){
  587. for(int l = Exu.at(k)-1; l<Exu.at(k)+1; l++){
  588. int cpt=0;
  589. Entiers ensemble;
  590. int cpt_nbr_s = 0;
  591. while(cpt!=nbr_voisin){
  592. int val = rand_fini(Ram.at(k),Ram.at(k)+2);
  593. if(In_tab(ensemble,val)!=1){
  594. ensemble.push_back(val);
  595. boost::add_edge(Vertexs.at(l), Vertexs.at(val), EdgeProperties(1.), *go);
  596. cpt++;
  597. }
  598. else{
  599. if((nbr_vertex-l)==cpt)
  600. break;
  601. else
  602. cpt_nbr_s++;
  603. }
  604. if(cpt_nbr_s>2*nbr_passe)
  605. break;
  606. }
  607. }
  608. }
  609. cpt_ram++;
  610. }
  611. }
  612. void brhtg_exutoire(OrientedGraph *go,int nbr_vertex,int nbr_v_min,
  613. int nbr_v_max,
  614. std::vector<int> &Ram,
  615. const std::vector<vertex_to> &Vertexs,
  616. int nbr_passe)
  617. {
  618. int nbr_voisin;
  619. Ram.at(Ram.size()-1)=nbr_vertex;
  620. for(int i =0; i<Ram.size()-1;i++){
  621. for(int j = Ram.at(i); j<Ram.at(i+1); j++){
  622. if(j==Ram.at(Ram.size()-1)-1){
  623. //(*go)[Vertexs.at(j)] = VertexProperties(j, 1, NORMAL_PIXEL);
  624. break;
  625. }
  626. else{
  627. if(Ram.at(i+1)-j<nbr_passe)
  628. nbr_voisin = 2;
  629. else
  630. nbr_voisin = rand_fini(nbr_v_min, nbr_v_max+1);
  631. int cpt=0;
  632. Entiers ensemble;
  633. int cpt_nbr_s = 0;
  634. while(cpt!=nbr_voisin){
  635. int val;
  636. if(j>=Ram.at(i+1)-nbr_passe && i!=Ram.size()-2){ // Les sommets sont proche de l'exutoire
  637. val = rand_fini(Ram.at(Ram.size()-1)-4,Ram.at(Ram.size()-1));
  638. }
  639. else if(j>=Ram.at(i+1)-nbr_passe && i==Ram.size()-2){ // Les sommets sont proche de l'exutoire
  640. val = rand_fini(j+1,Ram.at(Ram.size()-1));
  641. }
  642. else{ // Les sommets sont en plein milieu d'une branche
  643. val = rand_fini(j+1, j+nbr_passe);
  644. }
  645. if(In_tab(ensemble,val)!=1&& j!=val){
  646. ensemble.push_back(val);
  647. boost::add_edge(Vertexs.at(j), Vertexs.at(val), EdgeProperties(1.), *go);
  648. cpt++;
  649. }
  650. else{
  651. if((nbr_vertex-j)==cpt)
  652. break;
  653. else
  654. cpt_nbr_s++;
  655. }
  656. if(cpt_nbr_s>2*nbr_passe)
  657. break;
  658. }
  659. }
  660. //(*go)[Vertexs.at(j)] = VertexProperties(j, 1, NORMAL_PIXEL);
  661. }
  662. }
  663. }
  664. void build_generator_graph(OrientedGraph *go, int nbr_vertex, int nbr_source,
  665. int nbr_v_min, int nbr_v_max,
  666. const std::vector<int> &niveau)
  667. {
  668. std::vector<vertex_to> Vertexs;
  669. OrientedGraph::in_edge_iterator ei, edge_end;
  670. int nbr_npb;
  671. int nbr_branche = 0;
  672. int nbr_passe = 4;
  673. for(int i =0; i<nbr_vertex; i++){
  674. vertex_to vo = boost::add_vertex(*go);
  675. Vertexs.push_back(vo);
  676. }
  677. // Calcul du nombre de branches à partir de l'information des niveaux
  678. for(int i =0; i< niveau.size(); i++){
  679. int nbr_tmp =1;
  680. for(int j =0; j<=i; j++){
  681. nbr_tmp *= niveau.at(j);
  682. }
  683. nbr_branche += nbr_tmp;
  684. }
  685. // std::cout<<nbr_branche<<std::endl;
  686. nbr_npb = nbr_vertex/(nbr_branche);
  687. std::vector<int> Ram;
  688. std::vector<int> Exu;
  689. if(niveau.size()>1){
  690. /*
  691. * *** Code Source ***
  692. */
  693. brhtg_source(go,nbr_vertex,nbr_source,nbr_v_min,nbr_v_max,niveau,Ram,Exu,Vertexs,nbr_passe,nbr_npb);
  694. /*
  695. * *** Code Ramifications ***
  696. */
  697. brhtg_ramification(go,nbr_vertex,nbr_v_min,nbr_v_max,niveau,
  698. Ram,Exu,Vertexs,nbr_passe,nbr_npb);
  699. /*
  700. * *** Code Exutoire ***
  701. */
  702. brhtg_exutoire(go,nbr_vertex,nbr_v_min,nbr_v_max,
  703. Ram,Vertexs,nbr_passe);
  704. } else {
  705. brhtg_source(go,nbr_vertex,nbr_source,nbr_v_min,nbr_v_max,niveau,Ram,Exu,Vertexs,nbr_passe,nbr_npb);
  706. }
  707. std::vector < int > dg_in_vertex_list;
  708. std::vector <vertex_to> dg_vertex_list;
  709. OrientedGraph::vertex_iterator it_dg, end_dg;
  710. boost::tie(it_dg, end_dg) = vertices(*go);
  711. for (uint i = 0; it_dg != end_dg; ++it_dg, ++i) {
  712. dg_in_vertex_list.push_back(0);
  713. dg_vertex_list.push_back(*it_dg);
  714. }
  715. boost::tie(it_dg, end_dg) = vertices(*go);
  716. for (uint i = 0; it_dg != end_dg; ++it_dg, ++i) {
  717. OrientedGraph::adjacency_iterator neighbour_it, neighbour_end;
  718. tie(neighbour_it, neighbour_end) = adjacent_vertices(*it_dg, *go);
  719. for (; neighbour_it != neighbour_end; ++neighbour_it) {
  720. uint index = 0;
  721. while (dg_vertex_list[index] != *neighbour_it) {
  722. ++index;
  723. }
  724. ++dg_in_vertex_list[index];
  725. }
  726. }
  727. int compteur = 0;
  728. for(uint i = 0; i<num_vertices(*go); i++){
  729. bool indic = false;
  730. for(boost::tie(ei,edge_end) = in_edges(i,*go); ei != edge_end; ++ei){
  731. indic = true;
  732. break;
  733. }
  734. if(dg_in_vertex_list.at(i) == 0 || indic == false){
  735. compteur++;
  736. (*go)[i] = VertexProperties(i, 1, TOP_PIXEL);
  737. }else{
  738. (*go)[i] = VertexProperties(i, 1, NORMAL_PIXEL);
  739. }
  740. //std::cout<<(*go)[i]._index<<" "<<indic<<" -> "<<(*go)[i]._type<<std::endl;
  741. }
  742. // std::cout<<"Compteur : "<<compteur<<std::endl;
  743. }
  744. void build_generator_graph_linked(OrientedGraph *go, int nbr_vertex,
  745. int nbr_couche, int nbr_v_min, int nbr_v_max)
  746. {
  747. std::vector<vertex_to> Vertexs;
  748. OrientedGraph::in_edge_iterator ei, edge_end;
  749. for(int i =0; i<nbr_vertex; i++){
  750. vertex_to vo = boost::add_vertex(*go);
  751. Vertexs.push_back(vo);
  752. }
  753. /*Création du vecteur contenant le nombre de sommets par couche*/
  754. int midel_couche = nbr_couche-2;
  755. int top_couche;
  756. if(nbr_couche>5){
  757. top_couche = floor(nbr_vertex/3);//floor(midel_couche/2));
  758. }else{
  759. top_couche = floor(nbr_vertex/2);
  760. }
  761. int nbr_vertex_midel_couche = nbr_vertex - top_couche -1;
  762. int tmp = 0;
  763. std::vector<int> nbr_som_couche;
  764. nbr_som_couche.push_back(1);
  765. for(int i = 1; i <= midel_couche; i++){
  766. tmp += i;
  767. }
  768. for(int i = 0; i < midel_couche; i++){
  769. nbr_som_couche.push_back(floor((i+1)*nbr_vertex_midel_couche/tmp));
  770. }
  771. nbr_som_couche.push_back(top_couche);
  772. int sum = 0;
  773. for(int i = 0; i < nbr_som_couche.size(); i++){
  774. sum += nbr_som_couche.at(i);
  775. }
  776. int reste = nbr_vertex - sum;
  777. /*std::cout<<"sum : "<<sum<<std::endl;
  778. std::cout<<"midel_couche : "<<midel_couche<<std::endl;
  779. std::cout<<"top_couche : "<<top_couche<<std::endl;
  780. std::cout<<"nbr_vertex_midel_couche : "<<nbr_vertex_midel_couche<<std::endl;
  781. std::cout<<"tmp : "<<tmp<<std::endl;
  782. std::cout<<"reste : "<<reste<<std::endl;
  783. for(int i =0; i < nbr_som_couche.size(); i++){
  784. std::cout<<nbr_som_couche.at(i)<<" ";
  785. }
  786. std::cout<<std::endl;*/
  787. while(reste != 0){
  788. for(int i = 1; i <nbr_som_couche.size(); i++){
  789. nbr_som_couche.at(i) += 1;
  790. reste --;
  791. if(reste == 0){
  792. break;
  793. }
  794. }
  795. }
  796. /*for(int i =0; i < nbr_som_couche.size(); i++){
  797. std::cout<<nbr_som_couche.at(i)<<" ";
  798. }
  799. std::cout<<std::endl;*/
  800. /*Génération du graphe*/
  801. std::vector<int> tab_couche_som;
  802. tab_couche_som.push_back(0);
  803. for(int i =1; i<nbr_som_couche.size(); i++){
  804. tab_couche_som.push_back(tab_couche_som.at(i-1)+nbr_som_couche.at(i));
  805. }
  806. /*for(int i =0; i < tab_couche_som.size(); i++){
  807. std::cout<<tab_couche_som.at(i)<<" ";
  808. }
  809. std::cout<<std::endl;*/
  810. int nbr_vois = nbr_v_max+2;
  811. int cpt = 0;
  812. for(int i = tab_couche_som.at(tab_couche_som.size()-2)+1; i <= tab_couche_som.at(tab_couche_som.size()-1); i++){
  813. std::vector<int> vertex_tmp;
  814. int rand = rand_fini(nbr_v_min,nbr_v_max+1);
  815. int neigh_cpt = 0;
  816. while(neigh_cpt != rand){
  817. int val;
  818. if(cpt<nbr_vois){
  819. val = rand_fini(tab_couche_som.at(tab_couche_som.size()-3)+cpt+1,tab_couche_som.at(tab_couche_som.size()-3)+cpt+1+nbr_vois);
  820. //std::cout<<"val1 : "<<val<<std::endl;
  821. }else if(cpt>nbr_vois && cpt<(tab_couche_som.at(tab_couche_som.size()-2)-tab_couche_som.at(tab_couche_som.size()-3)+1-nbr_vois)){
  822. val = rand_fini(tab_couche_som.at(tab_couche_som.size()-3)+cpt+1-nbr_vois,tab_couche_som.at(tab_couche_som.size()-3)+cpt+1+nbr_vois);
  823. //std::cout<<"val2 : "<<val<<std::endl;
  824. }else{
  825. val = rand_fini(tab_couche_som.at(tab_couche_som.size()-2)+1-2*nbr_vois,tab_couche_som.at(tab_couche_som.size()-2)+1);
  826. //std::cout<<"val3 : "<<val<<std::endl;
  827. }
  828. if(In_tab(vertex_tmp,val) != 1){
  829. boost::add_edge(Vertexs.at(i), Vertexs.at(val), EdgeProperties(1.), *go);
  830. vertex_tmp.push_back(val);
  831. neigh_cpt ++;
  832. }
  833. }
  834. cpt ++;
  835. }
  836. //std::cout<<"Passage !"<<std::endl;
  837. for(int j = 2; j < tab_couche_som.size()-1; j++){
  838. cpt = 0;
  839. for(int i = tab_couche_som.at(tab_couche_som.size()-1-j)+1; i <= tab_couche_som.at(tab_couche_som.size()-1-(j-1)); i++){
  840. std::vector<int> vertex_tmp;
  841. int rand = rand_fini(nbr_v_min,nbr_v_max+1);
  842. //std::cout<<"rand : "<<rand<<std::endl;
  843. int neigh_cpt = 0;
  844. while(neigh_cpt != rand){
  845. int val;
  846. if((tab_couche_som.at(tab_couche_som.size()-2-(j-1))-tab_couche_som.at(tab_couche_som.size()-2-j))>2*nbr_vois){
  847. if(cpt<nbr_vois){
  848. val = rand_fini(tab_couche_som.at(tab_couche_som.size()-2-j)+cpt+1,tab_couche_som.at(tab_couche_som.size()-2-j)+cpt+1+nbr_vois);
  849. //std::cout<<"val1 : "<<val<<std::endl;
  850. }else if(cpt>nbr_vois && cpt<(tab_couche_som.at(tab_couche_som.size()-2-(j-1))-tab_couche_som.at(tab_couche_som.size()-2-j)+1-nbr_vois)){
  851. val = rand_fini(tab_couche_som.at(tab_couche_som.size()-2-j)+cpt+1-nbr_vois,tab_couche_som.at(tab_couche_som.size()-2-j)+cpt+1+nbr_vois);
  852. //std::cout<<"val2 : "<<val<<std::endl;
  853. }else{
  854. if(2*nbr_vois<(tab_couche_som.at(tab_couche_som.size()-2-(j-1))-tab_couche_som.at(tab_couche_som.size()-2-j)+1)){
  855. val = rand_fini(tab_couche_som.at(tab_couche_som.size()-2-(j-1))+1-2*nbr_vois,tab_couche_som.at(tab_couche_som.size()-2-(j-1))+1);
  856. }else{
  857. val = rand_fini(tab_couche_som.at(tab_couche_som.size()-2-(j-1))+1-nbr_vois,tab_couche_som.at(tab_couche_som.size()-2-(j-1))+1);
  858. }
  859. //std::cout<<"val3 : "<<val<<std::endl;
  860. }
  861. }else{
  862. val = rand_fini(tab_couche_som.at(tab_couche_som.size()-2-j)+1,tab_couche_som.at(tab_couche_som.size()-2-(j-1))+1);
  863. }
  864. //int val = rand_fini(tab_couche_som.at(tab_couche_som.size()-2-j)+1,tab_couche_som.at(tab_couche_som.size()-2-(j-1))+1);
  865. if(In_tab(vertex_tmp,val) != 1){
  866. boost::add_edge(Vertexs.at(i), Vertexs.at(val), EdgeProperties(1.), *go);
  867. vertex_tmp.push_back(val);
  868. neigh_cpt ++;
  869. }
  870. }
  871. cpt ++;
  872. }
  873. }
  874. //std::cout<<"Passage2 !"<<std::endl;
  875. for(int i = tab_couche_som.at(0)+1; i <= tab_couche_som.at(1); i++){
  876. //int val = rand_fini(0,2);
  877. //if(val == 0){
  878. boost::add_edge(Vertexs.at(i), Vertexs.at(0), EdgeProperties(1.), *go);
  879. //}
  880. }
  881. //std::cout<<"Passage3 !"<<std::endl;
  882. std::vector < int > dg_in_vertex_list;
  883. std::vector <vertex_to> dg_vertex_list;
  884. OrientedGraph::vertex_iterator it_dg, end_dg;
  885. boost::tie(it_dg, end_dg) = vertices(*go);
  886. for (uint i = 0; it_dg != end_dg; ++it_dg, ++i) {
  887. dg_in_vertex_list.push_back(0);
  888. dg_vertex_list.push_back(*it_dg);
  889. }
  890. boost::tie(it_dg, end_dg) = vertices(*go);
  891. for (uint i = 0; it_dg != end_dg; ++it_dg, ++i) {
  892. OrientedGraph::adjacency_iterator neighbour_it, neighbour_end;
  893. tie(neighbour_it, neighbour_end) = adjacent_vertices(*it_dg, *go);
  894. for (; neighbour_it != neighbour_end; ++neighbour_it) {
  895. uint index = 0;
  896. while (dg_vertex_list[index] != *neighbour_it) {
  897. ++index;
  898. }
  899. ++dg_in_vertex_list[index];
  900. }
  901. }
  902. for(uint i = 0; i<num_vertices(*go); i++){
  903. bool indic = false;
  904. for(boost::tie(ei,edge_end) = in_edges(i,*go); ei != edge_end; ++ei){
  905. indic = true;
  906. break;
  907. }
  908. if(dg_in_vertex_list.at(i) == 0 || indic == false){
  909. (*go)[i] = VertexProperties(i, 1, TOP_PIXEL);
  910. }else{
  911. (*go)[i] = VertexProperties(i, 1, NORMAL_PIXEL);
  912. }
  913. }
  914. }
  915. void build_graph_grid(OrientedGraph *go, int side,
  916. const std::vector<std::pair<int,int>> &vertex_selection,
  917. const Entiers &weight_vertex,
  918. const char *edge_weight, bool rec)
  919. {
  920. int nbr_vertex = side*side;
  921. std::vector<vertex_to> Vertexs;
  922. for(int i =0; i<nbr_vertex; i++){
  923. vertex_to vo = boost::add_vertex(*go);
  924. Vertexs.push_back(vo);
  925. }
  926. if(rec == true){
  927. std::ofstream fichier (edge_weight, std::ios::out);
  928. for(int i = 0; i<side; i++){
  929. for(int j = 0; j<side-1; j++){
  930. boost::add_edge(i*side+j, i*side+j+1,EdgeProperties(1), *go);
  931. fichier<<i*side+j<<" "<<i*side+j+1<<" "<<1<<" "<<std::endl;
  932. }
  933. }
  934. for(int i = 0; i<side-1; i++){
  935. for(int j = 0; j<side; j++){
  936. boost::add_edge(i*side+j, (i+1)*side+j,EdgeProperties(1), *go);
  937. fichier<<i*side+j<<" "<<(i+1)*side+j<<" "<<1<<" "<<std::endl;
  938. }
  939. }
  940. fichier.close();
  941. }else{
  942. for(int i = 0; i<side; i++){
  943. for(int j = 0; j<side-1; j++){
  944. boost::add_edge(i*side+j, i*side+j+1,EdgeProperties(1), *go);
  945. }
  946. }
  947. for(int i = 0; i<side-1; i++){
  948. for(int j = 0; j<side; j++){
  949. boost::add_edge(i*side+j, (i+1)*side+j,EdgeProperties(1), *go);
  950. }
  951. }
  952. }
  953. (*go)[0] = VertexProperties(0, 1, TOP_PIXEL);
  954. for(uint i = 1; i<num_vertices(*go); i++){
  955. (*go)[i] = VertexProperties(i, 1, NORMAL_PIXEL);
  956. }
  957. for(int ind=0; ind<vertex_selection.size(); ind++){
  958. for(int ind_i = vertex_selection.at(ind).first; ind_i<vertex_selection.at(ind).second+1; ind_i++){
  959. if(ind_i != 0)
  960. (*go)[ind_i] = VertexProperties(ind_i, weight_vertex.at(ind), NORMAL_PIXEL);
  961. else
  962. (*go)[ind_i] = VertexProperties(ind_i, weight_vertex.at(ind), TOP_PIXEL);
  963. }
  964. }
  965. if(rec == false){
  966. std::ifstream fichier (edge_weight, std::ios::in);
  967. if(fichier){
  968. bool found;
  969. edge_to e1;
  970. int edge1, edge2;
  971. double edge_weight;
  972. int lines = std::count(std::istreambuf_iterator<char>( fichier ),std::istreambuf_iterator<char>(),'\n' );
  973. //std::cout<<lines<<std::endl;
  974. int cpt =0;
  975. int length;
  976. fichier.seekg(0, std::ios::beg);
  977. while(cpt < lines){
  978. fichier >> edge1 >> edge2 >> edge_weight;
  979. tie(e1,found)=edge(vertex(edge1,*go),vertex(edge2,*go),*go);
  980. (*go)[e1] = EdgeProperties(edge_weight);
  981. //std::cout<<edge1<<" "<<edge2<<" "<<edge_weight<<std::endl;
  982. length = fichier.tellg();
  983. fichier.seekg(length+1, std::ios::beg);
  984. cpt++;
  985. }
  986. }else{
  987. // std::cerr<<"Bugggggg du fichier txt !!!! "<<std::endl;
  988. }
  989. fichier.close();
  990. }
  991. }
  992. void build_example_ligne(OrientedGraph& og)
  993. {
  994. vertex_to v0 = boost::add_vertex(og);
  995. vertex_to v1 = boost::add_vertex(og);
  996. vertex_to v2 = boost::add_vertex(og);
  997. vertex_to v3 = boost::add_vertex(og);
  998. vertex_to v4 = boost::add_vertex(og);
  999. vertex_to v5 = boost::add_vertex(og);
  1000. vertex_to v6 = boost::add_vertex(og);
  1001. vertex_to v7 = boost::add_vertex(og);
  1002. add_edge(v0, v1, EdgeProperties(1.), og);
  1003. add_edge(v1, v2, EdgeProperties(1.), og);
  1004. add_edge(v2, v3, EdgeProperties(1.), og);
  1005. add_edge(v3, v4, EdgeProperties(1.), og);
  1006. add_edge(v4, v5, EdgeProperties(1.), og);
  1007. add_edge(v5, v6, EdgeProperties(1.), og);
  1008. add_edge(v6, v7, EdgeProperties(1.), og);
  1009. og[v6] = VertexProperties(6, 1, NORMAL_PIXEL);
  1010. og[v0] = VertexProperties(0, 1, TOP_PIXEL);
  1011. og[v1] = VertexProperties(1, 1, NORMAL_PIXEL);
  1012. og[v2] = VertexProperties(2, 1, NORMAL_PIXEL);
  1013. og[v3] = VertexProperties(3, 1, NORMAL_PIXEL);
  1014. og[v4] = VertexProperties(4, 1, NORMAL_PIXEL);
  1015. og[v5] = VertexProperties(5, 1, NORMAL_PIXEL);
  1016. og[v7] = VertexProperties(7, 1, NORMAL_PIXEL);
  1017. }
  1018. void build_example_grid(OrientedGraph& og)
  1019. {
  1020. vertex_to v0 = boost::add_vertex(og);
  1021. vertex_to v1 = boost::add_vertex(og);
  1022. vertex_to v2 = boost::add_vertex(og);
  1023. vertex_to v3 = boost::add_vertex(og);
  1024. vertex_to v4 = boost::add_vertex(og);
  1025. vertex_to v5 = boost::add_vertex(og);
  1026. vertex_to v6 = boost::add_vertex(og);
  1027. vertex_to v7 = boost::add_vertex(og);
  1028. add_edge(v0, v1, EdgeProperties(0.9), og);
  1029. add_edge(v0, v2, EdgeProperties(0.9), og);
  1030. add_edge(v0, v3, EdgeProperties(0.1), og);
  1031. add_edge(v1, v2, EdgeProperties(0.1), og);
  1032. add_edge(v1, v3, EdgeProperties(0.9), og);
  1033. add_edge(v2, v3, EdgeProperties(0.9), og);
  1034. add_edge(v2, v4, EdgeProperties(0.9), og);
  1035. add_edge(v2, v5, EdgeProperties(0.1), og);
  1036. add_edge(v3, v4, EdgeProperties(0.1), og);
  1037. add_edge(v3, v5, EdgeProperties(0.9), og);
  1038. add_edge(v4, v5, EdgeProperties(0.9), og);
  1039. add_edge(v4, v6, EdgeProperties(0.9), og);
  1040. add_edge(v4, v7, EdgeProperties(0.1), og);
  1041. add_edge(v5, v6, EdgeProperties(0.1), og);
  1042. add_edge(v5, v7, EdgeProperties(0.9), og);
  1043. add_edge(v6, v7, EdgeProperties(0.9), og);
  1044. og[v6] = VertexProperties(6, 1, NORMAL_PIXEL);
  1045. og[v0] = VertexProperties(0, 1, TOP_PIXEL);
  1046. og[v1] = VertexProperties(1, 1, NORMAL_PIXEL);
  1047. og[v2] = VertexProperties(2, 1, NORMAL_PIXEL);
  1048. og[v3] = VertexProperties(3, 1, NORMAL_PIXEL);
  1049. og[v4] = VertexProperties(4, 1, NORMAL_PIXEL);
  1050. og[v5] = VertexProperties(5, 1, NORMAL_PIXEL);
  1051. og[v7] = VertexProperties(7, 1, NORMAL_PIXEL);
  1052. }
  1053. void build_parcellaire_graph(OrientedGraph *go, uint size_max, std::string name)
  1054. {
  1055. std::vector<std::pair<double,double> > point;
  1056. OrientedGraph::in_edge_iterator ei, edge_end;
  1057. double max_distance = 3000;//sqrt(2)*5*size_max/50;
  1058. double crit = sqrt(2)*5*size_max/1000;
  1059. // std::cout << "distance max : " << max_distance << std::endl;
  1060. // std::cout << "crit : " << crit << std::endl;
  1061. for(uint i = 0; i < size_max; i++)
  1062. {
  1063. std::pair<double,double> p;
  1064. p.first = rand()%(size_max*5-0) + 0;
  1065. p.second = rand()%(size_max*5-0) + 0;
  1066. point.push_back(p);
  1067. }
  1068. //std::cout << std::endl;
  1069. sort(point.begin(),point.end());
  1070. std::vector<std::vector<std::pair<double,uint> > > save_point_distance;
  1071. for(uint id = 0 ; id < point.size() - 1; id++)
  1072. {
  1073. std::vector<std::pair<double,uint> > point_distance, point_distance_sort;
  1074. //if(name != "multi"){
  1075. for(uint i = id +1 ; i < point.size(); i++)
  1076. {
  1077. std::pair<double,uint> pd;
  1078. pd.first = distance_t(point.at(id),point.at(i));
  1079. pd.second = i;
  1080. point_distance.push_back(pd);
  1081. }
  1082. /*}else{
  1083. for(uint i = 0 ; i < point.size(); i++)
  1084. {
  1085. std::pair<double,uint> pd;
  1086. pd.first = distance_t(point.at(id),point.at(i));
  1087. pd.second = i;
  1088. point_distance.push_back(pd);
  1089. }
  1090. }*/
  1091. point_distance_sort = point_distance;
  1092. sort(point_distance_sort.begin(), point_distance_sort.end());
  1093. std::vector<uint> deleted;
  1094. uint t;
  1095. if(point_distance_sort.size() > 50)
  1096. t = point_distance_sort.size()/2;
  1097. else
  1098. t = point_distance_sort.size();
  1099. /*if(name != "multi"){*/
  1100. for(uint i = 0 ; i < t; i++)
  1101. {
  1102. if(point_distance_sort.at(i).first < crit)
  1103. deleted.push_back(point_distance_sort.at(i).second);
  1104. //std::cout << point_distance_sort.at(i).second << " " << point_distance_sort.at(i).first <<std::endl;
  1105. }
  1106. /*}else{
  1107. for(uint i = 0 ; i < t; i++)
  1108. {
  1109. if(point_distance_sort.at(i).first < crit & point_distance_sort.at(i).first != 0)
  1110. deleted.push_back(point_distance_sort.at(i).second);
  1111. //std::cout << point_distance_sort.at(i).second << " " << point_distance_sort.at(i).first <<std::endl;
  1112. }
  1113. }*/
  1114. //std::cout<<std::endl;
  1115. sort(deleted.begin(), deleted.end());
  1116. std::reverse(deleted.begin(), deleted.end());
  1117. /*for(uint k = 0 ; k < deleted.size(); k++)
  1118. std::cout << deleted.at(k) << " " ;
  1119. std::cout<< std::endl << std::endl;*/
  1120. /*std::cout << "A : " << std::endl;
  1121. for(uint pp = 0; pp < point_distance.size(); pp++)
  1122. std::cout << point_distance.at(pp).second << " ";
  1123. std::cout<< std::endl << std::endl;*/
  1124. if(deleted.size() > 1)
  1125. {
  1126. //std::cout<<"Deleted"<<std::endl;
  1127. for(uint del = 0 ; del < deleted.size(); del++)
  1128. {
  1129. //std::cout << deleted.at(del) << " ";
  1130. for(uint idp = 0; idp < point_distance.size(); idp++)
  1131. {
  1132. if(point_distance.at(idp).second == deleted.at(del))
  1133. {
  1134. //std::cout << idp + id + 1 << std::endl;
  1135. /*if(name != "multi")
  1136. {*/
  1137. point.erase(point.begin() + idp + id + 1);
  1138. point_distance.erase(point_distance.begin() + idp);
  1139. for(uint pp = 0; pp < id ; pp++)
  1140. {
  1141. save_point_distance.at(pp).erase(save_point_distance.at(pp).begin() + idp);
  1142. for(uint j = idp; j < save_point_distance.at(pp).size(); j++)
  1143. save_point_distance.at(pp).at(j).second -=1;
  1144. }
  1145. for(uint j = idp; j < point_distance.size(); j++)
  1146. point_distance.at(j).second -= 1;
  1147. /*}else
  1148. {
  1149. point.erase(point.begin() + idp);
  1150. point_distance.erase(point_distance.begin() + idp);
  1151. for(uint pp = 0; pp < id ; pp++)
  1152. {
  1153. save_point_distance.at(pp).erase(save_point_distance.at(pp).begin() + idp);
  1154. for(uint j = idp; j < save_point_distance.at(pp).size(); j++)
  1155. save_point_distance.at(pp).at(j).second -=1;
  1156. }
  1157. for(uint j = idp; j < point_distance.size(); j++)
  1158. point_distance.at(j).second -= 1;
  1159. }*/
  1160. break;
  1161. }
  1162. }
  1163. }
  1164. //std::cout << std::endl;
  1165. }else if(deleted.size() == 1)
  1166. {
  1167. //std::cout<<"Deleted 2"<<std::endl;
  1168. //std::cout << deleted.at(0) << " ";
  1169. for(uint idp = 0; idp < point_distance.size(); idp++)
  1170. {
  1171. if(point_distance.at(idp).second == deleted.at(0))
  1172. {
  1173. /*if(name != "multi")
  1174. {*/
  1175. //std::cout << idp + id + 1 << std::endl;
  1176. point.erase(point.begin() + idp + id + 1);
  1177. point_distance.erase(point_distance.begin() + idp);
  1178. for(uint pp = 0; pp < id ; pp++)
  1179. {
  1180. save_point_distance.at(pp).erase(save_point_distance.at(pp).begin() + idp);
  1181. for(uint j = idp; j < save_point_distance.at(pp).size(); j++)
  1182. save_point_distance.at(pp).at(j).second -=1;
  1183. }
  1184. for(uint j = idp; j < point_distance.size(); j++)
  1185. point_distance.at(j).second -= 1;
  1186. //std::cout << " toto " << std::endl;
  1187. /*}else{
  1188. point.erase(point.begin() + idp);
  1189. point_distance.erase(point_distance.begin() + idp);
  1190. for(uint pp = 0; pp < id ; pp++)
  1191. {
  1192. save_point_distance.at(pp).erase(save_point_distance.at(pp).begin() + idp);
  1193. for(uint j = idp; j < save_point_distance.at(pp).size(); j++)
  1194. save_point_distance.at(pp).at(j).second -=1;
  1195. }
  1196. for(uint j = idp; j < point_distance.size(); j++)
  1197. point_distance.at(j).second -= 1;
  1198. }*/
  1199. break;
  1200. }
  1201. }
  1202. //std::cout << std::endl;
  1203. }
  1204. /*std::cout << " B : " << std::endl;
  1205. for(uint pp = 0; pp < point_distance.size(); pp++)
  1206. std::cout << point_distance.at(pp).second << " ";
  1207. std::cout << std::endl << std::endl;*/
  1208. //sort(point_distance.begin(), point_distance.end());
  1209. save_point_distance.push_back(point_distance);
  1210. //std::cout << std::endl;
  1211. }
  1212. // std::cout << "nombre de sommet" << point.size() << std::endl;
  1213. for(uint xt = 0; xt < save_point_distance.size(); xt++){
  1214. //std::cout << "** " << xt << " ** : ";
  1215. sort(save_point_distance.at(xt).begin(), save_point_distance.at(xt).end());
  1216. /*for(uint yt = 0; yt < save_point_distance.at(xt).size(); yt++){
  1217. std::cout << save_point_distance.at(xt).at(yt).first << " ";
  1218. }
  1219. std::cout << std::endl;*/
  1220. }
  1221. std::vector<vertex_to> Vertexs;
  1222. for(int i = 0; i < point.size(); i++){
  1223. vertex_to vo = boost::add_vertex(*go);
  1224. Vertexs.push_back(vo);
  1225. }
  1226. //std::cout << point.size() << std::endl;
  1227. for(int i = 0; i < point.size() -1; i++){
  1228. //std::cout << i << std::endl;
  1229. double dist = 0.;
  1230. uint xi;
  1231. //if(name != "multi")
  1232. xi = 0;
  1233. /*else
  1234. xi = 1;*/
  1235. while(dist < max_distance & xi < save_point_distance.at(i).size())
  1236. {
  1237. dist = save_point_distance.at(i).at(xi).first;
  1238. if(name != "multi")
  1239. add_edge(Vertexs.at(i), Vertexs.at(save_point_distance.at(i).at(xi).second), EdgeProperties(1.), *go);
  1240. else{
  1241. add_edge(Vertexs.at(i), Vertexs.at(save_point_distance.at(i).at(xi).second), EdgeProperties(1.), *go);
  1242. add_edge(Vertexs.at(save_point_distance.at(i).at(xi).second),Vertexs.at(i), EdgeProperties(1.), *go);
  1243. }
  1244. xi++;
  1245. }
  1246. (*go)[Vertexs.at(i)] = VertexProperties(i, 1., NORMAL_PIXEL);
  1247. }
  1248. (*go)[Vertexs.at(point.size()-1)] = VertexProperties(point.size()-1, 1., NORMAL_PIXEL);
  1249. /*std::cout << "ok"<< point.size() << std::endl;
  1250. for(int i = 0; i < (point.size() - arcs_max); i++)
  1251. {
  1252. std::cout << "ok"<< i << " "<< point.size() <<std::endl;
  1253. Entiers tmp_vector = Random_Sort_Vector2(i+1, point.size());
  1254. int ac = rand_fini(arcs_min, arcs_max);
  1255. std::cout << "! " << ac <<std::endl;
  1256. Entiers arcs;
  1257. for(uint p = 0; p < ac; p++)
  1258. arcs.push_back(tmp_vector.at(p));
  1259. //sort(arcs.begin(),arcs.end());
  1260. for(uint j = 0; j < arcs.size(); j++)
  1261. add_edge(Vertexs.at(i), Vertexs.at(arcs.at(j)), EdgeProperties(1.), *go);
  1262. (*go)[Vertexs.at(i)] = VertexProperties(i, 1., NORMAL_PIXEL);
  1263. }
  1264. std::cout << "ok1"<<std::endl;
  1265. for(int i = point.size() - arcs_max; i < point.size() - 2; i++)
  1266. {
  1267. Entiers tmp_vector = Random_Sort_Vector2(i+1,point.size());
  1268. int ac = rand_fini(1, 2);
  1269. Entiers arcs;
  1270. for(uint p = 0; p < ac; p++)
  1271. arcs.push_back(tmp_vector.at(p));
  1272. sort(arcs.begin(),arcs.end());
  1273. for(uint j = 0; j < arcs.size(); j++)
  1274. add_edge(Vertexs.at(i), Vertexs.at(arcs.at(j)), EdgeProperties(1.), *go);
  1275. (*go)[Vertexs.at(i)] = VertexProperties(i, 1., NORMAL_PIXEL);
  1276. }
  1277. std::cout << "ok2"<<std::endl;
  1278. add_edge(Vertexs.at(point.size()-2), Vertexs.at(point.size()-1), EdgeProperties(1.), *go);
  1279. (*go)[Vertexs.at(point.size()-2)] = VertexProperties(point.size()-2, 1., NORMAL_PIXEL);
  1280. (*go)[Vertexs.at(point.size()-1)] = VertexProperties(point.size()-1, 1., NORMAL_PIXEL);*/
  1281. for(uint i = 0; i< point.size(); i++){
  1282. bool indic = false;
  1283. for(boost::tie(ei,edge_end) = in_edges(i,*go); ei != edge_end; ++ei){
  1284. indic = true;
  1285. break;
  1286. }
  1287. if(indic == false){
  1288. (*go)[i] = VertexProperties(i, 1, TOP_PIXEL);
  1289. }else{
  1290. (*go)[i] = VertexProperties(i, 1, NORMAL_PIXEL);
  1291. }
  1292. //std::cout<<(*go)[i]._index<<" "<<indic<<" -> "<<(*go)[i]._type<<std::endl;
  1293. }
  1294. }
  1295. /*void build_graph_grid_center(OrientedGraph *go, int side, const std::vector<std::pair<int,int>> &vertex_selection, const Entiers &weight_vertex,const char *edge_weight, bool rec){
  1296. int nbr_vertex = side*side;
  1297. std::vector<vertex_to> Vertexs;
  1298. for(int i =0; i<nbr_vertex; i++){
  1299. vertex_to vo = boost::add_vertex(*go);
  1300. Vertexs.push_back(vo);
  1301. }
  1302. // Ité 0
  1303. for(uint i = 0; i < 4; i++){
  1304. boost::add_edge(0, 2 + 2*i ,EdgeProperties(1) , *go);
  1305. }
  1306. // Ité 1
  1307. for(uint i = 1; i < 9; i++){
  1308. }
  1309. }*/
  1310. /*Vérification de la pondération + vérification des poids de la contraction + vérification de la structure de contraction*/
  1311. //void build_corsen_graph(OrientedGraph& graph);
  1312. } } } // namespace paradevs tests boost_graph;
  1313. #endif