Hello everybody,
I use the boost graph library to find the linear min-cut of a directed
graph with exactly one source and one sink node (s-t min-cut). For
this, I setup a linear max-flow problem and solve it using
kolmogorov_max_flow. The color_map property is supposed to be usable
to recover the edge cut set from the max-flow solution, see the
description on http://www.boost.org/doc/libs/1_38_0/libs/graph/doc/kolmogorov_max_flow.html
However, as long as there are no vertices colored "gray" I can simply
tell which side of the cut a node belongs to by doing something like:
std::vector<default_color_type> color(num_vertices(g_ab));
double flow = kolmogorov_max_flow(g_ab, alpha_vertex, beta_vertex,
color_map(&color[0]));
bool is_left = (color[node_desc] == tc_color_traits::white());
bool is_right = (color[node_desc] == tc_color_traits::black());
And this works just fine. For some problems I am solving there are
gray nodes, and I do not know how to determine their position relative
to the edge cut set. Is there a code example available in the boost
repository or has anyone had this problem?
It seems surprising to me that obtaining the edge cut set of a linear
min-cut problem seems to be non-trivial using the boost graph library.
I must be doing something wrong.
Thanks,
Sebastian
I am writing a class that implements a simple parser.
In the costructor I created the rule and the parser...and I recall the
functions for the semantic actions.
I have implemented this function as member funcions and, for recalled it, I
use a pointer to my member function in this manner:
#include <boost/spirit.hpp>
using namespace boost::spirit;
class MYParser
{
private:
//main rules
rule<const char*> rLine, rComment;
//This are the “semantic action”
void AnnounceComment(char const*, char const*);
// ...and this is the pointer to my “semantic action”
void (SQLParser::*ptrAnnounceComment)(char const*, char const*);
public:
MYParser(void);
//distuttore
͠ MYParser();
};
MYParser::MYParser()
{
//(SQLParser::*ptrAnnounceComment)();// = &SQLParser::AnnounceComment;
//AnnounceComment is my Member functions
ptrAnnounceComment=&SQLParser::AnnounceComment;
//make the parser
rLine = rComment;
rSpazi = *space_p;
rTerminal = !ch_p(';');
//commento SQL fino a fine riga
rComment = str_p("#") >> (*anychar_p)[ this->*ptrAnnounceComment ];
//...
}
I obtain an error:
“no match for ‘operator[]’ in ‘boost::spirit::operator* [with S =
boost::spirit::anychar_parser](((const
boost::spirit::parser<boost::spirit::anychar_parser>&)((const
boost::spirit::parser<boost::spirit::anychar_parser>*)(&
boost::spirit::anychar_p))))[((SQLParser*)this)->*((SQLParser*)this)->SQLParser::ptrAnnounceComment]’”
on the line:
rComment = str_p("#") >> (*anychar_p)[ this->*ptrAnnounceComment ];
But..why?
I have only a little experience with C++ and spirit :-(
Ciao
Claudio
--
View this message in context: http://www.nabble.com/Spirit%2C-semantic-actions-and-C%2B%2B-classes-tp2226…
Sent from the Boost - Dev mailing list archive at Nabble.com.