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);
126 uint64_t nsteps =
SCENTER(n) + 1;
129 if ((next =
agtail(ep)) == n)
190 if ((next =
agtail(ep)) == n)
195 if (
SPAN(next) != 0.0)
226 if ((next =
agtail(ep)) == n)
261 double* ranks =
gv_calloc(maxrank + 1,
sizeof(
double));
262 double xf = 0.0, delx = 0.0, d;
265 while (rk <= maxrank && (d = strtod (p, &endp)) > 0) {
270 while ((c = *p) && (
gv_isspace(c) || c ==
':'))
278 for (uint64_t i = rk; i <= maxrank; i++) {
290 fputs (
"Rank separation = ", stderr);
291 for (uint64_t i = 0; i <= maxrank; i++)
292 fprintf (stderr,
"%.03lf ", ranksep[i]);
293 fputs (
"\n", stderr);
298 double hyp = ranksep[
SCENTER(n)];
326 fprintf(stderr,
"root = %s max steps to root = %" PRIu64
"\n",
328 if (maxNStepsToCenter == UINT64_MAX) {
329 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)
char * agxget(void *obj, Agsym_t *sym)
#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?
type-generic dynamically expanding list
#define LIST_POP_FRONT(list)
#define LIST_IS_EMPTY(list)
#define LIST_PUSH_BACK(list, item)
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)