annotate DEPENDENCIES/generic/include/boost/graph/boyer_myrvold_planar_test.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 //=======================================================================
Chris@16 2 // Copyright 2007 Aaron Windsor
Chris@16 3 //
Chris@16 4 // Distributed under the Boost Software License, Version 1.0. (See
Chris@16 5 // accompanying file LICENSE_1_0.txt or copy at
Chris@16 6 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 7 //=======================================================================
Chris@16 8
Chris@16 9 #ifndef __BOYER_MYRVOLD_PLANAR_TEST_HPP__
Chris@16 10 #define __BOYER_MYRVOLD_PLANAR_TEST_HPP__
Chris@16 11
Chris@16 12 #include <boost/graph/planar_detail/boyer_myrvold_impl.hpp>
Chris@16 13 #include <boost/parameter.hpp>
Chris@16 14 #include <boost/type_traits.hpp>
Chris@16 15 #include <boost/mpl/bool.hpp>
Chris@16 16
Chris@16 17
Chris@16 18 namespace boost
Chris@16 19 {
Chris@16 20
Chris@16 21 struct no_kuratowski_subgraph_isolation {};
Chris@16 22 struct no_planar_embedding {};
Chris@16 23
Chris@16 24 namespace boyer_myrvold_params
Chris@16 25 {
Chris@16 26
Chris@16 27 BOOST_PARAMETER_KEYWORD(tag, graph)
Chris@16 28 BOOST_PARAMETER_KEYWORD(tag, embedding)
Chris@16 29 BOOST_PARAMETER_KEYWORD(tag, kuratowski_subgraph)
Chris@16 30 BOOST_PARAMETER_KEYWORD(tag, vertex_index_map)
Chris@16 31 BOOST_PARAMETER_KEYWORD(tag, edge_index_map)
Chris@16 32
Chris@16 33 typedef parameter::parameters< parameter::required<tag::graph>,
Chris@16 34 tag::embedding,
Chris@16 35 tag::kuratowski_subgraph,
Chris@16 36 tag::vertex_index_map,
Chris@16 37 tag::edge_index_map
Chris@16 38 > boyer_myrvold_params_t;
Chris@16 39
Chris@16 40 namespace core
Chris@16 41 {
Chris@16 42
Chris@16 43 template <typename ArgumentPack>
Chris@16 44 bool dispatched_boyer_myrvold(ArgumentPack const& args,
Chris@16 45 mpl::true_,
Chris@16 46 mpl::true_
Chris@16 47 )
Chris@16 48 {
Chris@16 49 //Dispatch for no planar embedding, no kuratowski subgraph isolation
Chris@16 50
Chris@16 51 typedef typename remove_const
Chris@16 52 <
Chris@16 53 typename remove_reference
Chris@16 54 < typename parameter::binding
Chris@16 55 < ArgumentPack, tag::graph>::type
Chris@16 56 >::type
Chris@16 57 >::type graph_t;
Chris@16 58
Chris@16 59 typedef typename parameter::binding
Chris@16 60 < ArgumentPack,
Chris@16 61 tag::vertex_index_map,
Chris@16 62 typename property_map
Chris@16 63 < typename remove_reference<graph_t>::type,
Chris@16 64 vertex_index_t>::const_type
Chris@16 65 >::type vertex_index_map_t;
Chris@16 66
Chris@16 67 boyer_myrvold_impl
Chris@16 68 <graph_t,
Chris@16 69 vertex_index_map_t,
Chris@16 70 graph::detail::no_old_handles,
Chris@16 71 graph::detail::no_embedding
Chris@16 72 >
Chris@16 73 planarity_tester(args[graph],
Chris@16 74 args[vertex_index_map |
Chris@16 75 get(vertex_index, args[graph])
Chris@16 76 ]
Chris@16 77 );
Chris@16 78
Chris@16 79 return planarity_tester.is_planar() ? true : false;
Chris@16 80 }
Chris@16 81
Chris@16 82
Chris@16 83
Chris@16 84 template <typename ArgumentPack>
Chris@16 85 bool dispatched_boyer_myrvold(ArgumentPack const& args,
Chris@16 86 mpl::true_,
Chris@16 87 mpl::false_
Chris@16 88 )
Chris@16 89 {
Chris@16 90 //Dispatch for no planar embedding, kuratowski subgraph isolation
Chris@16 91 typedef typename remove_const
Chris@16 92 <
Chris@16 93 typename remove_reference
Chris@16 94 < typename parameter::binding
Chris@16 95 < ArgumentPack, tag::graph>::type
Chris@16 96 >::type
Chris@16 97 >::type graph_t;
Chris@16 98
Chris@16 99 typedef typename parameter::binding
Chris@16 100 < ArgumentPack,
Chris@16 101 tag::vertex_index_map,
Chris@16 102 typename property_map<graph_t, vertex_index_t>::type
Chris@16 103 >::type vertex_index_map_t;
Chris@16 104
Chris@16 105 boyer_myrvold_impl
Chris@16 106 <graph_t,
Chris@16 107 vertex_index_map_t,
Chris@16 108 graph::detail::store_old_handles,
Chris@16 109 graph::detail::no_embedding
Chris@16 110 >
Chris@16 111 planarity_tester(args[graph],
Chris@16 112 args[vertex_index_map |
Chris@16 113 get(vertex_index, args[graph])
Chris@16 114 ]
Chris@16 115 );
Chris@16 116
Chris@16 117 if (planarity_tester.is_planar())
Chris@16 118 return true;
Chris@16 119 else
Chris@16 120 {
Chris@16 121 planarity_tester.extract_kuratowski_subgraph
Chris@16 122 (args[kuratowski_subgraph],
Chris@16 123 args[edge_index_map|get(edge_index, args[graph])]
Chris@16 124 );
Chris@16 125 return false;
Chris@16 126 }
Chris@16 127 }
Chris@16 128
Chris@16 129
Chris@16 130
Chris@16 131
Chris@16 132 template <typename ArgumentPack>
Chris@16 133 bool dispatched_boyer_myrvold(ArgumentPack const& args,
Chris@16 134 mpl::false_,
Chris@16 135 mpl::true_
Chris@16 136 )
Chris@16 137 {
Chris@16 138 //Dispatch for planar embedding, no kuratowski subgraph isolation
Chris@16 139 typedef typename remove_const
Chris@16 140 <
Chris@16 141 typename remove_reference
Chris@16 142 < typename parameter::binding
Chris@16 143 < ArgumentPack, tag::graph>::type
Chris@16 144 >::type
Chris@16 145 >::type graph_t;
Chris@16 146
Chris@16 147 typedef typename parameter::binding
Chris@16 148 < ArgumentPack,
Chris@16 149 tag::vertex_index_map,
Chris@16 150 typename property_map<graph_t, vertex_index_t>::type
Chris@16 151 >::type vertex_index_map_t;
Chris@16 152
Chris@16 153 boyer_myrvold_impl
Chris@16 154 <graph_t,
Chris@16 155 vertex_index_map_t,
Chris@16 156 graph::detail::no_old_handles,
Chris@16 157 #ifdef BOOST_GRAPH_PREFER_STD_LIB
Chris@16 158 graph::detail::std_list
Chris@16 159 #else
Chris@16 160 graph::detail::recursive_lazy_list
Chris@16 161 #endif
Chris@16 162 >
Chris@16 163 planarity_tester(args[graph],
Chris@16 164 args[vertex_index_map |
Chris@16 165 get(vertex_index, args[graph])
Chris@16 166 ]
Chris@16 167 );
Chris@16 168
Chris@16 169 if (planarity_tester.is_planar())
Chris@16 170 {
Chris@16 171 planarity_tester.make_edge_permutation(args[embedding]);
Chris@16 172 return true;
Chris@16 173 }
Chris@16 174 else
Chris@16 175 return false;
Chris@16 176 }
Chris@16 177
Chris@16 178
Chris@16 179
Chris@16 180 template <typename ArgumentPack>
Chris@16 181 bool dispatched_boyer_myrvold(ArgumentPack const& args,
Chris@16 182 mpl::false_,
Chris@16 183 mpl::false_
Chris@16 184 )
Chris@16 185 {
Chris@16 186 //Dispatch for planar embedding, kuratowski subgraph isolation
Chris@16 187 typedef typename remove_const
Chris@16 188 <
Chris@16 189 typename remove_reference
Chris@16 190 < typename parameter::binding
Chris@16 191 < ArgumentPack, tag::graph>::type
Chris@16 192 >::type
Chris@16 193 >::type graph_t;
Chris@16 194
Chris@16 195 typedef typename parameter::binding
Chris@16 196 < ArgumentPack,
Chris@16 197 tag::vertex_index_map,
Chris@16 198 typename property_map<graph_t, vertex_index_t>::type
Chris@16 199 >::type vertex_index_map_t;
Chris@16 200
Chris@16 201 boyer_myrvold_impl
Chris@16 202 <graph_t,
Chris@16 203 vertex_index_map_t,
Chris@16 204 graph::detail::store_old_handles,
Chris@16 205 #ifdef BOOST_BGL_PREFER_STD_LIB
Chris@16 206 graph::detail::std_list
Chris@16 207 #else
Chris@16 208 graph::detail::recursive_lazy_list
Chris@16 209 #endif
Chris@16 210 >
Chris@16 211 planarity_tester(args[graph],
Chris@16 212 args[vertex_index_map |
Chris@16 213 get(vertex_index, args[graph])
Chris@16 214 ]
Chris@16 215 );
Chris@16 216
Chris@16 217 if (planarity_tester.is_planar())
Chris@16 218 {
Chris@16 219 planarity_tester.make_edge_permutation(args[embedding]);
Chris@16 220 return true;
Chris@16 221 }
Chris@16 222 else
Chris@16 223 {
Chris@16 224 planarity_tester.extract_kuratowski_subgraph
Chris@16 225 (args[kuratowski_subgraph],
Chris@16 226 args[edge_index_map | get(edge_index, args[graph])]
Chris@16 227 );
Chris@16 228 return false;
Chris@16 229 }
Chris@16 230 }
Chris@16 231
Chris@16 232
Chris@16 233
Chris@16 234
Chris@16 235 template <typename ArgumentPack>
Chris@16 236 bool boyer_myrvold_planarity_test(ArgumentPack const& args)
Chris@16 237 {
Chris@16 238
Chris@16 239 typedef typename parameter::binding
Chris@16 240 < ArgumentPack,
Chris@16 241 tag::kuratowski_subgraph,
Chris@16 242 const no_kuratowski_subgraph_isolation&
Chris@16 243 >::type
Chris@16 244 kuratowski_arg_t;
Chris@16 245
Chris@16 246 typedef typename parameter::binding
Chris@16 247 < ArgumentPack,
Chris@16 248 tag::embedding,
Chris@16 249 const no_planar_embedding&
Chris@16 250 >::type
Chris@16 251 embedding_arg_t;
Chris@16 252
Chris@16 253 return dispatched_boyer_myrvold
Chris@16 254 (args,
Chris@16 255 boost::is_same
Chris@16 256 <embedding_arg_t, const no_planar_embedding&>(),
Chris@16 257 boost::is_same
Chris@16 258 <kuratowski_arg_t, const no_kuratowski_subgraph_isolation&>()
Chris@16 259 );
Chris@16 260 }
Chris@16 261
Chris@16 262
Chris@16 263
Chris@16 264 } //namespace core
Chris@16 265
Chris@16 266 } //namespace boyer_myrvold_params
Chris@16 267
Chris@16 268
Chris@16 269 template <typename A0>
Chris@16 270 bool boyer_myrvold_planarity_test(A0 const& arg0)
Chris@16 271 {
Chris@16 272 return boyer_myrvold_params::core::boyer_myrvold_planarity_test
Chris@16 273 (boyer_myrvold_params::boyer_myrvold_params_t()(arg0));
Chris@16 274 }
Chris@16 275
Chris@16 276 template <typename A0, typename A1>
Chris@16 277 // bool boyer_myrvold_planarity_test(A0 const& arg0, A1 const& arg1)
Chris@16 278 bool boyer_myrvold_planarity_test(A0 const& arg0, A1 const& arg1)
Chris@16 279 {
Chris@16 280 return boyer_myrvold_params::core::boyer_myrvold_planarity_test
Chris@16 281 (boyer_myrvold_params::boyer_myrvold_params_t()(arg0,arg1));
Chris@16 282 }
Chris@16 283
Chris@16 284 template <typename A0, typename A1, typename A2>
Chris@16 285 bool boyer_myrvold_planarity_test(A0 const& arg0,
Chris@16 286 A1 const& arg1,
Chris@16 287 A2 const& arg2
Chris@16 288 )
Chris@16 289 {
Chris@16 290 return boyer_myrvold_params::core::boyer_myrvold_planarity_test
Chris@16 291 (boyer_myrvold_params::boyer_myrvold_params_t()(arg0,arg1,arg2));
Chris@16 292 }
Chris@16 293
Chris@16 294 template <typename A0, typename A1, typename A2, typename A3>
Chris@16 295 bool boyer_myrvold_planarity_test(A0 const& arg0,
Chris@16 296 A1 const& arg1,
Chris@16 297 A2 const& arg2,
Chris@16 298 A3 const& arg3
Chris@16 299 )
Chris@16 300 {
Chris@16 301 return boyer_myrvold_params::core::boyer_myrvold_planarity_test
Chris@16 302 (boyer_myrvold_params::boyer_myrvold_params_t()(arg0,arg1,arg2,arg3));
Chris@16 303 }
Chris@16 304
Chris@16 305 template <typename A0, typename A1, typename A2, typename A3, typename A4>
Chris@16 306 bool boyer_myrvold_planarity_test(A0 const& arg0,
Chris@16 307 A1 const& arg1,
Chris@16 308 A2 const& arg2,
Chris@16 309 A3 const& arg3,
Chris@16 310 A4 const& arg4
Chris@16 311 )
Chris@16 312 {
Chris@16 313 return boyer_myrvold_params::core::boyer_myrvold_planarity_test
Chris@16 314 (boyer_myrvold_params::boyer_myrvold_params_t()
Chris@16 315 (arg0,arg1,arg2,arg3,arg4)
Chris@16 316 );
Chris@16 317 }
Chris@16 318
Chris@16 319
Chris@16 320 }
Chris@16 321
Chris@16 322 #endif //__BOYER_MYRVOLD_PLANAR_TEST_HPP__