+ dijkstra_shortest_paths(g, v1,
+ weight_map(edge_weights).
+ vertex_index_map(identity_property_map()).
+ distance_map(vertex_distances));
+}
+
+double graph_layout_cost(const Vertices v, const double vertex_areas[N]) {
+ /* For each (vi,vj) computes shortest path s_ij = |vi..vj|
+ * along edges, and actual distance d_ij = |vi-vj|.
+ *
+ * We will also use the `vertex areas': for each vertex vi the
+ * vertex area a_vi is the mean area of the incident triangles.
+ * This is computed elsewhere.
+ *
+ * Energy contribution is proportional to
+ *
+ * -4 2
+ * a a . d . [ (s/d) - 1 ]
+ * vi vj
+ *
+ * (In practice we compute d^2+epsilon and use it for the
+ * divisions, to avoid division by zero.)
+ */
+ static const double d2_epsilon= 1e-6;
+
+ double edge_weights[N*V6], vertex_distances[N], total_cost=0;
+ int v1,v2,e,f;