【问题标题】:Boost C++ - generating a layoutBoost C++ - 生成布局
【发布时间】:2018-01-08 09:21:22
【问题描述】:

我最近一直在用 C++ 处理图形绘制。我的问题是,我该如何解决最后的错误:

 required from here
/usr/include/boost/graph/random_layout.hpp:30:8: error: ‘const class boost::random::linear_congruential_engine<unsigned int, 48271u, 0u, 2147483647u>’ has no member named ‘random_point’
     put(position_map, v, topology.random_point());
        ^

对于这个小代码sn-p:

  boost::minstd_rand gen;
  PositionVec position_vec(num_vertices(component));
  PositionMap position(position_vec.begin(), get(vertex_index, component));
  topology_type topo(gen, -width/2, -height/2, width/2, height/2);
  boost::random_graph_layout(component, position, gen);

我在这里做错了什么?

非常感谢。

【问题讨论】:

    标签: c++ boost graph boost-graph


    【解决方案1】:

    根据参考

    template<typename Graph, typename PositionMap, typename Topology>
    void
    random_graph_layout(const Graph& g, PositionMap position_map,
                    const Topology& space);  // <---
    

    你应该作为random_graph_layout拓扑对象的第三个参数而不是生成器。

    所以叫

    boost::random_graph_layout(component, position, topo);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-23
      • 1970-01-01
      • 1970-01-01
      • 2010-12-10
      相关资源
      最近更新 更多