49#define D_useGrid (fdp_parms->useGrid)
50#define D_useNew (fdp_parms->useNew)
51#define D_numIters (fdp_parms->numIters)
52#define D_unscaled (fdp_parms->unscaled)
53#define D_C (fdp_parms->C)
54#define D_Tfact (fdp_parms->Tfact)
55#define D_K (fdp_parms->K)
56#define D_T0 (fdp_parms->T0)
82#define T_useGrid (parms.useGrid)
83#define T_useNew (parms.useNew)
84#define T_seed (parms.seed)
85#define T_numIters (parms.numIters)
86#define T_maxIters (parms.maxIters)
87#define T_unscaled (parms.unscaled)
89#define T_Tfact (parms.Tfact)
91#define T_T0 (parms.T0)
92#define T_smode (parms.smode)
93#define T_Cell (parms.Cell)
94#define T_Wd (parms.Wd)
95#define T_Ht (parms.Ht)
96#define T_pass1 (parms.pass1)
97#define T_loopcnt (parms.loopcnt)
100#define DFLT_maxIters 600
104#define DFLT_smode INIT_RANDOM
136 fprintf(stderr,
"tlayout %s",
agnameof(g));
184 agwarningf(
"fdp does not support start=self - ignoring\n");
198 "Params %s : K %f T0 %f Tfact %f maxIters %d unscaled %d\n",
211 while (
dist2 == 0.0) {
212 xdelta = 5 - rand() % 10;
213 ydelta = 5 - rand() % 10;
214 dist2 = xdelta * xdelta + ydelta * ydelta;
221 if (IS_PORT(p) && IS_PORT(q))
223 DISP(q)[0] += xdelta * force;
224 DISP(q)[1] += ydelta * force;
225 DISP(p)[0] -= xdelta * force;
226 DISP(p)[1] -= ydelta * force;
235 double xdelta, ydelta;
239 doRep(p, q, xdelta, ydelta, xdelta * xdelta + ydelta * ydelta);
248 double xdelta, ydelta;
255 fprintf(stderr,
" doNeighbor (%d,%d) : %d\n", i, j,
259 for (; nodes != 0; nodes = nodes->
next) {
261 for (qs = cellp->
nodes; qs != 0; qs = qs->
next) {
265 dist2 = xdelta * xdelta + ydelta * ydelta;
283 fprintf(stderr,
"gridRepulse (%d,%d) : %d\n", i, j,
287 for (p = nodes; p != 0; p = p->
next) {
288 for (q = nodes; q != 0; q = q->
next)
311 double xdelta, ydelta;
318 dist2 = xdelta * xdelta + ydelta * ydelta;
319 while (
dist2 == 0.0) {
320 xdelta = 5 - rand() % 10;
321 ydelta = 5 - rand() % 10;
322 dist2 = xdelta * xdelta + ydelta * ydelta;
329 DISP(q)[0] -= xdelta * force;
330 DISP(q)[1] -= ydelta * force;
331 DISP(p)[0] += xdelta * force;
332 DISP(p)[1] += ydelta * force;
356 double fact = temp / sqrt(len2);
367 }
else if (d >= 1.0) {
368 ND_pos(n)[0] = 0.95 * x / d;
369 ND_pos(n)[1] = 0.95 * y / d;
381#define FLOOR(d) ((int)floor(d))
396 DISP(n)[0] = DISP(n)[1] = 0;
424 DISP(n)[0] = DISP(n)[1] = 0;
452 boxf bb = { {0, 0}, {0, 0} };
455 double PItimes2 =
M_PI * 2.0;
472 size =
T_K * (sqrt((
double) nG) + 1.0);
477 }
else if (n_pos > 1) {
478 double alpha, area, width, height, quot;
479 ctr.
x = (bb.
LL.
x + bb.
UR.
x) / 2.0;
480 ctr.
y = (bb.
LL.
y + bb.
UR.
y) / 2.0;
484 quot = width * height / area;
488 }
else if (quot > 0.0) {
489 quot = 2.0 * sqrt(quot);
491 T_Ht = height / quot;
494 height = area / width;
497 }
else if (height > 0) {
498 width = area / height;
520 local_seed = (long)time(
NULL);
522 local_seed = getpid() ^ time(
NULL);
573 }
else if (
cnt == 1) {
574 ND_pos(np)[0] = 0.98 * p.
x + 0.1 * ctr.
x;
575 ND_pos(np)[1] = 0.9 * p.
y + 0.1 * ctr.
y;
577 double angle = PItimes2 *
drand48();
578 double radius = 0.9 *
drand48();
616 bport_t *pp = PORTS(g);
642 if (ctr.
x != 0.0 || ctr.
y != 0.0) {
int late_int(void *obj, attrsym_t *attr, int defaultValue, int minimum)
double late_double(void *obj, attrsym_t *attr, double defaultValue, double minimum)
static const char adjust[]
static double dist(int dim, double *x, double *y)
static int cnt(Dict_t *d, Dtlink_t **set)
void walkGrid(Grid *g, int(*walkf)(cell *, Grid *))
void adjustGrid(Grid *g, int nnodes)
void addGrid(Grid *g, int i, int j, Agnode_t *n)
cell * findGrid(Grid *g, int i, int j)
Grid * mkGrid(int cellHint)
int agnnodes(Agraph_t *g)
Agsym_t * agattr(Agraph_t *g, int kind, char *name, const char *value)
creates or looks up attributes of a graph
Agedge_t * agfstout(Agraph_t *g, Agnode_t *n)
Agedge_t * agnxtedge(Agraph_t *g, Agedge_t *e, Agnode_t *n)
Agedge_t * agnxtout(Agraph_t *g, Agedge_t *e)
Agedge_t * agfstedge(Agraph_t *g, Agnode_t *n)
void agwarningf(const char *fmt,...)
Agnode_t * agnxtnode(Agraph_t *g, Agnode_t *n)
Agnode_t * agfstnode(Agraph_t *g)
char * agnameof(void *)
returns a string descriptor for the object.
int setSeed(graph_t *G, int dflt, long *seedp)
PATHUTIL_API COORD dist2(Ppoint_t, Ppoint_t)
Agraph_t * root
subgraphs - ancestors
result of partitioning available space, part of maze
static int gridRepulse(cell *cellp, Grid *grid)
static int init_params(graph_t *g, xparams *xpms)
void fdp_initParams(graph_t *g)
static void applyAttr(Agnode_t *p, Agnode_t *q, Agedge_t *e)
static pointf initPositions(graph_t *g, bport_t *pp)
static void applyRep(Agnode_t *p, Agnode_t *q)
static void doRep(node_t *p, node_t *q, double xdelta, double ydelta, double dist2)
static void updatePos(Agraph_t *g, double temp, bport_t *pp)
static void doNeighbor(Grid *grid, int i, int j, node_list *nodes)
void fdp_tLayout(graph_t *g, xparams *xpms)
static void reset_params(void)
static void gAdjust(Agraph_t *g, double temp, bport_t *pp, Grid *grid)
static void clearGrid(grid_t *g)