67#define NEW_EDGE(e) (ED_to_virt(e) == 0)
89 int isRoot = rg == infop->
rootg;
102 while ((
cg = *cp++)) {
133 if (isRoot || isEmpty)
137 pt.
x = -bb.
LL.
x + margin;
141 bb.
UR.
x += pt.
x + margin;
148 while ((
cg = *cp++)) {
212 while ((
cg = *cc++)) {
291 static char buf[
BSZ + 1];
293 snprintf(buf,
sizeof(buf),
"_port_%s_(%d)_(%d)_%u",
agnameof(g),
317 if (g != infop->
rootg) {
324 if (sscanf(p,
"%lf,%lf,%lf,%lf%c",
340 agwarningf(
"graph %s, coord %s, expected four doubles\n",
401 fprintf(stderr,
"derive graph _dg_%d of %s\n", infop->
gid,
agnameof(g));
420 boxf fix_bb = {{DBL_MAX, DBL_MAX}, {-DBL_MAX, -DBL_MAX}};
428 chkPos(subg, dn, infop, &fix_bb);
495 if ((pp = PORTS(g))) {
501 PORTS(dg) =
pq =
gv_calloc(sz + 1,
sizeof(bport_t));
523 pq->alpha = pp->alpha;
538static int ecmp(
const void *v1,
const void *v2)
585 qsort(erecs, deg,
sizeof(
erec),
ecmp);
590 double a, inc,
delta, bnd;
593 while (i < deg - 1) {
596 while (j < deg && erecs[j].
alpha == a)
604 bnd = erecs[j].
alpha;
605 delta = fmin((bnd - a) / (j - i),
ANG);
608 erecs[i].
alpha += inc;
658 for (j = 0; j <
ED_count(e); j++, ep++) {
688 bport_t *pp =
gv_calloc(sz + 1,
sizeof(bport_t));
700 idx =
genPorts(n, ep, pp, idx, bnd);
768 vertices[1].
x = -
ND_lw(n);
770 vertices[2].
x = -
ND_lw(n);
834 fprintf (stderr,
"layout %s\n",
agnameof(g));
845 cc = pg =
findCComp(dg, &c_cnt, &pinned);
847 while ((
cg = *pg++)) {
855 int r =
layout(sg, infop);
865 }
else if (IS_PORT(n))
871 if (g == infop->
rootg)
904 finalCC(dg, c_cnt, cc, pts, g, infop);
914 BB(sg).UR.x = BB(sg).LL.x +
ND_width(dn);
915 BB(sg).UR.y = BB(sg).LL.y +
ND_height(dn);
916 }
else if ((n = ANODE(dn))) {
923 if (g == infop->
rootg)
934 fprintf (stderr,
"end %s\n",
agnameof(g));
989 if (pclist ==
NULL) {
991 clist_append(&list,
NULL);
1003 LEVEL(subg) = LEVEL(
parent) + 1;
1005 clist_append(clist, subg);
1012 if (pclist ==
NULL) {
1013 assert(clist_size(&list) - 1 <= INT_MAX);
1015 if (clist_size(&list) > 1) {
1016 clist_shrink_to_fit(&list);
1073 "splines and cluster edges not supported - using line segments\n");
int normalize(graph_t *g)
Memory allocation wrappers that exit on failure.
static void * gv_recalloc(void *ptr, size_t old_nmemb, size_t new_nmemb, size_t size)
static void * gv_calloc(size_t nmemb, size_t size)
static void * gv_alloc(size_t size)
int compoundEdges(graph_t *g, expand_t *pm, int edgetype)
void setEdgeType(graph_t *g, int defaultValue)
int late_int(void *obj, attrsym_t *attr, int defaultValue, int minimum)
double late_double(void *obj, attrsym_t *attr, double defaultValue, double minimum)
double get_inputscale(graph_t *g)
void compute_bb(graph_t *g)
bool is_a_cluster(Agraph_t *g)
graph_t ** findCComp(graph_t *g, size_t *cnt, int *pinned)
#define DEFAULT_NODEHEIGHT
#define DEFAULT_NODEPENWIDTH
#define DEFAULT_NODEWIDTH
#define EDGETYPE_COMPOUND
static void del(Dict_t *d, Dtlink_t **set, Agedge_t *e)
void fdp_init_node_edge(Agraph_t *g)
#define PS2INCH(a_points)
#define INCH2PS(a_inches)
static int cnt(Dict_t *d, Dtlink_t **set)
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
int agxset(void *obj, Agsym_t *sym, const char *value)
char * agxget(void *obj, Agsym_t *sym)
Agsym_t * agattr_html(Agraph_t *g, int kind, char *name, const char *value)
agattr, but creates HTML-like values
Agedge_t * agedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, char *name, int createflag)
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,...)
void agerrorf(const char *fmt,...)
int agclose(Agraph_t *g)
deletes a graph, freeing its associated storage
Agdesc_t Agstrictdirected
strict directed. A strict graph cannot have multi-edges or self-arcs.
Agraph_t * agopen(char *name, Agdesc_t desc, Agdisc_t *disc)
creates a new graph with the given name and kind
Agnode_t * agnode(Agraph_t *g, char *name, int createflag)
#define ND_outline_width(n)
#define ND_outline_height(n)
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 agdelete(Agraph_t *g, void *obj)
deletes object. Equivalent to agclose, agdelnode, and agdeledge for obj being a graph,...
Agraph_t * agroot(void *obj)
void * agbindrec(void *obj, const char *name, unsigned int recsize, int move_to_front)
attaches a new record of the given size to the object
int agdelrec(void *obj, const char *name)
deletes a named record from one object
int aghtmlstr(const char *)
Agraph_t * agparent(Agraph_t *g)
Agraph_t * agfstsubg(Agraph_t *g)
Agraph_t * agnxtsubg(Agraph_t *subg)
static erec * getEdgeList(node_t *n, graph_t *g)
static void fdpSplines(graph_t *g)
static void setBB(graph_t *g)
static void init_info(graph_t *g, layout_info *infop)
static void fdp_init_graph(Agraph_t *g)
static char * portName(graph_t *g, bport_t *p)
void fdp_layout(graph_t *g)
static void evalPositions(graph_t *g, graph_t *rootg)
static int genPorts(node_t *n, erec *er, bport_t *pp, int idx, double bnd)
static int ecmp(const void *v1, const void *v2)
static void addEdge(edge_t *de, edge_t *e)
static void chkPos(graph_t *g, node_t *n, layout_info *infop, boxf *bbp)
static node_t * mkDeriveNode(graph_t *dg, char *name)
static graph_t * expandCluster(node_t *n, graph_t *cg)
static void freeDerivedGraph(graph_t *g, graph_t **cc)
static void freeDeriveNode(node_t *n)
static int fdpLayout(graph_t *g)
static void copyAttr(graph_t *g, graph_t *dg, char *attr)
static void freeGData(graph_t *g)
static void setClustNodes(graph_t *root)
static void mkClusters(graph_t *g, clist_t *pclist, graph_t *parent)
static void finalCC(graph_t *g, size_t c_cnt, graph_t **cc, pointf *pts, graph_t *rg, layout_info *infop)
static int layout(graph_t *g, layout_info *infop)
static graph_t * deriveGraph(graph_t *g, layout_info *infop)
#define DEFINE_LIST(name, type)
#define HAS_CLUST_EDGE(g)
NEATOPROCS_API bool neato_set_aspect(graph_t *g)
NEATOPROCS_API int splineEdges(graph_t *, int(*edgefn)(graph_t *, expand_t *, int), int)
NEATOPROCS_API int spline_edges1(graph_t *g, int)
pack_mode getPackInfo(Agraph_t *g, pack_mode dflt, int dfltMargin, pack_info *pinfo)
pointf * putGraphs(size_t ng, Agraph_t **gs, Agraph_t *root, pack_info *pinfo)
support for connected components
void gv_postprocess(Agraph_t *g, int allowTranslation)
static double cg(SparseMatrix A, const double *precond, int n, int dim, double *x0, double *rhs, double tol, double maxit)
void fdp_initParams(graph_t *g)
void fdp_tLayout(graph_t *g, xparams *xpms)
void fdp_xLayout(graph_t *g, xparams *xpms)