31 for (i = 0; i < n; i++) {
33 if (graph[0].edists ==
NULL) {
36 for (j = 1; j < graph[i].
nedges; j++) {
37 b_i += graph[i].
ewgts[j] * graph[i].edists[j];
43 #define hierarchy_cg_tol 1e-3
46 compute_y_coords(
vtx_data * graph,
int n,
double *y_coords,
51 double *b =
N_NEW(n,
double);
52 double tol = hierarchy_cg_tol;
54 float *uniform_weights;
55 float *old_ewgts = graph[0].
ewgts;
57 construct_b(graph, n, b);
61 for (i = 0; i < n; i++) {
67 uniform_weights =
N_GNEW(nedges,
float);
68 for (i = 0; i < n; i++) {
69 graph[i].
ewgts = uniform_weights;
70 uniform_weights[0] = (float) -(graph[i].nedges - 1);
71 for (j = 1; j < graph[i].
nedges; j++) {
72 uniform_weights[j] = 1;
74 uniform_weights += graph[i].
nedges;
83 for (i = 0; i < n; i++) {
84 graph[i].
ewgts = old_ewgts;
85 old_ewgts += graph[i].
nedges;
int conjugate_gradient(vtx_data *A, double *x, double *b, int n, double tol, int max_iterations)
Agraph_t * graph(char *name)
void init_vec_orth1(int n, double *vec)