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);
123 node_queue_t q = {0};
125 node_queue_push_back(&q, n);
126 while (!node_queue_is_empty(&q)) {
127 n = node_queue_pop_front(&q);
128 uint64_t nsteps =
SCENTER(n) + 1;
131 if ((next =
agtail(ep)) == n)
137 node_queue_push_back(&q, next);
192 if ((next =
agtail(ep)) == n)
197 if (
SPAN(next) != 0.0)
228 if ((next =
agtail(ep)) == n)
263 double* ranks =
gv_calloc(maxrank + 1,
sizeof(
double));
264 double xf = 0.0, delx = 0.0, d;
267 while (rk <= maxrank && (d = strtod (p, &endp)) > 0) {
272 while ((c = *p) && (
gv_isspace(c) || c ==
':'))
280 for (uint64_t i = rk; i <= maxrank; i++) {
292 fputs (
"Rank separation = ", stderr);
293 for (uint64_t i = 0; i <= maxrank; i++)
294 fprintf (stderr,
"%.03lf ", ranksep[i]);
295 fputs (
"\n", stderr);
300 double hyp = ranksep[
SCENTER(n)];
328 fprintf(stderr,
"root = %s max steps to root = %" PRIu64
"\n",
330 if (maxNStepsToCenter == UINT64_MAX) {
331 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?
#define DEFINE_LIST(name, type)
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)