I'm seeing a weird problem in fruchterman_reingold.hpp that after the
displacements are calculated for every vertex, it gets down to the loop
where it updates the positions (starting on line 327), and all the
displacements are (0,0) by that point (they had been sensible values up in
the calculation loop). Any idea what I could be doing to cause that? Here
is my code:
struct spring_attractive_force {
template
T
operator()(typename graph_traits<Graph>::edge_descriptor,
T k,
T d,
const Graph&) const
{
return d;
}
};
struct magnetic_repulsive_force {
template
T
operator()(typename graph_traits<Graph>::vertex_descriptor,
typename graph_traits<Graph>::vertex_descriptor,
T k,
T d,
const Graph&) const
{
return 1 / (d * d);
}
};
typedef adjacency_list >,
// Edge properties
property > Graph;
enum {A, B, C, D, E, F, G, H};
simple_edge triangular_edges[14] = {
{A, B}, {B, C}, {C, A},
{D, E}, {E, F}, {F, G}, {G, H}, {H, D},
{D, F}, {F, H}, {H, E}, {E, G}, {G, D}
};
Graph g(&triangular_edges[0], &triangular_edges[13], 8);
// Generate (x,y) coordinates for every node
// - Randomly layout vertices of graph
minstd_rand gen;
rectangle_topology<> rect_top(gen, -25, -25, 25, 25);
random_graph_layout(g, get(vertex_position, g), rect_top);
// - Run Fruchterman Reingold algorithm on them
typedef square_topology<> Topology;
Topology topology(gen, 50.0);
fruchterman_reingold_force_directed_layout(g, get(vertex_position, g),
topology,
attractive_force(spring_attractive_force()).
repulsive_force(magnetic_repulsive_force()).
force_pairs(all_force_pairs()).
cooling(linear_cooling<double>(100)));
--
View this message in context: http://boost.2283326.n4.nabble.com/Trouble-w-fruchterman-reingold-tp4636494....
Sent from the Boost - Users mailing list archive at Nabble.com.