40 for (
size_t i =
L->size; i !=
SIZE_MAX; i--)
51 for (
size_t c = 0; c <
GD_comp(g).size; c++) {
147 static char *name[] = {
"same",
"min",
"source",
"max",
"sink",
NULL };
236 assert(leader !=
NULL);
332 while ((e =
ND_out(n).list[0])) {
339 while ((e =
ND_in(n).list[0])) {
375 int maxiter = INT_MAX;
378 if ((
s =
agget(g,
"nslimit1")))
380 for (
size_t c = 0; c <
GD_comp(g).size; c++) {
471#define BACKWARD_PENALTY 1000
472#define STRONG_CLUSTER_WEIGHT 1000
474#define ROOT "\177root"
475#define TOPNODE "\177top"
476#define BOTNODE "\177bot"
481#define ND_comp(n) ND_hops(n)
505 if (!strcmp(
str,
"min"))
507 if (!strcmp(
str,
"source"))
509 if (!strcmp(
str,
"max"))
511 if (!strcmp(
str,
"sink"))
513 if (!strcmp(
str,
"same"))
579 clust = parent_clust;
653 if (par == ct || par == ch)
706 agerrorf(
"ranking: failure to create strong constraint edge between nodes %s and %s\n",
725 snprintf(buf,
sizeof(buf),
"_weak_%d",
id++);
727 e =
agedge(g, v, t, 0, 1);
728 f =
agedge(g, v, h, 0, 1);
794 agedge(Xg, rep, bot, 0, 1);
826 for (e =
agfstout(g, v); e; e = f) {
901 for (i = 1; i <= ncc; i++)
972 (void)
agedge(g, root, n, 0, 1);
993{
int *sz = arg; (void)g;
agbindrec(
graph,
"level graph rec",sz[0],
true); }
995{
int *sz = arg; (void)g;
agbindrec(
node,
"level node rec",sz[1],
true); }
997{
int *sz = arg; (void)g;
agbindrec(
edge,
"level edge rec",sz[2],
true); }
1008 int ncc, maxiter = INT_MAX;
1019 if ((
s =
agget(g,
"nslimit1")))
1032 if ((
s =
agget(g,
"searchsize")))
1036 rank2(Xg, 1, maxiter, ssize);
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)
bool mapbool(const char *p)
node_t * UF_union(node_t *u, node_t *v)
node_t * UF_find(node_t *n)
int maptoken(char *p, char **name, int *val)
void UF_singleton(node_t *u)
bool is_a_cluster(Agraph_t *g)
void decompose(graph_t *g, int pass)
Agraph_t * dot_root(void *p)
Agedge_t * virtual_edge(Agnode_t *, Agnode_t *, Agedge_t *)
int agnedges(Agraph_t *g)
int agnnodes(Agraph_t *g)
char * agget(void *obj, char *name)
char * agxget(void *obj, Agsym_t *sym)
void agpushdisc(Agraph_t *g, Agcbdisc_t *disc, void *state)
Agedge_t * agedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, char *name, int createflag)
Agedge_t * agsubedge(Agraph_t *g, Agedge_t *e, int createflag)
Agedge_t * agnxtin(Agraph_t *g, Agedge_t *e)
Agedge_t * agfstout(Agraph_t *g, Agnode_t *n)
#define agfindedge(g, t, h)
Agedge_t * agnxtout(Agraph_t *g, Agedge_t *e)
Agedge_t * agfstin(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)
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,...
int agcontains(Agraph_t *, void *obj)
returns non-zero if obj is a member of (sub)graph
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
Agraph_t * agfstsubg(Agraph_t *g)
Agraph_t * agnxtsubg(Agraph_t *subg)
Agraph_t * graph(char *name)
Arithmetic helper functions.
static int scale_clamp(int original, double scale)
scale up or down a non-negative integer, clamping to [0, INT_MAX]
textitem scanner parser str
static Agedge_t * top(edge_stack_t *sp)
void reverse_edge(edge_t *e)
int rank(graph_t *g, int balance, int maxiter)
int rank2(graph_t *g, int balance, int maxiter, int search_size)
static void dfscc(graph_t *g, node_t *n, int cc)
static int make_new_cluster(graph_t *g, graph_t *subg)
static bool is_internal_to_cluster(edge_t *e)
static void compile_samerank(graph_t *ug, graph_t *parent_clust)
static void compile_clusters(graph_t *g, graph_t *Xg, node_t *top, node_t *bot)
static void compile_edges(graph_t *ug, graph_t *Xg)
#define STRONG_CLUSTER_WEIGHT
void dot_scan_ranks(graph_t *g)
static graph_t * dot_lca(graph_t *c0, graph_t *c1)
static void expand_ranksets(graph_t *g)
static int connect_components(graph_t *g)
static void node_induce(graph_t *par, graph_t *g)
static void readout_levels(graph_t *g, graph_t *Xg, int ncc)
static void setMinMax(graph_t *g, int doRoot)
static void collapse_cluster(graph_t *g, graph_t *subg)
static void cleanup1(graph_t *g)
static int rankset_kind(graph_t *g)
static bool is_empty(graph_t *g)
static void renewlist(elist *L)
static void merge(edge_t *e, int minlen, int weight)
static int minmax_edges2(graph_t *g, point slen)
void dot_rank(graph_t *g)
static void dfs(graph_t *g, node_t *v)
static void collapse_rankset(graph_t *g, graph_t *subg, int kind)
bool is_cluster(graph_t *g)
static point minmax_edges(graph_t *g)
static node_t * union_one(node_t *leader, node_t *n)
static void find_clusters(graph_t *g)
static void collapse_sets(graph_t *rg, graph_t *g)
static bool is_nonconstraint(edge_t *e)
static void strong(graph_t *g, node_t *t, node_t *h, edge_t *orig)
static void set_parent(graph_t *g, graph_t *p)
static node_t * Last_node
static void my_init_graph(Agraph_t *g, Agobj_t *graph, void *arg)
static node_t * find(node_t *n)
static node_t * makeXnode(graph_t *G, char *name)
static void reverse_edge2(graph_t *g, edge_t *e)
static void add_fast_edges(graph_t *g)
static void break_cycles(graph_t *g)
static void dot1_rank(graph_t *g)
static void compile_nodes(graph_t *g, graph_t *Xg)
static bool is_a_strong_cluster(graph_t *g)
static void dot2_rank(graph_t *g)
static void weak(graph_t *g, node_t *t, node_t *h, edge_t *orig)
static int rank_set_class(graph_t *g)
static void cluster_leader(graph_t *clust)
static void my_init_node(Agraph_t *g, Agobj_t *node, void *arg)
static void edgelabel_ranks(graph_t *g)
static void my_init_edge(Agraph_t *g, Agobj_t *edge, void *arg)
static node_t * union_all(graph_t *g)
static void set_minmax(graph_t *g)
client event callbacks, used in Agcbstack_s
a generic header of Agraph_s, Agnode_s and Agedge_s
Agrec_t * data
stores programmer-defined data, access with AGDATA
#define elist_append(item, L)
#define alloc_elist(n, L)