[Graph] kamada_kawai_spring_layout runs forever

hello,
i'm trying to use the boost graph libarary to layout a small (< 10
nodes), fully connected, undirected graph.
the problem is, that the kamada_kawai_spring_layout() function never
returns. when i comment out the code to set the weights for my graph
it works, but then it is of course not of much use for me.
below is the sourcecode i came up with. as i said, when i comment out
the line
put(weightMap, e, 1.0);
it works (i.e. the program finishes after a short time) and all nodes
are at the same location
i think the problem could be the way i connect the nodes, which is
quite clumsy here. maybe someone has a better idea how to accomplish
this.
regards and thanks in advance,
sebastian mecklenburg
#include "boost/graph/adjacency_list.hpp"
#include "boost/graph/graph_traits.hpp"
#include "boost/graph/kamada_kawai_spring_layout.hpp"
#include <iostream>
using namespace boost;
enum vertex_position_t { vertex_position };
namespace boost { BOOST_INSTALL_PROPERTY(vertex, position); }
struct pos
{
double x;
double y;
};
typedef adjacency_list

Hi Sebi, I think your problem is that all your verticies are at the same location.
From the documentation:
" Prior to invoking this algorithm, it is recommended that the vertices be
placed along the vertices of a regular n-sided polygon via
circle_layouthttp://www.boost.org/libs/graph/doc/circle_layout.html.
"
-Chris
On 8/16/06, Sebi
participants (2)
-
Mortoc
-
Sebi