25#define DEF_RANKSEP 1.00
36 uint64_t nsteps =
SLEAF(n) + 1;
39 if ((next =
agtail(ep)) == n)
45 if (nsteps <
SLEAF(next)) {
61 if ((np =
agtail(ep)) == n)
78 uint64_t
INF = (uint64_t)nnodes * (uint64_t)nnodes;
99 uint64_t maxNStepsToLeaf = 0;
109 maxNStepsToLeaf =
SLEAF(n);
125 uint64_t nsteps =
SCENTER(n) + 1;
128 if ((next =
agtail(ep)) == n)
189 if ((next =
agtail(ep)) == n)
194 if (
SPAN(next) != 0.0)
225 if ((next =
agtail(ep)) == n)
260 double* ranks =
gv_calloc(maxrank + 1,
sizeof(
double));
261 double xf = 0.0, delx = 0.0, d;
264 while (rk <= maxrank && (d = strtod (p, &endp)) > 0) {
269 while ((c = *p) && (
gv_isspace(c) || c ==
':'))
277 for (uint64_t i = rk; i <= maxrank; i++) {
289 fputs (
"Rank separation = ", stderr);
290 for (uint64_t i = 0; i <= maxrank; i++)
291 fprintf (stderr,
"%.03lf ", ranksep[i]);
292 fputs (
"\n", stderr);
297 double hyp = ranksep[
SCENTER(n)];
325 fprintf(stderr,
"root = %s max steps to root = %" PRIu64
"\n",
327 if (maxNStepsToCenter == UINT64_MAX) {
328 agerrorf(
"twopi: use of weight=0 creates disconnected component.\n");
Memory allocation wrappers that exit on failure.
static void * gv_calloc(size_t nmemb, size_t size)
static void setNStepsToCenter(Agraph_t *g, Agnode_t *n)
static double * getRankseps(Agraph_t *g, uint64_t maxrank)
static void setPositions(Agraph_t *sg, Agnode_t *center)
static void setSubtreeSize(Agraph_t *g)
static void setChildPositions(Agraph_t *sg, Agnode_t *n)
static void setChildSubtreeSpans(Agraph_t *g, Agnode_t *n)
static bool is_set(double a)
has the given value been assigned?
static void setNStepsToLeaf(Agraph_t *g, Agnode_t *n, Agnode_t *prev)
static void setAbsolutePos(Agraph_t *g, uint64_t maxrank)
static void initLayout(Agraph_t *g)
static Agnode_t * findCenterNode(Agraph_t *g)
Agnode_t * circleLayout(Agraph_t *sg, Agnode_t *center)
static void setSubtreeSpans(Agraph_t *sg, Agnode_t *center)
static uint64_t setParentNodes(Agraph_t *sg, Agnode_t *center)
static bool isLeaf(Agraph_t *g, Agnode_t *n)
char * late_string(void *obj, attrsym_t *attr, char *defaultValue)
int agnnodes(Agraph_t *g)
#define agfindedgeattr(g, a)
Agedge_t * agnxtedge(Agraph_t *g, Agedge_t *e, Agnode_t *n)
Agedge_t * agfstedge(Agraph_t *g, Agnode_t *n)
void agerrorf(const char *fmt,...)
#define agfindgraphattr(g, a)
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.
replacements for ctype.h functions
static bool gv_isspace(int c)
Arithmetic helper functions.
static bool is_exactly_equal(double a, double b)
are two values precisely the same?
generic first-in-first-out buffer (queue)
static void queue_free(queue_t *q)
static void queue_push(queue_t *q, void *item)
static void * queue_pop(queue_t *q)
static bool streq(const char *a, const char *b)
are a and b equal?
Agraph_t * root
subgraphs - ancestors
static point center(point vertex[], size_t n)