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",
398 fprintf(stderr,
"derive graph _dg_%d of %s\n", infop->
gid,
agnameof(g));
417 boxf fix_bb = {{DBL_MAX, DBL_MAX}, {-DBL_MAX, -DBL_MAX}};
425 chkPos(subg, dn, infop, &fix_bb);
492 if ((pp = PORTS(g))) {
498 PORTS(dg) =
pq =
gv_calloc(sz + 1,
sizeof(bport_t));
520 pq->alpha = pp->alpha;
535static int ecmp(
const void *v1,
const void *v2)
582 qsort(erecs, deg,
sizeof(
erec),
ecmp);
587 double a, inc,
delta, bnd;
590 while (i < deg - 1) {
593 while (j < deg && erecs[j].
alpha == a)
601 bnd = erecs[j].
alpha;
602 delta = fmin((bnd - a) / (j - i),
ANG);
605 erecs[i].
alpha += inc;
655 for (j = 0; j <
ED_count(e); j++, ep++) {
685 bport_t *pp =
gv_calloc(sz + 1,
sizeof(bport_t));
697 idx =
genPorts(n, ep, pp, idx, bnd);
765 vertices[1].
x = -
ND_lw(n);
767 vertices[2].
x = -
ND_lw(n);
831 fprintf (stderr,
"layout %s\n",
agnameof(g));
842 cc = pg =
findCComp(dg, &c_cnt, &pinned);
844 while ((
cg = *pg++)) {
852 int r =
layout(sg, infop);
862 }
else if (IS_PORT(n))
868 if (g == infop->
rootg)
901 finalCC(dg, c_cnt, cc, pts, g, infop);
911 BB(sg).UR.x = BB(sg).LL.x +
ND_width(dn);
912 BB(sg).UR.y = BB(sg).LL.y +
ND_height(dn);
913 }
else if ((n = ANODE(dn))) {
920 if (g == infop->
rootg)
931 fprintf (stderr,
"end %s\n",
agnameof(g));
986 if (pclist ==
NULL) {
988 clist_append(&list,
NULL);
1000 LEVEL(subg) = LEVEL(
parent) + 1;
1002 clist_append(clist, subg);
1009 if (pclist ==
NULL) {
1010 assert(clist_size(&list) - 1 <= INT_MAX);
1012 if (clist_size(&list) > 1) {
1013 clist_shrink_to_fit(&list);
1070 "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)
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
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)