predicate for bundled properties in filtered graph

Hello All, I am getting little confused in defining the predicate for filtered graph since my properties are bundled. I need to compare two bundled property inside the predicate, I am not getting any idea of how to access this property there. Bundled property is declared as: struct Edgep { int edge_index; int edge_w; std::string edge_name; int capacity; int residual_capcity; int bandwidth_used; }; typedef subgraph< adjacency_list<vecS, vecS, undirectedS, Vertexp, property< edge_index_t, unsigned int, Edgep > > > Graph; I am creating the edge bundled property map as typedef bundle_property_map<Graph, Graph::edge_descriptor, Edgep, int> EM; I need to filter those edges whose bandwidth_used < residual_capacity. According to my understanding, I need to create a map to bandwidth_used and residual_capacity and pass this to predicate function. But can I define a predicate to take 2 different input maps or what is the better way to do this? I need some help at this part. Your suggestions would be of great help for me to proceed. -- Regards, Giridhar

On Thu, 17 Nov 2011, giridhar wrote:
Hello All,
I am getting little confused in defining the predicate for filtered graph since my properties are bundled. I need to compare two bundled property inside the predicate, I am not getting any idea of how to access this property there.
Bundled property is declared as:
struct Edgep { int edge_index; int edge_w; std::string edge_name; int capacity; int residual_capcity; int bandwidth_used; };
typedef subgraph< adjacency_list<vecS, vecS, undirectedS, Vertexp, property< edge_index_t, unsigned int, Edgep > > > Graph;
I am creating the edge bundled property map as typedef bundle_property_map<Graph, Graph::edge_descriptor, Edgep, int> EM;
I need to filter those edges whose bandwidth_used < residual_capacity.
According to my understanding, I need to create a map to bandwidth_used and residual_capacity and pass this to predicate function. But can I define a predicate to take 2 different input maps or what is the better way to do this? I need some help at this part.
Yes, or just take the graph itself: struct my_pred { const Graph& g; my_pred(const Graph& g): g(g) {} bool operator()(const Edgep& e) const { return g[e].bandwidth_used < g[e].residual_capacity; } }; -- Jeremiah Willcock
participants (2)
-
giridhar
-
Jeremiah Willcock