Как использовать алгоритмы boost :: graph с listS, setS как контейнеры вершин / ребер?

В примерах Boost для использования библиотеки boost :: graph обычно используется граф

using namespace boost;
typedef adjacency_list
    < vecS, // edge container 
      vecS, // vertex container
      undirectedS,
      property<vertex_index_t, int>,
      property<edge_index_t, int>
    > graph;

и поэтому они работают очень хорошо. Но у меня есть график с

typedef adjacency_list
   < setS, // edge container 
     listS, // vertex container
     undirectedS,
     boost::no_property,  // vertex property
     boost::no_property // edge property
   > graph;

и алгоритмы не работают из коробки. В большинстве случаев должна быть предоставлена карта для поиска vertex_descriptor для определенного индекса вершины (целочисленное значение).

Я хочу проверить, является ли мой график плоским и вычислить его плоское вложение. Я предоставляю карту индекса вершины, и она работает таким образом, например, алгоритм connected_components, но, очевидно, не для boyer_myrvold_planarity_test:

using namespace boost;

typedef adjacency_list
<boost::setS, boost::listS, undirectedS,
     boost::no_property, boost::no_property> graph;

typedef  boost::graph_traits<graph>::edge_descriptor    EdgeDesc;
typedef boost::graph_traits<graph>::vertex_descriptor   VertexDesc;

typedef std::map<VertexDesc, size_t> VertexDescMap;
typedef std::map<EdgeDesc, size_t> EdgeDescMap;
typedef boost::graph_traits<graph>::vertex_iterator VertexIterator;


graph K_4;

std::vector<VertexDesc> vertex;
for(int i=0;i < 4; ++i){
    VertexDesc v = boost::add_vertex(K_4);
    vertex.push_back(v);
}


  add_edge(vertex[0], vertex[1], K_4);
  add_edge(vertex[0], vertex[2], K_4);
  add_edge(vertex[0], vertex[3], K_4);
  add_edge(vertex[1], vertex[2], K_4);
  add_edge(vertex[1], vertex[3], K_4);
  add_edge(vertex[2], vertex[3], K_4);



   VertexDescMap vidxMap;
   boost::associative_property_map<VertexDescMap> vindexMap(vidxMap);
   VertexIterator di, dj;
   boost::tie(di, dj) = boost::vertices(K_4);
   for(int i = 0; di != dj; ++di,++i){
      boost::put(vindexMap, (*di), i);
   }


   if (boyer_myrvold_planarity_test(
   boost::boyer_myrvold_params::graph = K_4, 
   boost::boyer_myrvold_params::vertex_index_map = vindexMap))
    std::cout << "K_4 is planar." << std::endl;
  else
    std::cout << "ERROR! K_4 should have been recognized as planar!" 
          << std::endl;

Это приводит к различным загадочным ошибкам шаблонов ...

