Boost logo

Boost Users :

Subject: Re: [Boost-users] Trouble w/ fruchterman-reingold
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2012-10-05 11:29:23


On Fri, 5 Oct 2012, eric wrote:

> I changed it to:
>
> property_map<graph_traits&lt;Graph>::vertex_descriptor,
> Topology::point_type> positionMap;
> minstd_rand gen;
> Topology rect_top(gen, -25, -25, 25, 25);
> random_graph_layout(graph, positionMap, rect_top);
>
> so that it would conform w/ the description here
> <http://www.boost.org/doc/libs/1_51_0/libs/graph/doc/random_layout.html>
> that says:
>
> IN/OUT: PositionMap position
> The property map that stores the position of each vertex. The type
> PositionMap must be a model of Lvalue Property Map such that the vertex
> descriptor type of Graph is convertible to its key type. Its value type must
> be Topology::point_type, representing the coordinates of the vertex.
>
> Now I get the error message:
>
> 1>c:\program files (x86)\boost\boost_1_51\boost\graph\properties.hpp(222) :
> error C2039: 'type' : is not a member of 'boost::vertex_property_type<G>'
> 1> with
> 1> [
> 1> G=unsigned int
> 1> ]
> 1> c:\program files
> (x86)\boost\boost_1_51\boost\graph\properties.hpp(233) : see reference to
> class template instantiation
> 'boost::detail::vertex_property_map<Graph,PropertyTag>' being compiled
> 1> with
> 1> [
> 1> Graph=unsigned int,
> 1> PropertyTag=boost::rectangle_topology<>::point_type
> 1> ]
>
> I think what I really need is a comprehensible example. All that I've found
> in the way of an example is here
> <http://www.boost.org/doc/libs/1_42_0/libs/graph/test/layout_test.cpp> .
> But it contains so much Boost-specific jargony things that it's not really
> good for a beginner to look at and get the sense of how things work.
>
> Do you have any such examples up your sleeve?

Here are the two I see off-hand in the source tree:

- libs/graph/example/fr_layout.cpp

- The test_cube() function in libs/graph/test/layout_test.cpp, ignoring
everything in the function between the typedef for edge_iterator and the
line containing "minstd_rand gen;" (in the trunk version at
<URL:https://svn.boost.org/svn/boost/trunk/libs/graph/test/layout_test.cpp>,
look at lines 202-219 in particular). Just that section should be easier
to understand.

-- Jeremiah Willcock


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net