Opened 10 years ago

#7107 new Feature Requests

Support property bundles as default parameter in graph algorithms

Reported by: philipp.moeller@… Owned by: Jeremiah Willcock
Milestone: To Be Determined Component: graph
Version: Boost 1.51.0 Severity: Optimization
Keywords: property bundles Cc:

Description

Bundled properties don't support default parameters as internal properties do. Adding a possibility to tag members of a bundle would solve that issue.

#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/properties.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <string>

using namespace std;
using namespace boost;

struct City{};

struct Highway { double weight; };

typedef adjacency_list<
    listS, vecS, bidirectionalS,
    City, Highway>
Map;

typedef adjacency_list < 
  listS, vecS, directedS,
  no_property, property < edge_weight_t, int > > 
Map2;

int main()
{
  Map m;
  Map2 m2;
  vector<double> distances(num_vertices(m2));
  dijkstra_shortest_paths(
    m2, *vertices(m2).first,
    distance_map(make_iterator_property_map(distances.begin(),
                                                   get(vertex_index, m2))));
  // does not work
  // dijkstra_shortest_paths(
  //   m, *vertices(m).first,
  //   boost::distance_map(make_iterator_property_map(distances.begin(),
  //                                                  get(vertex_index, m))));

  return 0;
}

One solution could be to add an optional tags typedef that contains an mpl::map between member pointers and property enum types. Alternatively, a traits class could be specified to map to the right enum type. Maybe someone can also come up with a nice mechanism to transparently tag a member.

Change History (0)

Note: See TracTickets for help on using tickets.