> 1>main.cpp
> 1>C:\Libraries\PCL-1.5.1\3rdParty\Boost\include\boost/graph/boyer_myrvold_planar_test.hpp(167)
> : error C2664:
> 'boost::boyer_myrvold_impl<Graph,VertexIndexMap,StoreOldHandlesPolicy,StoreEmbeddingPolicy>::boyer_myrvold_impl(const
> Graph &,VertexIndexMap)': Konvertierung des Parameters 2 von 'const
> boost::adj_list_vertex_property_map<Graph,ValueType,Reference,Tag>' in
> 'vertex_index_map_t' nicht möglich 1>        with 1>        [ 1>      
> Graph=graph_t, 1>            VertexIndexMap=vertex_index_map_t, 1>    
> StoreOldHandlesPolicy=boost::graph::detail::no_old_handles, 1>        
> StoreEmbeddingPolicy=boost::graph::detail::recursive_lazy_list 1>     
> ] 1>        and 1>        [ 1>            Graph=graph_t, 1>           
> ValueType=boost::detail::error_property_not_found, 1>           
> Reference=const boost::detail::error_property_not_found &, 1>         
> Tag=boost::vertex_index_t 1>        ] 1>        Kein
> benutzerdefinierter Konvertierungsoperator verfügbar, der diese
> Konvertierung durchführen kann, oder der Operator kann nicht
> aufgerufen werden 1>       
> C:\Libraries\PCL-1.5.1\3rdParty\Boost\include\boost/graph/boyer_myrvold_planar_test.hpp(259):
> Siehe Verweis auf die Instanziierung der gerade kompilierten
> Funktions-template "bool
> boost::boyer_myrvold_params::core::dispatched_boyer_myrvold<ArgumentPack>(const
> ArgumentPack &,boost::mpl::false_,boost::mpl::true_)". 1>        with
> 1>        [ 1>           
> ArgumentPack=boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::boyer_myrvold_params::tag::embedding,const
> boost::bgl_named_params<boost::associative_property_map<VertexDescMap>,boost::vertex_index_t,boost::no_property>>,boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::boyer_myrvold_params::tag::graph,const
> boost::adjacency_list<boost::setS,boost::listS,boost::undirectedS,boost::no_property,boost::no_property>>,boost::parameter::aux::empty_arg_list>> 1>        ] 1>       
> C:\Libraries\PCL-1.5.1\3rdParty\Boost\include\boost/graph/boyer_myrvold_planar_test.hpp(281):
> Siehe Verweis auf die Instanziierung der gerade kompilierten
> Funktions-template "bool
> boost::boyer_myrvold_params::core::boyer_myrvold_planarity_test<boost::parameter::aux::arg_list<TaggedArg,Next>>(const ArgumentPack &)". 1>        with 1>        [ 1>           
> TaggedArg=boost::parameter::aux::tagged_argument<boost::boyer_myrvold_params::tag::embedding,const
> boost::bgl_named_params<boost::associative_property_map<VertexDescMap>,boost::vertex_index_t,boost::no_property>>,
> 1>           
> Next=boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::boyer_myrvold_params::tag::graph,const
> boost::adjacency_list<boost::setS,boost::listS,boost::undirectedS,boost::no_property,boost::no_property>>,boost::parameter::aux::empty_arg_list>, 1>           
> ArgumentPack=boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::boyer_myrvold_params::tag::embedding,const
> boost::bgl_named_params<boost::associative_property_map<VertexDescMap>,boost::vertex_index_t,boost::no_property>>,boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<boost::boyer_myrvold_params::tag::graph,const
> boost::adjacency_list<boost::setS,boost::listS,boost::undirectedS,boost::no_property,boost::no_property>>,boost::parameter::aux::empty_arg_list>> 1>        ] 1>        .\src\main.cpp(135): Siehe Verweis auf die
> Instanziierung der gerade kompilierten Funktions-template "bool
> boost::boyer_myrvold_planarity_test<graph,boost::bgl_named_params<T,Tag,Base>>(const
> A0 &,const A1 &)". 1>        with 1>        [ 1>           
> T=boost::associative_property_map<VertexDescMap>, 1>           
> Tag=boost::vertex_index_t, 1>            Base=boost::no_property, 1>  
> A0=graph, 1>           
> A1=boost::bgl_named_params<boost::associative_property_map<VertexDescMap>,boost::vertex_index_t,boost::no_property> 1>        ]

Короче говоря, он жалуется, что не может конвертировать / использовать его так, как мне бы хотелось.

Как я могу заставить это работать?

Что еще я должен дать функции?

К сожалению, вряд ли есть примеры для работы с setS или listS в качестве контейнеров. Кроме того, я не могу использовать теги свойств, потому что это является частью более широкой реализации, и мне нужно сохранять свойства внешними.

Я был бы очень рад, если у кого-то есть предложение.

Ответы на вопрос(1)

Ваш ответ на вопрос