Subject: | Graph::Layouter::Spring ignores weight? |
Consider what you should get, given the following...
my $g = Graph::Undirected->new();
# evenly weighted triangle 1->2->3->1
$g->add_weighted_edge(1 , 10 , 2);
$g->add_weighted_edge(2 , 10 , 3);
$g->add_weighted_edge(3 , 10 , 1);
# put 4 in the middle, heavily drawn to 1
$g->add_weighted_edge(1 , 200, 4);
$g->add_weighted_edge(2 , 20 , 4);
$g->add_weighted_edge(3 , 20 , 4);
my $img = Imager->new(xsize => 800, ysize => 600, channels => 4);
$img->box(color => Imager::Color->new(0xff, 0xff, 0xff),
xmin => 0, ymin => 0, xmax => 800, ymax => 600, filled => 1);
Graph::Renderer::Imager::render($g, $img);
..that should (in theory) create something similar to an equalateral triangle of points 1, 2 & 3; with point #4 in the middle, closer to 1 then 2 and 3.
In practice, it seems like mater what weights are specified for each edge, it always produces something similar to a square, with an X through the middle. It doesn't seem to ever put items with (relatively) higher weights closer together.