c++ - Boost force directed layout problem -
c++ - Boost force directed layout problem -
i newbie in boost library, tried apply forcefulness directed layout boost documentation website encountered error when seek compile code:
error: no matching function phone call ‘random_graph_layout(mygraph&, coordsqmap&, double, double, double, double, boost::minstd_rand&)’
error: no matching function phone call ‘fruchterman_reingold_force_directed_layout(mygraph&, coordsqmap&, double&, double&, boost::bgl_named_params<progress_cooling, boost::cooling_t, boost::no_property>)’
i have attached code.
#include <boost/graph/fruchterman_reingold.hpp> #include <boost/graph/random_layout.hpp> #include <boost/graph/adjacency_list.hpp> #include <boost/graph/simple_point.hpp> #include <boost/lexical_cast.hpp> #include <string> #include <iostream> #include <map> #include <vector> #include <boost/random/linear_congruential.hpp> #include <boost/progress.hpp> #include <boost/shared_ptr.hpp> #include <boost/graph/small_world_generator.hpp> #include <boost/random/linear_congruential.hpp> using namespace boost; struct decomposition_index_t{ typedef vertex_property_tag kind; }; struct coordinates_sq_t{ typedef vertex_property_tag kind; }; struct coordinates_circle_t{ typedef vertex_property_tag kind; }; template<typename t> struct polar { t rad; t angle; }; struct vparams { int a; double b; long c; // std::complex<double> d; }; typedef adjacency_list<vecs, vecs, undirecteds, property<vertex_name_t, std::string, property<decomposition_index_t, int, property<coordinates_sq_t, simple_point<double>, property<coordinates_circle_t, polar<double>, vparams > > > > > mygraph; typedef property_map<mygraph,coordinates_sq_t>::type coordsqmap; typedef property_map<mygraph,coordinates_circle_t>::type coordcmap; typedef graph_traits<mygraph>::vertex_descriptor vertex; class progress_cooling : public linear_cooling<double> { typedef linear_cooling<double> inherited; public: explicit progress_cooling(std::size_t iterations) : inherited(iterations) { display.reset(new progress_display(iterations + 1, std::cerr)); } double operator()() { ++(*display); homecoming inherited::operator()(); } private: shared_ptr<boost::progress_display> display; }; typedef boost::small_world_iterator<boost::minstd_rand, mygraph> swgen; int main() { boost::minstd_rand gen; // create graph 10000 nodes int nodecount = 90000; mygraph g(swgen(gen, nodecount, 6, 0.03), swgen(), nodecount); double width = 2; double height = 2; coordsqmap position = get(coordinates_sq_t(), g); random_graph_layout(g, position, -width/2, width/2, -height/2, height/2, gen); int iterations = 20; fruchterman_reingold_force_directed_layout (g, position, width, height, cooling(progress_cooling(iterations)) /* .force_pairs(all_force_pairs()) */ ); homecoming 0; }
i tried best possible way solve still not able this. have suggestion this. have workable sample code kamada kawai spring layout.
if using relatively new version not latest release, there bug in versions interfaces functions had been updated documentation hadn't been. right documentation @ http://www.boost.org/doc/libs/1_47_0/libs/graph/doc/fruchterman_reingold.html (and other current bgl documentation pages).
c++ boost boost-graph
Comments
Post a Comment