chiark / gitweb /
minor improvements
[moebius2.git] / graph.c
diff --git a/graph.c b/graph.c
index 74d93bfd6dd454164d6c1cf0b02a652e04a5a927..f0ce19db99fe08a1d2a0d82ab2f1746db1bae483 100644 (file)
--- a/graph.c
+++ b/graph.c
@@ -35,6 +35,9 @@ static void breadth_first_search(int start, int sqdistances_r[N]) {
     assert(d[v] >= 0);
     sqdistances_r[v]= d[v] * d[v];
   }
+
+//  FOR_VERTEX(v) {
+//    
 }
 
 void graph_layout_prepare() {
@@ -50,7 +53,7 @@ void graph_layout_prepare() {
 }
 
 
-double graph_layout_cost(const Vertices v, const double vertex_areas[N]) {
+double graph_layout_cost(const Vertices v) {
   /* For each (vi,vj) computes shortest path s_ij = |vi..vj|
    * along edges, and actual distance d_ij = |vi-vj|.
    *
@@ -98,7 +101,7 @@ double graph_layout_cost(const Vertices v, const double vertex_areas[N]) {
        *          let beta' = (1-beta)/2
        */
 
-      double cost= pow(d2/s2, beta_prime);
+      double cost= (vertex_mean_edge_lengths[v1]) * pow(d2/s2, beta_prime);
       
       //printf("layout %03x..%03x dist^2=%d s^2=%g d^2=%g "
               //" cost+=%g\n", v1,v2, dist2,
@@ -106,5 +109,5 @@ double graph_layout_cost(const Vertices v, const double vertex_areas[N]) {
       total_cost += cost;
     }
   }
-  return total_cost;
+  return total_cost/meanedgelength;
 }