for (k = 0; k < Ndim; k++) {
vec[k] = p0[k] - p1[k];
- dist += (vec[k] * vec[k]);
+ dist += vec[k] * vec[k];
}
dist = sqrt(dist);
return dist;
s = agxget(e, index);
if (*s == '\0') return 1;
- if ((sscanf(s, "%lf", val) < 1) || (*val < 0) || ((*val == 0) && !Nop)) {
+ if (sscanf(s, "%lf", val) < 1 || *val < 0 || (*val == 0 && !Nop)) {
agerr(AGWARN, "bad edge len \"%s\"", s);
return 2;
}
if (aghead(ep) == agtail(ep))
continue; /* ignore loops */
if (deg == 1) {
- if (((agtail(ep) == n) && (aghead(ep) == other)) || /* ignore multiedge */
- ((agtail(ep) == other) && (aghead(ep) == n)))
+ if ((agtail(ep) == n && aghead(ep) == other) || /* ignore multiedge */
+ (agtail(ep) == other && aghead(ep) == n))
continue;
return 2;
} else { /* deg == 0 */
else
Initial_dist = total_len / (nE > 0 ? nE : 1) * sqrt(nV) + 1;
- if (!Nop && (mode == MODE_KK)) {
+ if (!Nop && mode == MODE_KK) {
GD_dist(G) = new_array(nV, nV, Initial_dist);
GD_spring(G) = new_array(nV, nV, 1.0);
GD_sum_t(G) = new_array(nV, Ndim, 1.0);
init = checkStart(G, nG, INIT_RANDOM);
if (init == INIT_REGULAR)
return;
- if ((init == INIT_SELF) && (once == 0)) {
+ if (init == INIT_SELF && once == 0) {
agerr(AGWARN, "start=0 not supported with mode=self - ignored\n");
once = 1;
}
for (j = i + 1; j < nG; j++) {
jp = GD_neato_nlist(G)[j];
for (t0 = 0.0, d = 0; d < Ndim; d++) {
- t1 = (ND_pos(ip)[d] - ND_pos(jp)[d]);
+ t1 = ND_pos(ip)[d] - ND_pos(jp)[d];
t0 += t1 * t1;
}
e = e + GD_spring(G)[i][j] *
if (Verbose) {
fprintf(stderr, "\nfinal e = %f", total_e(G, nG));
fprintf(stderr, " %d%s iterations %.2f sec\n",
- GD_move(G), (GD_move(G) == MaxIter ? "!" : ""),
+ GD_move(G), GD_move(G) == MaxIter ? "!" : "",
elapsed_sec());
}
if (GD_move(G) == MaxIter)
GD_sum_t(G)[i][k] += GD_t(G)[i][j][k];
old = GD_t(G)[j][i][k];
GD_t(G)[j][i][k] = -GD_t(G)[i][j][k];
- GD_sum_t(G)[j][k] += (GD_t(G)[j][i][k] - old);
+ GD_sum_t(G)[j][k] += GD_t(G)[j][i][k] - old;
}
}
}
for (l = 0; l < k; l++)
Msub(l, k) += K[n][i] * D[n][i] * t[k] * t[l] * scale;
Msub(k, k) +=
- K[n][i] * (1.0 - D[n][i] * (sq - (t[k] * t[k])) * scale);
+ K[n][i] * (1.0 - D[n][i] * (sq - t[k] * t[k]) * scale);
}
}
for (k = 1; k < Ndim; k++)
if (ND_pinned(np) > P_SET)
continue;
for (m = 0.0, k = 0; k < Ndim; k++)
- m += (GD_sum_t(G)[i][k] * GD_sum_t(G)[i][k]);
+ m += GD_sum_t(G)[i][k] * GD_sum_t(G)[i][k];
/* could set the color=energy of the node here */
if (m > max) {
choice = np;
if (max < Epsilon2)
choice = NULL;
else {
- if (Verbose && (cnt % 100 == 0)) {
+ if (Verbose && cnt % 100 == 0) {
fprintf(stderr, "%.3f ", sqrt(max));
if (cnt % 1000 == 0)
fprintf(stderr, "\n");