[BGL] there is no in_edges() function for adjacency_matrix<>

Hi,
A huge disappointment again came to me today. I used
boost::adjacencyboost::directedS class for representation of simple
Petri net. I was trying to define the following function
//////////////////////////////////////////
bool if_enabled(transition_descriptor_t tr, graph_t net) {
assert((net[tr].m_node_type == TRANSITION) &&
"if_enabled called with non transition node");
BGL_FORALL_INEDGES_T(tr, ed, net, graph_t)
{
if (net[boost::source(ed, net)].m_tokens_number <
net[ed].m_weight) return false;
}
return true;
}
//////////////////////////////////////////////////////////
But I failed because of lack of boost::in_edges() function
specialization for type that I've chosen.
Am I doing something wrong?
Any ideas how to implement my function in resonable way would be greatly
appreciated.
Note: all works fine with "adjacency_list

Dmitry Bufistov
Hi, A huge disappointment again came to me today. I used boost::adjacencyboost::directedS class for representation of simple Petri net. I was trying to define the following function ////////////////////////////////////////// bool if_enabled(transition_descriptor_t tr, graph_t net) { assert((net[tr].m_node_type == TRANSITION) && "if_enabled called with non transition node");
BGL_FORALL_INEDGES_T(tr, ed, net, graph_t) { if (net[boost::source(ed, net)].m_tokens_number < net[ed].m_weight) return false; } return true; }
////////////////////////////////////////////////////////// But I failed because of lack of boost::in_edges() function specialization for type that I've chosen. Am I doing something wrong? Any ideas how to implement my function in resonable way would be greatly appreciated. Note: all works fine with "adjacency_list
"
By /definition/, BidirectionalGraph is a graph where you can enumerate the incoming edges for any node. Unless you specify bidirectionalS, an adjacency list won't be a BidirectionalGraph, and you can't use in_edges. So everything is working just as I would expect it to. -- Dave Abrahams Boost Consulting www.boost-consulting.com

On Feb 6, 2006, at 8:04 AM, Dmitry Bufistov wrote:
Hi, A huge disappointment again came to me today. I used boost::adjacencyboost::directedS class for representation of simple Petri net. I was trying to define the following function ////////////////////////////////////////// bool if_enabled(transition_descriptor_t tr, graph_t net) { assert((net[tr].m_node_type == TRANSITION) && "if_enabled called with non transition node");
BGL_FORALL_INEDGES_T(tr, ed, net, graph_t) { if (net[boost::source(ed, net)].m_tokens_number < net[ed].m_weight) return false; } return true; }
////////////////////////////////////////////////////////// But I failed because of lack of boost::in_edges() function specialization for type that I've chosen. Am I doing something wrong?
No, you aren't doing anything wrong. The in_edges function was accidentally left out of the adjacency_matrix class template. Nobody has gotten around to implementing it yet.
Any ideas how to implement my function in resonable way would be greatly appreciated. Note: all works fine with "adjacency_list
"
Right. adjacency_list gets a lot more use/attention than adjacency_matrix, so it has a more complete feature set. I usually try not to promise anything, but perhaps we can get in_edges() implemented relatively quickly. Doug
participants (3)
-
David Abrahams
-
Dmitry Bufistov
-
Doug Gregor