From 7aae3c873a9e339b52a1b1ef220035d2445d9a88 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 2 Jan 2008 21:25:56 +0000 Subject: [PATCH] experiment with other scalings for shortest path --- bgl.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bgl.cpp b/bgl.cpp index 193a75a..5d1e0ad 100644 --- a/bgl.cpp +++ b/bgl.cpp @@ -200,21 +200,22 @@ double graph_layout_cost(const Vertices v, const double vertex_areas[N]) { edge_weights[f]= hypotD(v[v1], v[v2]); FOR_VERTEX(v1) { - double a1= vertex_areas[v1]; + //double a1= vertex_areas[v1]; single_source_shortest_paths(v1, edge_weights, vertex_distances); FOR_VERTEX(v2) { if (v1 == v2) continue; - double a2= vertex_areas[v2]; + //double a2= vertex_areas[v2]; double d2= hypotD2plus(v[v1],v[v2], d2_epsilon); double s= vertex_distances[v2]; double s2= s*s + d2_epsilon; double sd2= s2 / d2; - double cost_contrib= a1*a2 * (sd2 - 1) / (d2*d2); - if (cost_contrib < -1e-4) { - printf("layout %03x..%03x (a=%g,%g) s=%g s2=%g d2=%g sd2=%g" - " cost+=%g\n", v1,v2, a1,a2, s,s2,d2,sd2, cost_contrib); - abort(); - } + //double cost_contrib= a1*a2 * (sd2 - 1) / (d2*d2); + double cost_contrib= sd2; + //if (cost_contrib < -1e-4) { + // printf("layout %03x..%03x (a=%g,%g) s=%g s2=%g d2=%g sd2=%g" + // " cost+=%g\n", v1,v2, a1,a2, s,s2,d2,sd2, cost_contrib); + // abort(); + // } total_cost += cost_contrib; } } -- 2.30.2