X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=moebius2.git;a=blobdiff_plain;f=graph.c;h=a81de42e89e2bb3839ccf2517c25af38b30f1b9d;hp=c9cdd2cd773670cbeaef05d846c02b1f88a8a123;hb=4c2fa1edde3eff50648b6782e0b6e63add9b4943;hpb=2377b968f55ddd5d6a8ff79ee9150316a218afc8 diff --git a/graph.c b/graph.c index c9cdd2c..a81de42 100644 --- a/graph.c +++ b/graph.c @@ -4,6 +4,7 @@ #include "mgraph.h" #include "minimise.h" +#include "parallel.h" static int sqdistances[N][N]; @@ -14,7 +15,7 @@ static void breadth_first_search(int start, int sqdistances_r[N]) { int v,e, current, future, dfuture; buf_push= buf_pop= buffer; - FOR_VERTEX(v) d[v]= -1; + FOR_VERTEX(v,INNER) d[v]= -1; d[start]= 0; *buf_push++= start; @@ -31,26 +32,29 @@ static void breadth_first_search(int start, int sqdistances_r[N]) { assert(buf_pop==buf_push); assert(buf_push <= buffer+sizeof(buffer)/sizeof(buffer[0])); - FOR_VERTEX(v) { + FOR_VERTEX(v,INNER) { assert(d[v] >= 0); sqdistances_r[v]= d[v] * d[v]; } + +// FOR_VERTEX(v) { +// } -void graph_layout_prepare() { +void graph_layout_prepare(void) { int v1; - FOR_VERTEX(v1) + FOR_VERTEX(v1,INNER) breadth_first_search(v1, sqdistances[v1]); alpha= 2; - beta= -log(10)/log(alpha); + beta= log(10)/log(alpha); beta_prime= (1-beta)/2; printf("alpha=%g beta=%g beta'=%g\n", alpha,beta,beta_prime); } -double graph_layout_cost(const Vertices v, const double vertex_areas[N]) { +double graph_layout_cost(const Vertices v, int section) { /* For each (vi,vj) computes shortest path s_ij = |vi..vj| * along edges, and actual distance d_ij = |vi-vj|. * @@ -69,12 +73,11 @@ double graph_layout_cost(const Vertices v, const double vertex_areas[N]) { */ //static const double d2_epsilon= 1e-6; - // double edge_weights[V6<