Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6674899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:47:11+00:00 2026-05-26T03:47:11+00:00

I am newbie in boost library, I tried to apply force directed layout from

  • 0

I am newbie in boost library, I tried to apply force directed layout from the boost documentation website but I encountered the error like this when I try to compile my code:

error: no matching function for call to ‘random_graph_layout(MyGraph&, CoordSqMap&, double, double, double, double, boost::minstd_rand&)’

error: no matching function for call to ‘fruchterman_reingold_force_directed_layout(MyGraph&, CoordSqMap&, double&, double&, boost::bgl_named_params<progress_cooling, boost::cooling_t, boost::no_property>)’

I have attached my 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);
    return 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 with 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()) */  );

  return 0;
}

I tried all my best possible way to solve this still not able to do this. Do you have any suggestion for this. Do you have a workable sample code for Kamada kawai spring layout.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:47:11+00:00Added an answer on May 26, 2026 at 3:47 am

    If you are using a relatively new version but not the latest release, there was a bug in some versions where the interfaces to the functions had been updated but the documentation hadn’t been. The correct documentation is at http://www.boost.org/doc/libs/1_47_0/libs/graph/doc/fruchterman_reingold.html (and the other current BGL documentation pages).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a newbie in boost.python and i'm getting this error that I would like
I am a newbie in C++ Boost uBLAS library so I have a noob
I am a newbie to Boost C++ libraries. I was wondering if there are
newbie for clearcase. Since clearcase's config is rather different from other concept in git,
I'm a newbie about boost. I compiled boost libraries with success (under mac os
I am a newbie for Boost Asio libraries, my requirement is to build a
I am trying to use boost string algorithms for case insensitive search. total newbie
Newbie to C++ but I am a Java programmer. Trying to learn C++ now.
Newbie :( Tweaking my way through tutorials but 36 hours can't figure this one
I'm quite a newbie with Boost, and my only experience of surfing though a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.