hi,
i hava a problem using bundled properties with filtered graph. i've modified the example from the filtered-graph page (
http://www.boost.org/libs/graph/doc/filtered_graph.html
) to use edge properties and woul like to create a filter using these bundled properties, but am experiencing problems with the types of the property_map and/or filter. since i'm quite new to c++ and boost i would aprectiate any suggestin, thanks in advance
i'm using gcc-3.3.5 and boost-1.34
moritz
modified code:
struct myEdge {
int id;
int weight;
};
template <typename EdgeWeightMap>
struct positive_edge_weight {
positive_edge_weight() { }
positive_edge_weight(EdgeWeightMap weight) : m_weight(weight) { }
template <typename Edge>
bool operator()(const Edge& e) const {
return 0 < boost::get(m_weight, e);
}
EdgeWeightMap m_weight;
};
int main()
{
using namespace boost;
typedef adjacency_list<vecS, vecS, directedS,
//no_property, property<edge_weight_t, int> > Graph;
no_property, myEdge > Graph;
typedef property_map<Graph, int myEdge::*>::type EdgeWeightMap;
typedef graph_traits<Graph>::edge_iterator edge_iter_t;
typedef filtered_graph<Graph,positive_edge_weight<EdgeWeightMap> > f_graph_t;
typedef graph_traits<Graph>::edge_descriptor Edge;
enum { A, B, C, D, E, N };
const char* name = "ABCDE";
Graph g(N);
Edge e;
bool ins;
tie(e,ins)=add_edge(A, B, g);
/.../
positive_edge_weight<EdgeWeightMap> filter(get(&myEdge::weight, g));
f_graph_t fg(g, filter);
std::cout << "filtered edge set: ";
print_edges(fg, name);
std::cout << "filtered out-edges:" << std::endl;
print_graph(fg, name);
return 0;
}