1

My actual intention is to use mcgregor_common_subgraphs to find some induced partial subgraphs. But it takes too long to compare small graphs. So instead of comparing the entire graphs I want to filter out a subset of comparable vertices and edges. Then find subgraphs between them.

So I use filtered_graph with vertex and edge predicates for both of these graphs. And pass the filtered graph to mcgregor_common_subgraphs. But it complains

error: use of deleted function ‘boost::iterators::filter_iterator<bya::util::isomorphism::directed_graph::vertex_filter_predicate, boost::range_detail::integer_iterator<long unsigned int> >& boost::iterators::filter_iterator<bya::util::isomorphism::directed_graph::vertex_filter_predicate, boost::range_detail::integer_iterator<long unsigned int> >::operator=(const boost::iterators::filter_iterator<bya::util::isomorphism::directed_graph::vertex_filter_predicate, boost::range_detail::integer_iterator<long unsigned int> >&)’

So I planned to copy the filtered graph into a new graph with copy_graph. But it complains that there is no default constructor for the vertex predicate vertex_filter_predicate.

error: no matching function for call to ‘bya::util::isomorphism::directed_graph::vertex_filter_predicate::vertex_filter_predicate()’

However my vertex and edge predicate takes a const reference to the original graph. So I cannot add an empty default constructor. I have searched in boost documentation, but didn't find any example of copying a filtered_graph. What is the solution ? Also why would copy_graph require the predicates to copy ?

struct directed_graph{
    typedef boost::adjacency_list<boost::setS, boost::vecS, boost::bidirectionalS, vertex_data, edge_data> graph_type;
    graph_type _graph;
    // ...
};

I have a directed graph struct inside which I have the predicates and equivalance comparators. Both small and large are instances of directed_graph.

directed_graph::edge_filter_predicate   edge_filter_small  (small._graph, allowed_vertex_ids), edge_filter_large  (large._graph, allowed_vertex_ids);
directed_graph::vertex_filter_predicate vertex_filter_small(small._graph, allowed_vertex_ids), vertex_filter_large(large._graph, allowed_vertex_ids);

boost::filtered_graph<directed_graph::graph_type, directed_graph::edge_filter_predicate, directed_graph::vertex_filter_predicate> filtered_small_view(small._graph, edge_filter_small, vertex_filter_small);
boost::filtered_graph<directed_graph::graph_type, directed_graph::edge_filter_predicate, directed_graph::vertex_filter_predicate> filtered_large_view(large._graph, edge_filter_large, vertex_filter_large);

directed_graph::graph_type filtered_small;
boost::copy_graph(filtered_small_view, filtered_small);
Neel Basu
  • 12,638
  • 12
  • 82
  • 146
  • Where's your code? I have done this, but the fact that your error implies to copying the filter predicate suggests that the target type is also a filtered graph? That doesn't seem correct then. – sehe Apr 22 '19 at 21:43
  • An example where I used this before https://stackoverflow.com/questions/48011373/need-to-find-sub-graphs-from-one-big-graph-using-boostgraph/48016277#48016277 – sehe Apr 22 '19 at 21:46
  • I have added the related code fragments. – Neel Basu Apr 23 '19 at 20:49

0 Answers0