Graphviz 12.0.1~dev.20240715.2254
Loading...
Searching...
No Matches
cgraph.h
Go to the documentation of this file.
1
20/*************************************************************************
21 * Copyright (c) 2011 AT&T Intellectual Property
22 * All rights reserved. This program and the accompanying materials
23 * are made available under the terms of the Eclipse Public License v1.0
24 * which accompanies this distribution, and is available at
25 * https://www.eclipse.org/legal/epl-v10.html
26 *
27 * Contributors: Details at https://graphviz.org
28 *************************************************************************/
29
30#pragma once
31
32#include "cdt.h"
33#include <inttypes.h>
34#include <stdbool.h>
35#include <stddef.h>
36#include <stdint.h>
37#include <stdio.h>
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
55
56#ifdef GVDLL
57#ifdef EXPORT_CGRAPH
58#define CGRAPH_API __declspec(dllexport)
59#else
60#define CGRAPH_API __declspec(dllimport)
61#endif
62#endif
63
64#ifndef CGRAPH_API
65#define CGRAPH_API /* nothing */
66#endif
67
69
70/* forward struct type declarations */
73typedef uint64_t IDTYPE;
74typedef struct Agtag_s Agtag_t;
75typedef struct Agobj_s Agobj_t;
79typedef struct Agraph_s Agraph_t;
80typedef struct Agdesc_s Agdesc_t;
81typedef struct Agdstate_s Agdstate_t;
82typedef struct Agclos_s Agclos_t;
86typedef struct Agnode_s Agnode_t;
87typedef struct Agsubnode_s Agsubnode_t;
91typedef struct Agedge_s Agedge_t;
92typedef struct Agedgepair_s Agedgepair_t;
96typedef struct Agiddisc_s Agiddisc_t;
97typedef struct Agiodisc_s Agiodisc_t;
98typedef struct Agdisc_s Agdisc_t;
102typedef struct Agcbdisc_s Agcbdisc_t;
103typedef struct Agcbstack_s Agcbstack_t;
105
165typedef struct Agsym_s Agsym_t;
166typedef struct Agattr_s Agattr_t;
168typedef struct Agrec_s Agrec_t;
170
172struct Agrec_s {
173 char *name;
175 /* following this would be any programmer-defined data */
176};
179
197struct Agtag_s {
199 unsigned objtype : 2; /* see enum below */
200 unsigned mtflock : 1;
201 unsigned attrwf : 1; /* attrs written (parity, write.c) */
202 unsigned seq : (sizeof(unsigned) * 8 - 4); /* sequence no. */
203 IDTYPE id; /* client ID */
204};
205
208
214
215#define AGTAG(obj) (((Agobj_t *)(obj))->tag)
216#define AGTYPE(obj) (AGTAG(obj).objtype)
220#define AGID(obj) (AGTAG(obj).id)
222
223#define AGSEQ(obj) (AGTAG(obj).seq)
224#define AGATTRWF(obj) (AGTAG(obj).attrwf)
225#define AGDATA(obj) (((Agobj_t *)(obj))->data)
227
230
248struct Agsubnode_s { /* the node-per-graph-or-subgraph record */
249 Dtlink_t seq_link; /* must be first */
251 Agnode_t *node; /* the object */
252 Dtlink_t *in_id, *out_id; /* by node/ID for random access */
253 Dtlink_t *in_seq, *out_seq; /* by node/sequence for serial access */
256struct Agnode_s {
258 Agraph_t *root;
259 Agsubnode_t mainsub; /* embedded for main graph */
265struct Agedge_s {
267 Dtlink_t id_link; /* main graph only */
269 Agnode_t *node; /* the endpoint node */
273 Agedge_t out, in;
274};
279
281struct Agdesc_s { /* graph descriptor */
282 unsigned directed : 1; /* if edges are asymmetric */
283 unsigned strict : 1; /* if multi-edges forbidden */
284 unsigned no_loop : 1; /* if no loops */
285 unsigned maingraph : 1; /* if this is the top level graph */
286 unsigned no_write : 1; /* if a temporary subgraph */
287 unsigned has_attrs : 1; /* if string attr tables should be initialized */
288 unsigned has_cmpnd : 1; /* if may contain collapsed nodes */
313struct Agiddisc_s {
314 void *(*open)(Agraph_t *g, Agdisc_t *); /* associated with a graph */
315 long (*map)(void *state, int objtype, char *str, IDTYPE *id, int createflag);
316 long (*alloc)(void *state, int objtype, IDTYPE id);
317 void (*free)(void *state, int objtype, IDTYPE id);
318 char *(*print)(void *state, int objtype, IDTYPE id);
319 void (*close)(void *state);
320 void (*idregister)(void *state, int objtype, void *obj);
324struct Agiodisc_s {
325 int (*afread)(void *chan, char *buf, int bufsize);
326 int (*putstr)(void *chan, const char *str);
327 int (*flush)(void *chan); /* sync */
328 /* error messages? */
334struct Agdisc_s {
335 Agiddisc_t *id;
336 Agiodisc_t *io;
339/* default resource disciplines */
340
341CGRAPH_API extern Agiddisc_t AgIdDisc;
342CGRAPH_API extern Agiodisc_t AgIoDisc;
343
344CGRAPH_API extern Agdisc_t AgDefaultDisc;
346
360struct Agdstate_s {
361 void *id;
362 /* IO must be initialized and finalized outside Cgraph,
363 * and channels (FILES) are passed as void* arguments. */
365
366typedef void (*agobjfn_t)(Agraph_t *g, Agobj_t *obj, void *arg);
367typedef void (*agobjupdfn_t)(Agraph_t *g, Agobj_t *obj, void *arg,
368 Agsym_t *sym);
385struct Agcbdisc_s {
386 struct {
396struct Agcbstack_s {
397 Agcbdisc_t *f; /* methods */
398 void *state; /* closure */
399 Agcbstack_t *prev; /* kept in a stack, unlike other disciplines */
402CGRAPH_API void agpushdisc(Agraph_t *g, Agcbdisc_t *disc, void *state);
403CGRAPH_API int agpopdisc(Agraph_t *g, Agcbdisc_t *disc);
404
406
408struct Agclos_s {
409 Agdisc_t disc; /* resource discipline functions */
410 Agdstate_t state; /* resource closures */
411 Dict_t *strdict; /* shared string dict */
412 uint64_t seq[3]; /* local object sequence number counter */
413 Agcbstack_t *cb; /* user and system callback function stacks */
419struct graphviz_node_set;
420
422struct Agraph_s {
449CGRAPH_API int agclose(Agraph_t *g);
451CGRAPH_API Agraph_t *agread(void *chan, Agdisc_t *disc);
453
454CGRAPH_API Agraph_t *agmemread(const char *cp);
456
457CGRAPH_API Agraph_t *agmemconcat(Agraph_t *g, const char *cp);
458CGRAPH_API void agreadline(int);
460
461CGRAPH_API void agsetfile(const char *);
463
464CGRAPH_API Agraph_t *agconcat(Agraph_t *g, void *chan, Agdisc_t *disc);
473CGRAPH_API int agwrite(Agraph_t *g, void *chan);
474CGRAPH_API int agisdirected(Agraph_t *g);
475CGRAPH_API int agisundirected(Agraph_t *g);
476CGRAPH_API int agisstrict(Agraph_t *g);
477CGRAPH_API int agissimple(Agraph_t *g);
479
482CGRAPH_API Agnode_t *agnode(Agraph_t *g, char *name, int createflag);
483CGRAPH_API Agnode_t *agidnode(Agraph_t *g, IDTYPE id, int createflag);
484CGRAPH_API Agnode_t *agsubnode(Agraph_t *g, Agnode_t *n, int createflag);
485CGRAPH_API Agnode_t *agfstnode(Agraph_t *g);
486CGRAPH_API Agnode_t *agnxtnode(Agraph_t *g, Agnode_t *n);
487CGRAPH_API Agnode_t *aglstnode(Agraph_t *g);
488CGRAPH_API Agnode_t *agprvnode(Agraph_t *g, Agnode_t *n);
489
490CGRAPH_API Agsubnode_t *agsubrep(Agraph_t *g, Agnode_t *n);
491CGRAPH_API int agnodebefore(Agnode_t *u, Agnode_t *v); /* we have no shame */
492CGRAPH_API int agdelnode(Agraph_t *g, Agnode_t *arg_n);
494CGRAPH_API int agrelabel_node(Agnode_t *n, char *newname);
496
518CGRAPH_API Agedge_t *agedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, char *name,
519 int createflag);
520CGRAPH_API Agedge_t *agidedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, IDTYPE id,
521 int createflag);
522CGRAPH_API Agedge_t *agsubedge(Agraph_t *g, Agedge_t *e, int createflag);
523CGRAPH_API Agedge_t *agfstin(Agraph_t *g, Agnode_t *n);
524CGRAPH_API Agedge_t *agnxtin(Agraph_t *g, Agedge_t *e);
525CGRAPH_API Agedge_t *agfstout(Agraph_t *g, Agnode_t *n);
526CGRAPH_API Agedge_t *agnxtout(Agraph_t *g, Agedge_t *e);
527CGRAPH_API Agedge_t *agfstedge(Agraph_t *g, Agnode_t *n);
528CGRAPH_API Agedge_t *agnxtedge(Agraph_t *g, Agedge_t *e, Agnode_t *n);
529CGRAPH_API int agdeledge(Agraph_t *g, Agedge_t *arg_e);
531
534
535// Generic object (graphs, nodes and edges) functions
536
537CGRAPH_API Agraph_t *agraphof(void *obj);
538CGRAPH_API Agraph_t *agroot(void *obj);
541
542CGRAPH_API int agcontains(Agraph_t *, void *obj);
544
545CGRAPH_API char *agnameof(void *);
547
548CGRAPH_API int agdelete(Agraph_t *g, void *obj);
555CGRAPH_API int agobjkind(void *obj);
559
582CGRAPH_API char *agstrdup(Agraph_t *, const char *);
586
587CGRAPH_API char *agstrdup_html(Agraph_t *, const char *);
590CGRAPH_API int aghtmlstr(const char *);
593CGRAPH_API char *agstrbind(Agraph_t *g, const char *);
596
597CGRAPH_API int agstrfree(Agraph_t *, const char *);
598CGRAPH_API char *agcanon(char *str, int html);
599CGRAPH_API char *agstrcanon(char *, char *);
600CGRAPH_API char *agcanonStr(char *str); /* manages its own buf */
602
625// definitions for dynamic string attributes
626
628struct Agattr_s { /* dynamic string attributes */
629 Agrec_t h; /* common data header */
630 Dict_t *dict;
631 char **str;
636struct Agsym_s {
638 char *name; /* attribute's name */
639 char *defval; /* its default value for initialization */
640 int id;
641 unsigned char kind; /* referent object type */
642 unsigned char fixed; /* immutable value */
643 unsigned char print; /* always print */
647 Agrec_t h; /* installed in list of graph recs */
648 struct {
649 Dict_t *n, *e, *g;
651};
653CGRAPH_API Agsym_t *agattr(Agraph_t *g, int kind, char *name,
654 const char *value);
669CGRAPH_API Agsym_t *agattrsym(void *obj, char *name);
671
672CGRAPH_API Agsym_t *agnxtattr(Agraph_t *g, int kind, Agsym_t *attr);
676
677CGRAPH_API int agcopyattr(void *oldobj, void *newobj);
686CGRAPH_API void *agbindrec(void *obj, const char *name, unsigned int recsize,
687 int move_to_front);
691
692CGRAPH_API Agrec_t *aggetrec(void *obj, const char *name, int move_to_front);
694
695CGRAPH_API int agdelrec(void *obj, const char *name);
697
698CGRAPH_API void aginit(Agraph_t *g, int kind, const char *rec_name,
699 int rec_size, int move_to_front);
707CGRAPH_API void agclean(Agraph_t *g, int kind, char *rec_name);
710
712
713CGRAPH_API char *agget(void *obj, char *name);
714CGRAPH_API char *agxget(void *obj, Agsym_t *sym);
715CGRAPH_API int agset(void *obj, char *name, const char *value);
716CGRAPH_API int agxset(void *obj, Agsym_t *sym, const char *value);
717CGRAPH_API int agsafeset(void *obj, char *name, const char *value,
718 const char *def);
721
723
751CGRAPH_API Agraph_t *agsubg(Agraph_t *g, char *name,
752 int cflag); /* constructor */
753CGRAPH_API Agraph_t *agidsubg(Agraph_t *g, IDTYPE id,
754 int cflag); /* constructor */
755CGRAPH_API Agraph_t *agfstsubg(Agraph_t *g);
756CGRAPH_API Agraph_t *agnxtsubg(Agraph_t *subg);
757CGRAPH_API Agraph_t *agparent(Agraph_t *g);
758CGRAPH_API int agdelsubg(Agraph_t *g, Agraph_t *sub); /* could be agclose */
760
784CGRAPH_API int agnnodes(Agraph_t *g);
785CGRAPH_API int agnedges(Agraph_t *g);
786CGRAPH_API int agnsubg(Agraph_t *g);
787CGRAPH_API int agdegree(Agraph_t *g, Agnode_t *n, int in, int out);
788CGRAPH_API int agcountuniqedges(Agraph_t *g, Agnode_t *n, int in, int out);
790
793CGRAPH_API void *agalloc(Agraph_t *g, size_t size);
794CGRAPH_API void *agrealloc(Agraph_t *g, void *ptr, size_t oldsize, size_t size);
795CGRAPH_API void agfree(Agraph_t *g, void *ptr);
796
797/* an engineering compromise is a joy forever */
798CGRAPH_API void aginternalmapclearlocalnames(Agraph_t *g);
799
800#define agnew(g, t) ((t *)agalloc(g, sizeof(t)))
801#define agnnew(g, n, t) ((t *)agalloc(g, (n) * sizeof(t)))
805
806/* support for extra API misuse warnings if available */
807#ifdef __GNUC__
808#define PRINTF_LIKE(index, first) __attribute__((format(printf, index, first)))
809#else
810#define PRINTF_LIKE(index, first) /* nothing */
811#endif
812
814
855typedef enum { AGWARN, AGERR, AGMAX, AGPREV } agerrlevel_t;
856typedef int (*agusererrf)(char *);
858CGRAPH_API char *aglasterr(void);
859CGRAPH_API int agerr(agerrlevel_t level, const char *fmt, ...)
860 PRINTF_LIKE(2, 3);
861CGRAPH_API void agerrorf(const char *fmt, ...) PRINTF_LIKE(1, 2);
862CGRAPH_API void agwarningf(const char *fmt, ...) PRINTF_LIKE(1, 2);
863CGRAPH_API int agerrors(void);
864CGRAPH_API int agreseterrors(void);
867
868#undef PRINTF_LIKE
870
873/* data access macros */
874/* this assumes that e[0] is out and e[1] is inedge, see @ref Agedgepair_s */
875#define AGIN2OUT(inedge) ((inedge) - 1)
876#define AGOUT2IN(outedge) \
877 ((outedge) + 1)
878#define AGOPP(e) ((AGTYPE(e) == AGINEDGE) ? AGIN2OUT(e) : AGOUT2IN(e))
879#define AGMKOUT(e) (AGTYPE(e) == AGOUTEDGE ? (e) : AGIN2OUT(e))
880#define AGMKIN(e) (AGTYPE(e) == AGINEDGE ? (e) : AGOUT2IN(e))
881#define AGTAIL(e) (AGMKIN(e)->node)
882#define AGHEAD(e) (AGMKOUT(e)->node)
883#define AGEQEDGE(e, f) (AGMKOUT(e) == AGMKOUT(f))
884/* These macros are also exposed as functions, so they can be linked against. */
885#define agtail(e) AGTAIL(e)
886#define aghead(e) AGHEAD(e)
887#define agopp(e) \
888 AGOPP(e)
889#define ageqedge(e, f) AGEQEDGE(e, f)
891#define TAILPORT_ID "tailport"
892#define HEADPORT_ID "headport"
897CGRAPH_API extern Agdesc_t Agdirected;
898CGRAPH_API extern Agdesc_t Agstrictdirected;
900CGRAPH_API extern Agdesc_t Agundirected;
901CGRAPH_API extern Agdesc_t Agstrictundirected;
903
909/* this is expedient but a bit slimey because it "knows" that dict entries of
910both nodes and edges are embedded in main graph objects but allocated separately
911in subgraphs */
912#define AGSNMAIN(sn) ((sn) == (&((sn)->node->mainsub)))
913#define EDGEOF(sn, rep) \
914 (AGSNMAIN(sn) \
915 ? ((Agedge_t *)((unsigned char *)(rep) - offsetof(Agedge_t, seq_link))) \
916 : ((Dthold_t *)(rep))->obj)
921
923typedef struct {
924 FILE *outFile;
925 bool doWrite;
926 bool Verbose;
937CGRAPH_API bool graphviz_acyclic(Agraph_t *g,
939 size_t *num_rev);
940
942typedef struct {
943 bool Verbose;
944 bool PrintRemovedEdges;
945 FILE *out;
946 FILE *err;
956CGRAPH_API void graphviz_tred(Agraph_t *g, const graphviz_tred_options_t *opts);
957
959typedef struct {
960 bool Do_fans;
961 int MaxMinlen;
962 int ChainLimit;
971CGRAPH_API void graphviz_unflatten(Agraph_t *g,
973
987CGRAPH_API size_t graphviz_node_induce(Agraph_t *g, Agraph_t *edgeset);
989
990#ifdef __cplusplus
991}
992#endif
static void out(agerrlevel_t level, const char *fmt, va_list args)
Report messages using a user-supplied or default write function.
Definition agerror.c:84
container data types API
#define sub(h, i)
Definition closest.c:65
static FILE * outFile
Definition cvtgxl.c:35
static char * err
Definition delaunay.c:746
#define PRINTF_LIKE(index, first)
Definition error.h:48
static int Verbose
Definition gml2gv.c:22
int agnsubg(Agraph_t *g)
Definition graph.c:174
int agcountuniqedges(Agraph_t *g, Agnode_t *n, int in, int out)
Definition graph.c:208
int agnedges(Agraph_t *g)
Definition graph.c:164
int agdegree(Agraph_t *g, Agnode_t *n, int in, int out)
Definition graph.c:226
int agnnodes(Agraph_t *g)
Definition graph.c:158
void * agalloc(Agraph_t *g, size_t size)
Definition mem.c:19
void agfree(Agraph_t *g, void *ptr)
Definition mem.c:49
void aginternalmapclearlocalnames(Agraph_t *g)
Definition imap.c:167
void * agrealloc(Agraph_t *g, void *ptr, size_t oldsize, size_t size)
Definition mem.c:29
bool graphviz_acyclic(Agraph_t *g, const graphviz_acyclic_options_t *opts, size_t *num_rev)
Definition acyclic.c:86
void graphviz_unflatten(Agraph_t *g, const graphviz_unflatten_options_t *opts)
Definition unflatten.c:56
size_t graphviz_node_induce(Agraph_t *g, Agraph_t *edgeset)
Definition node_induce.c:9
void graphviz_tred(Agraph_t *g, const graphviz_tred_options_t *opts)
programmatic access to tred - transitive reduction
Definition tred.c:181
Agsym_t * agattrsym(void *obj, char *name)
looks up a string attribute for a graph object given as an argument
Definition attr.c:156
Agsym_t * agattr(Agraph_t *g, int kind, char *name, const char *value)
creates or looks up attributes of a graph
Definition attr.c:341
int agset(void *obj, char *name, const char *value)
Definition attr.c:469
Agsym_t * agnxtattr(Agraph_t *g, int kind, Agsym_t *attr)
permits traversing the list of attributes of a given type
Definition attr.c:356
int agxset(void *obj, Agsym_t *sym, const char *value)
Definition attr.c:481
char * agget(void *obj, char *name)
Definition attr.c:442
int agsafeset(void *obj, char *name, const char *value, const char *def)
ensures the given attribute is declared before setting it locally on an object
Definition attr.c:510
char * agxget(void *obj, Agsym_t *sym)
Definition attr.c:458
int agcopyattr(void *oldobj, void *newobj)
copies all of the attributes from one object to another
Definition attr.c:552
int agpopdisc(Agraph_t *g, Agcbdisc_t *disc)
Definition obj.c:212
void agpushdisc(Agraph_t *g, Agcbdisc_t *disc, void *state)
Definition obj.c:201
Agdisc_t AgDefaultDisc
Definition graph.c:278
Agiddisc_t AgIdDisc
Definition id.c:100
Agiodisc_t AgIoDisc
Definition io.c:39
Agedge_t * agedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, char *name, int createflag)
Definition edge.c:260
Agedge_t * agidedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, IDTYPE id, int createflag)
Definition edge.c:238
Agedge_t * agsubedge(Agraph_t *g, Agedge_t *e, int createflag)
Definition edge.c:355
int agdeledge(Agraph_t *g, Agedge_t *arg_e)
Definition edge.c:334
Agedge_t * agnxtin(Agraph_t *g, Agedge_t *e)
Definition edge.c:68
Agedge_t * agfstout(Agraph_t *g, Agnode_t *n)
Definition edge.c:23
Agedge_t * agnxtedge(Agraph_t *g, Agedge_t *e, Agnode_t *n)
Definition edge.c:93
Agedge_t * agnxtout(Agraph_t *g, Agedge_t *e)
Definition edge.c:38
Agedge_t * agfstedge(Agraph_t *g, Agnode_t *n)
Definition edge.c:84
Agedge_t * agfstin(Agraph_t *g, Agnode_t *n)
Definition edge.c:54
agerrlevel_t
Definition cgraph.h:858
int agreseterrors(void)
Definition agerror.c:183
void agwarningf(const char *fmt,...)
Definition agerror.c:173
void agerrorf(const char *fmt,...)
Definition agerror.c:165
agerrlevel_t agseterr(agerrlevel_t)
Definition agerror.c:38
char * aglasterr(void)
Definition agerror.c:44
agusererrf agseterrf(agusererrf)
Definition agerror.c:32
int agerr(agerrlevel_t level, const char *fmt,...)
Definition agerror.c:155
int agerrors(void)
Definition agerror.c:181
int(* agusererrf)(char *)
Definition cgraph.h:859
@ AGWARN
Definition cgraph.h:858
@ AGMAX
Definition cgraph.h:858
@ AGERR
Definition cgraph.h:858
@ AGPREV
Definition cgraph.h:858
void(* agobjupdfn_t)(Agraph_t *g, Agobj_t *obj, void *arg, Agsym_t *sym)
Definition cgraph.h:370
void(* agobjfn_t)(Agraph_t *g, Agobj_t *obj, void *arg)
Definition cgraph.h:369
Agdesc_t Agundirected
undirected
Definition graph.c:275
int agisdirected(Agraph_t *g)
Definition graph.c:179
Agdesc_t Agstrictundirected
strict undirected
Definition graph.c:276
int agclose(Agraph_t *g)
deletes a graph, freeing its associated storage
Definition graph.c:96
int agisstrict(Agraph_t *g)
Definition graph.c:189
int agissimple(Agraph_t *g)
Definition graph.c:194
Agdesc_t Agstrictdirected
strict directed. A strict graph cannot have multi-edges or self-arcs.
Definition graph.c:274
Agraph_t * agmemconcat(Agraph_t *g, const char *cp)
Definition io.c:102
Agraph_t * agconcat(Agraph_t *g, void *chan, Agdisc_t *disc)
merges the file contents with a pre-existing graph
Definition grammar.c:2262
Agraph_t * agmemread(const char *cp)
reads a graph from the input string
Definition io.c:97
Agraph_t * agopen(char *name, Agdesc_t desc, Agdisc_t *disc)
creates a new graph with the given name and kind
Definition graph.c:44
int agisundirected(Agraph_t *g)
Definition graph.c:184
int agwrite(Agraph_t *g, void *chan)
Return 0 on success, EOF on failure.
Definition write.c:708
void agsetfile(const char *)
sets the current file name for subsequent error reporting
Definition scan.c:839
void agreadline(int)
sets input line number for subsequent error reporting
Definition scan.c:835
Agraph_t * agread(void *chan, Agdisc_t *disc)
constructs a new graph
Definition grammar.c:2274
Agdesc_t Agdirected
directed
Definition graph.c:273
Agnode_t * agnode(Agraph_t *g, char *name, int createflag)
Definition node.c:147
int agnodebefore(Agnode_t *u, Agnode_t *v)
Definition node.c:334
Agnode_t * agnxtnode(Agraph_t *g, Agnode_t *n)
Definition node.c:47
Agnode_t * agprvnode(Agraph_t *g, Agnode_t *n)
Definition node.c:62
Agnode_t * agfstnode(Agraph_t *g)
Definition node.c:40
Agnode_t * agsubnode(Agraph_t *g, Agnode_t *n, int createflag)
Definition node.c:261
Agnode_t * agidnode(Agraph_t *g, IDTYPE id, int createflag)
Definition node.c:124
Agnode_t * aglstnode(Agraph_t *g)
Definition node.c:55
int agrelabel_node(Agnode_t *n, char *newname)
Definition node.c:239
int agdelnode(Agraph_t *g, Agnode_t *arg_n)
removes a node from a graph or subgraph.
Definition node.c:197
Agsubnode_t * agsubrep(Agraph_t *g, Agnode_t *n)
Definition edge.c:144
Agraph_t * agraphof(void *obj)
Definition obj.c:184
char * agnameof(void *)
returns a string descriptor for the object.
Definition id.c:158
uint64_t IDTYPE
unique per main graph ID
Definition cgraph.h:73
int agdelete(Agraph_t *g, void *obj)
deletes object. Equivalent to agclose, agdelnode, and agdeledge for obj being a graph,...
Definition obj.c:19
int agcontains(Agraph_t *, void *obj)
returns non-zero if obj is a member of (sub)graph
Definition obj.c:234
int agobjkind(void *obj)
Definition obj.c:253
Agraph_t * agroot(void *obj)
Definition obj.c:167
@ AGOUTEDGE
Definition cgraph.h:207
@ AGEDGE
Definition cgraph.h:207
@ AGNODE
Definition cgraph.h:207
@ AGINEDGE
Definition cgraph.h:207
@ AGRAPH
Definition cgraph.h:207
Agrec_t * aggetrec(void *obj, const char *name, int move_to_front)
find record in circular list and do optional move-to-front and lock
Definition rec.c:40
void aginit(Agraph_t *g, int kind, const char *rec_name, int rec_size, int move_to_front)
attach new records to objects of specified kind
Definition rec.c:169
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
Definition rec.c:88
void agclean(Agraph_t *g, int kind, char *rec_name)
calls agdelrec for all objects of the same class in an entire graph
Definition rec.c:201
int agdelrec(void *obj, const char *name)
deletes a named record from one object
Definition rec.c:136
int aghtmlstr(const char *)
Definition refstr.c:163
int agstrfree(Agraph_t *, const char *)
Definition refstr.c:138
char * agstrcanon(char *, char *)
Definition write.c:207
char * agstrdup(Agraph_t *, const char *)
returns a pointer to a reference-counted copy of the argument string, creating one if necessary
Definition refstr.c:130
char * agcanon(char *str, int html)
Definition write.c:250
char * agstrbind(Agraph_t *g, const char *)
Definition refstr.c:95
char * agcanonStr(char *str)
Definition write.c:237
char * agstrdup_html(Agraph_t *, const char *)
Definition refstr.c:134
Agraph_t * agparent(Agraph_t *g)
Definition subg.c:90
Agraph_t * agidsubg(Agraph_t *g, IDTYPE id, int cflag)
Definition subg.c:48
Agraph_t * agfstsubg(Agraph_t *g)
Definition subg.c:77
Agraph_t * agnxtsubg(Agraph_t *subg)
Definition subg.c:82
Agraph_t * agsubg(Agraph_t *g, char *name, int cflag)
Definition subg.c:57
int agdelsubg(Agraph_t *g, Agraph_t *sub)
Definition subg.c:98
static uint64_t id
Definition gv2gml.c:42
static opts_t opts
Definition gvgen.c:394
static Agdesc_t kind
Definition gvpack.cpp:88
static lexstate_t state
Definition htmllex.c:61
agxbuf * str
Definition htmlparse.c:97
string attribute container
Definition cgraph.h:631
char ** str
the attribute string values indexed by Agsym_s.id
Definition cgraph.h:634
Dict_t * dict
shared dict of Agsym_s to interpret Agattr_s.str
Definition cgraph.h:633
Agrec_t h
Definition cgraph.h:632
client event callbacks, used in Agcbstack_s
Definition cgraph.h:388
agobjupdfn_t mod
Definition cgraph.h:391
agobjfn_t ins
Definition cgraph.h:390
struct Agcbdisc_s::@64 edge
struct Agcbdisc_s::@64 graph
struct Agcbdisc_s::@64 node
agobjfn_t del
Definition cgraph.h:392
object event callbacks
Definition cgraph.h:399
void * state
Definition cgraph.h:401
Agcbdisc_t * f
Definition cgraph.h:400
Agcbstack_t * prev
Definition cgraph.h:402
shared resources for Agraph_s
Definition cgraph.h:411
Dict_t * lookup_by_id[3]
Definition cgraph.h:418
Agdisc_t disc
Definition cgraph.h:412
Agdstate_t state
Definition cgraph.h:413
Dict_t * strdict
Definition cgraph.h:414
Dict_t * lookup_by_name[3]
Definition cgraph.h:417
Agcbstack_t * cb
Definition cgraph.h:416
uint64_t seq[3]
Definition cgraph.h:415
Dict_t * n
Definition cgraph.h:652
Dict_t * e
Definition cgraph.h:652
Dict_t * g
Definition cgraph.h:652
struct Agdatadict_s::@65 dict
Agrec_t h
< set of dictionaries per graph
Definition cgraph.h:650
graph descriptor
Definition cgraph.h:284
unsigned has_attrs
Definition cgraph.h:290
unsigned maingraph
Definition cgraph.h:288
unsigned no_loop
Definition cgraph.h:287
unsigned strict
Definition cgraph.h:286
unsigned no_write
Definition cgraph.h:289
unsigned has_cmpnd
Definition cgraph.h:291
unsigned directed
Definition cgraph.h:285
user's discipline
Definition cgraph.h:337
Agiddisc_t * id
Definition cgraph.h:338
Agiodisc_t * io
Definition cgraph.h:339
client state (closures)
Definition cgraph.h:363
void * id
Definition cgraph.h:364
Dtlink_t seq_link
Definition cgraph.h:271
Agnode_t * node
Definition cgraph.h:272
Agobj_t base
Definition cgraph.h:269
Dtlink_t id_link
Definition cgraph.h:270
Agedge_t in
Definition cgraph.h:276
Agedge_t out
Definition cgraph.h:276
object ID allocator discipline
Definition cgraph.h:316
long(* map)(void *state, int objtype, char *str, IDTYPE *id, int createflag)
Definition cgraph.h:318
void(* idregister)(void *state, int objtype, void *obj)
Definition cgraph.h:323
void(* close)(void *state)
Definition cgraph.h:322
void(* free)(void *state, int objtype, IDTYPE id)
Definition cgraph.h:320
long(* alloc)(void *state, int objtype, IDTYPE id)
Definition cgraph.h:319
IO services.
Definition cgraph.h:327
int(* afread)(void *chan, char *buf, int bufsize)
Definition cgraph.h:328
int(* flush)(void *chan)
Definition cgraph.h:330
int(* putstr)(void *chan, const char *str)
Definition cgraph.h:329
Agsubnode_t mainsub
Definition cgraph.h:262
Agraph_t * root
Definition cgraph.h:261
Agobj_t base
Definition cgraph.h:260
a generic header of Agraph_s, Agnode_s and Agedge_s
Definition cgraph.h:210
Agrec_t * data
stores programmer-defined data, access with AGDATA
Definition cgraph.h:212
Agtag_t tag
access with AGTAG
Definition cgraph.h:211
graph or subgraph
Definition cgraph.h:425
struct graphviz_node_set * n_id
the node set indexed by ID
Definition cgraph.h:431
Dict_t * g_seq
Definition cgraph.h:433
Agraph_t * root
subgraphs - ancestors
Definition cgraph.h:434
Dtlink_t seq_link
Definition cgraph.h:428
Dict_t * g_id
subgraphs - descendants
Definition cgraph.h:433
Agobj_t base
Definition cgraph.h:426
Dict_t * e_seq
Definition cgraph.h:432
Dict_t * n_seq
the node set in sequence
Definition cgraph.h:430
Agclos_t * clos
shared resources
Definition cgraph.h:435
Agraph_t * parent
Definition cgraph.h:434
Agdesc_t desc
Definition cgraph.h:427
Dtlink_t id_link
Definition cgraph.h:429
Dict_t * e_id
holders for edge sets
Definition cgraph.h:432
implementation of Agrec_t
Definition cgraph.h:172
Agrec_t * next
circular linked list of records
Definition cgraph.h:174
char * name
Definition cgraph.h:173
This is the node struct allocated per graph (or subgraph).
Definition cgraph.h:251
Dtlink_t * out_seq
Definition cgraph.h:256
Dtlink_t * out_id
Definition cgraph.h:255
Dtlink_t seq_link
Definition cgraph.h:252
Dtlink_t * in_id
Definition cgraph.h:255
Dtlink_t id_link
Definition cgraph.h:253
Agnode_t * node
Definition cgraph.h:254
Dtlink_t * in_seq
Definition cgraph.h:256
string attribute descriptor symbol in Agattr_s.dict
Definition cgraph.h:639
Dtlink_t link
Definition cgraph.h:640
char * name
Definition cgraph.h:641
unsigned char kind
Definition cgraph.h:644
int id
index in Agattr_s.str
Definition cgraph.h:643
unsigned char fixed
Definition cgraph.h:645
char * defval
Definition cgraph.h:642
unsigned char print
Definition cgraph.h:646
tag in Agobj_s for graphs, nodes, and edges.
Definition cgraph.h:197
unsigned attrwf
Definition cgraph.h:201
unsigned objtype
access with AGTYPE
Definition cgraph.h:199
unsigned seq
Definition cgraph.h:202
unsigned mtflock
move-to-front lock, guards Agobj_s::data
Definition cgraph.h:200
IDTYPE id
Definition cgraph.h:203
Definition cdt.h:104
options for passing to graphviz_acyclic
Definition cgraph.h:928
options for passing to graphviz_tred
Definition cgraph.h:947
options for passing to graphviz_unflatten
Definition cgraph.h:964