Graphviz 13.0.0~dev.20250121.0651
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 void (*free)(void *state, int objtype, IDTYPE id);
317 char *(*print)(void *state, int objtype, IDTYPE id);
318 void (*close)(void *state);
319 void (*idregister)(void *state, int objtype, void *obj);
323struct Agiodisc_s {
324 int (*afread)(void *chan, char *buf, int bufsize);
325 int (*putstr)(void *chan, const char *str);
326 int (*flush)(void *chan); /* sync */
327 /* error messages? */
333struct Agdisc_s {
334 Agiddisc_t *id;
335 Agiodisc_t *io;
338/* default resource disciplines */
339
340CGRAPH_API extern Agiddisc_t AgIdDisc;
341CGRAPH_API extern Agiodisc_t AgIoDisc;
342
343CGRAPH_API extern Agdisc_t AgDefaultDisc;
345
359struct Agdstate_s {
360 void *id;
361 /* IO must be initialized and finalized outside Cgraph,
362 * and channels (FILES) are passed as void* arguments. */
364
365typedef void (*agobjfn_t)(Agraph_t *g, Agobj_t *obj, void *arg);
366typedef void (*agobjupdfn_t)(Agraph_t *g, Agobj_t *obj, void *arg,
367 Agsym_t *sym);
384struct Agcbdisc_s {
385 struct {
395struct Agcbstack_s {
396 Agcbdisc_t *f; /* methods */
397 void *state; /* closure */
398 Agcbstack_t *prev; /* kept in a stack, unlike other disciplines */
401CGRAPH_API void agpushdisc(Agraph_t *g, Agcbdisc_t *disc, void *state);
402CGRAPH_API int agpopdisc(Agraph_t *g, Agcbdisc_t *disc);
403
405
407struct Agclos_s {
408 Agdisc_t disc; /* resource discipline functions */
409 Agdstate_t state; /* resource closures */
410 void *strdict;
411 uint64_t seq[3]; /* local object sequence number counter */
412 Agcbstack_t *cb; /* user and system callback function stacks */
418struct graphviz_node_set;
419
421struct Agraph_s {
453CGRAPH_API int agclose(Agraph_t *g);
455CGRAPH_API Agraph_t *agread(void *chan, Agdisc_t *disc);
457
458CGRAPH_API Agraph_t *agmemread(const char *cp);
460
461CGRAPH_API Agraph_t *agmemconcat(Agraph_t *g, const char *cp);
462
463CGRAPH_API void agsetfile(const char *);
465
466CGRAPH_API Agraph_t *agconcat(Agraph_t *g, void *chan, Agdisc_t *disc);
475CGRAPH_API int agwrite(Agraph_t *g, void *chan);
476CGRAPH_API int agisdirected(Agraph_t *g);
477CGRAPH_API int agisundirected(Agraph_t *g);
478CGRAPH_API int agisstrict(Agraph_t *g);
479CGRAPH_API int agissimple(Agraph_t *g);
481
484CGRAPH_API Agnode_t *agnode(Agraph_t *g, char *name, int createflag);
485CGRAPH_API Agnode_t *agidnode(Agraph_t *g, IDTYPE id, int createflag);
486CGRAPH_API Agnode_t *agsubnode(Agraph_t *g, Agnode_t *n, int createflag);
487CGRAPH_API Agnode_t *agfstnode(Agraph_t *g);
488CGRAPH_API Agnode_t *agnxtnode(Agraph_t *g, Agnode_t *n);
489CGRAPH_API Agnode_t *aglstnode(Agraph_t *g);
490CGRAPH_API Agnode_t *agprvnode(Agraph_t *g, Agnode_t *n);
491
492CGRAPH_API Agsubnode_t *agsubrep(Agraph_t *g, Agnode_t *n);
493CGRAPH_API int agnodebefore(Agnode_t *u, Agnode_t *v); /* we have no shame */
494CGRAPH_API int agdelnode(Agraph_t *g, Agnode_t *arg_n);
496CGRAPH_API int agrelabel_node(Agnode_t *n, char *newname);
498
520CGRAPH_API Agedge_t *agedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, char *name,
521 int createflag);
522CGRAPH_API Agedge_t *agidedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, IDTYPE id,
523 int createflag);
524CGRAPH_API Agedge_t *agsubedge(Agraph_t *g, Agedge_t *e, int createflag);
525CGRAPH_API Agedge_t *agfstin(Agraph_t *g, Agnode_t *n);
526CGRAPH_API Agedge_t *agnxtin(Agraph_t *g, Agedge_t *e);
527CGRAPH_API Agedge_t *agfstout(Agraph_t *g, Agnode_t *n);
528CGRAPH_API Agedge_t *agnxtout(Agraph_t *g, Agedge_t *e);
529CGRAPH_API Agedge_t *agfstedge(Agraph_t *g, Agnode_t *n);
530CGRAPH_API Agedge_t *agnxtedge(Agraph_t *g, Agedge_t *e, Agnode_t *n);
531CGRAPH_API int agdeledge(Agraph_t *g, Agedge_t *arg_e);
533
536
537// Generic object (graphs, nodes and edges) functions
538
539CGRAPH_API Agraph_t *agraphof(void *obj);
540CGRAPH_API Agraph_t *agroot(void *obj);
543
544CGRAPH_API int agcontains(Agraph_t *, void *obj);
546
547CGRAPH_API char *agnameof(void *);
549
550CGRAPH_API int agdelete(Agraph_t *g, void *obj);
557CGRAPH_API int agobjkind(void *obj);
561
584CGRAPH_API char *agstrdup(Agraph_t *, const char *);
588
589CGRAPH_API char *agstrdup_html(Agraph_t *, const char *);
592CGRAPH_API int aghtmlstr(const char *);
595CGRAPH_API char *agstrbind(Agraph_t *g, const char *);
598
599CGRAPH_API int agstrfree(Agraph_t *, const char *, bool is_html);
601CGRAPH_API char *agstrcanon(char *, char *);
602CGRAPH_API char *agcanonStr(char *str); /* manages its own buf */
604
627// definitions for dynamic string attributes
628
630struct Agattr_s { /* dynamic string attributes */
631 Agrec_t h; /* common data header */
632 Dict_t *dict;
633 char **str;
638struct Agsym_s {
640 char *name; /* attribute's name */
641 char *defval; /* its default value for initialization */
642 int id;
643 unsigned char kind; /* referent object type */
644 unsigned char fixed; /* immutable value */
645 unsigned char print; /* always print */
649 Agrec_t h; /* installed in list of graph recs */
650 struct {
651 Dict_t *n, *e, *g;
653};
655CGRAPH_API Agsym_t *agattr(Agraph_t *g, int kind, char *name,
656 const char *value);
671CGRAPH_API Agsym_t *agattr_html(Agraph_t *g, int kind, char *name,
672 const char *value);
674
675CGRAPH_API Agsym_t *agattrsym(void *obj, char *name);
677
678CGRAPH_API Agsym_t *agnxtattr(Agraph_t *g, int kind, Agsym_t *attr);
682
683CGRAPH_API int agcopyattr(void *oldobj, void *newobj);
692CGRAPH_API void *agbindrec(void *obj, const char *name, unsigned int recsize,
693 int move_to_front);
697
698CGRAPH_API Agrec_t *aggetrec(void *obj, const char *name, int move_to_front);
700
701CGRAPH_API int agdelrec(void *obj, const char *name);
703
704CGRAPH_API void aginit(Agraph_t *g, int kind, const char *rec_name,
705 int rec_size, int move_to_front);
713CGRAPH_API void agclean(Agraph_t *g, int kind, char *rec_name);
716
718
719CGRAPH_API char *agget(void *obj, char *name);
720CGRAPH_API char *agxget(void *obj, Agsym_t *sym);
721CGRAPH_API int agset(void *obj, char *name, const char *value);
722CGRAPH_API int agxset(void *obj, Agsym_t *sym, const char *value);
723CGRAPH_API int agxset_html(void *obj, Agsym_t *sym, const char *value);
724CGRAPH_API int agsafeset(void *obj, char *name, const char *value,
725 const char *def);
728
730
758CGRAPH_API Agraph_t *agsubg(Agraph_t *g, char *name,
759 int cflag); /* constructor */
760CGRAPH_API Agraph_t *agidsubg(Agraph_t *g, IDTYPE id);
761CGRAPH_API Agraph_t *agfstsubg(Agraph_t *g);
762CGRAPH_API Agraph_t *agnxtsubg(Agraph_t *subg);
763CGRAPH_API Agraph_t *agparent(Agraph_t *g);
764CGRAPH_API int agdelsubg(Agraph_t *g, Agraph_t *sub); /* could be agclose */
766
790CGRAPH_API int agnnodes(Agraph_t *g);
791CGRAPH_API int agnedges(Agraph_t *g);
792CGRAPH_API int agnsubg(Agraph_t *g);
793CGRAPH_API int agdegree(Agraph_t *g, Agnode_t *n, int in, int out);
794CGRAPH_API int agcountuniqedges(Agraph_t *g, Agnode_t *n, int in, int out);
796
799/* an engineering compromise is a joy forever */
800CGRAPH_API void aginternalmapclearlocalnames(Agraph_t *g);
802
804
805/* support for extra API misuse warnings if available */
806#ifdef __GNUC__
807#define PRINTF_LIKE(index, first) __attribute__((format(printf, index, first)))
808#else
809#define PRINTF_LIKE(index, first) /* nothing */
810#endif
811
813
854typedef enum { AGWARN, AGERR, AGMAX, AGPREV } agerrlevel_t;
855typedef int (*agusererrf)(char *);
857CGRAPH_API char *aglasterr(void);
858CGRAPH_API int agerr(agerrlevel_t level, const char *fmt, ...)
859 PRINTF_LIKE(2, 3);
860CGRAPH_API void agerrorf(const char *fmt, ...) PRINTF_LIKE(1, 2);
861CGRAPH_API void agwarningf(const char *fmt, ...) PRINTF_LIKE(1, 2);
862CGRAPH_API int agerrors(void);
863CGRAPH_API int agreseterrors(void);
866
867#undef PRINTF_LIKE
869
872/* data access macros */
873/* this assumes that e[0] is out and e[1] is inedge, see @ref Agedgepair_s */
874#define AGIN2OUT(inedge) ((inedge) - 1)
875#define AGOUT2IN(outedge) \
876 ((outedge) + 1)
877#define AGOPP(e) ((AGTYPE(e) == AGINEDGE) ? AGIN2OUT(e) : AGOUT2IN(e))
878#define AGMKOUT(e) (AGTYPE(e) == AGOUTEDGE ? (e) : AGIN2OUT(e))
879#define AGMKIN(e) (AGTYPE(e) == AGINEDGE ? (e) : AGOUT2IN(e))
880#define AGTAIL(e) (AGMKIN(e)->node)
881#define AGHEAD(e) (AGMKOUT(e)->node)
882#define AGEQEDGE(e, f) (AGMKOUT(e) == AGMKOUT(f))
883/* These macros are also exposed as functions, so they can be linked against. */
884#define agtail(e) AGTAIL(e)
885#define aghead(e) AGHEAD(e)
886#define agopp(e) \
887 AGOPP(e)
888#define ageqedge(e, f) AGEQEDGE(e, f)
890#define TAILPORT_ID "tailport"
891#define HEADPORT_ID "headport"
896CGRAPH_API extern Agdesc_t Agdirected;
897CGRAPH_API extern Agdesc_t Agstrictdirected;
899CGRAPH_API extern Agdesc_t Agundirected;
900CGRAPH_API extern Agdesc_t Agstrictundirected;
902
908/* this is expedient but a bit slimey because it "knows" that dict entries of
909both nodes and edges are embedded in main graph objects but allocated separately
910in subgraphs */
911#define AGSNMAIN(sn) ((sn) == (&((sn)->node->mainsub)))
912#define EDGEOF(sn, rep) \
913 (AGSNMAIN(sn) \
914 ? ((Agedge_t *)((unsigned char *)(rep) - offsetof(Agedge_t, seq_link))) \
915 : ((Dthold_t *)(rep))->obj)
920
922typedef struct {
923 FILE *outFile;
924 bool doWrite;
925 bool Verbose;
936CGRAPH_API bool graphviz_acyclic(Agraph_t *g,
938 size_t *num_rev);
939
941typedef struct {
942 bool Verbose;
943 bool PrintRemovedEdges;
944 FILE *out;
945 FILE *err;
955CGRAPH_API void graphviz_tred(Agraph_t *g, const graphviz_tred_options_t *opts);
956
958typedef struct {
959 bool Do_fans;
960 int MaxMinlen;
961 int ChainLimit;
970CGRAPH_API void graphviz_unflatten(Agraph_t *g,
972
986CGRAPH_API size_t graphviz_node_induce(Agraph_t *g, Agraph_t *edgeset);
988
989#ifdef __cplusplus
990}
991#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:67
static FILE * outFile
Definition cvtgxl.c:35
static char * err
Definition delaunay.c:696
#define PRINTF_LIKE(index, first)
Definition error.h:48
static Dtdisc_t disc
Definition exparse.y:209
static bool Verbose
Definition gml2gv.c:23
int agnsubg(Agraph_t *g)
Definition graph.c:181
int agcountuniqedges(Agraph_t *g, Agnode_t *n, int in, int out)
Definition graph.c:215
int agnedges(Agraph_t *g)
Definition graph.c:171
int agdegree(Agraph_t *g, Agnode_t *n, int in, int out)
Definition graph.c:233
int agnnodes(Agraph_t *g)
Definition graph.c:165
void aginternalmapclearlocalnames(Agraph_t *g)
Definition imap.c:165
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:183
Agsym_t * agattrsym(void *obj, char *name)
looks up a string attribute for a graph object given as an argument
Definition attr.c:158
Agsym_t * agattr(Agraph_t *g, int kind, char *name, const char *value)
creates or looks up attributes of a graph
Definition attr.c:371
int agset(void *obj, char *name, const char *value)
Definition attr.c:492
Agsym_t * agnxtattr(Agraph_t *g, int kind, Agsym_t *attr)
permits traversing the list of attributes of a given type
Definition attr.c:379
int agxset(void *obj, Agsym_t *sym, const char *value)
Definition attr.c:532
int agxset_html(void *obj, Agsym_t *sym, const char *value)
Definition attr.c:536
char * agget(void *obj, char *name)
Definition attr.c:465
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:540
char * agxget(void *obj, Agsym_t *sym)
Definition attr.c:481
int agcopyattr(void *oldobj, void *newobj)
copies all of the attributes from one object to another
Definition attr.c:582
Agsym_t * agattr_html(Agraph_t *g, int kind, char *name, const char *value)
agattr, but creates HTML-like values
Definition attr.c:375
int agpopdisc(Agraph_t *g, Agcbdisc_t *disc)
Definition obj.c:211
void agpushdisc(Agraph_t *g, Agcbdisc_t *disc, void *state)
Definition obj.c:202
Agdisc_t AgDefaultDisc
Definition graph.c:285
Agiddisc_t AgIdDisc
Definition id.c:91
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:256
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:351
int agdeledge(Agraph_t *g, Agedge_t *arg_e)
Definition edge.c:330
Agedge_t * agnxtin(Agraph_t *g, Agedge_t *e)
Definition edge.c:69
Agedge_t * agfstout(Agraph_t *g, Agnode_t *n)
Definition edge.c:24
Agedge_t * agnxtedge(Agraph_t *g, Agedge_t *e, Agnode_t *n)
Definition edge.c:94
Agedge_t * agnxtout(Agraph_t *g, Agedge_t *e)
Definition edge.c:39
Agedge_t * agfstedge(Agraph_t *g, Agnode_t *n)
Definition edge.c:85
Agedge_t * agfstin(Agraph_t *g, Agnode_t *n)
Definition edge.c:55
agerrlevel_t
Definition cgraph.h:857
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:858
@ AGWARN
Definition cgraph.h:857
@ AGMAX
Definition cgraph.h:857
@ AGERR
Definition cgraph.h:857
@ AGPREV
Definition cgraph.h:857
void(* agobjupdfn_t)(Agraph_t *g, Agobj_t *obj, void *arg, Agsym_t *sym)
Definition cgraph.h:369
void(* agobjfn_t)(Agraph_t *g, Agobj_t *obj, void *arg)
Definition cgraph.h:368
Agdesc_t Agundirected
undirected
Definition graph.c:282
int agisdirected(Agraph_t *g)
Definition graph.c:186
Agdesc_t Agstrictundirected
strict undirected
Definition graph.c:283
int agclose(Agraph_t *g)
deletes a graph, freeing its associated storage
Definition graph.c:99
int agisstrict(Agraph_t *g)
Definition graph.c:196
int agissimple(Agraph_t *g)
Definition graph.c:201
Agdesc_t Agstrictdirected
strict directed. A strict graph cannot have multi-edges or self-arcs.
Definition graph.c:281
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:2288
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:191
int agwrite(Agraph_t *g, void *chan)
Return 0 on success, EOF on failure.
Definition write.c:693
void agsetfile(const char *)
sets the current file name for subsequent error reporting
Definition scan.c:2415
Agraph_t * agread(void *chan, Agdisc_t *disc)
constructs a new graph
Definition grammar.c:2300
Agdesc_t Agdirected
directed
Definition graph.c:280
Agnode_t * agnode(Agraph_t *g, char *name, int createflag)
Definition node.c:140
int agnodebefore(Agnode_t *u, Agnode_t *v)
Definition node.c:327
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:254
Agnode_t * agidnode(Agraph_t *g, IDTYPE id, int createflag)
Definition node.c:122
Agnode_t * aglstnode(Agraph_t *g)
Definition node.c:55
int agrelabel_node(Agnode_t *n, char *newname)
Definition node.c:232
int agdelnode(Agraph_t *g, Agnode_t *arg_n)
removes a node from a graph or subgraph.
Definition node.c:190
Agsubnode_t * agsubrep(Agraph_t *g, Agnode_t *n)
Definition edge.c:145
Agraph_t * agraphof(void *obj)
Definition obj.c:185
char * agnameof(void *)
returns a string descriptor for the object.
Definition id.c:143
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:20
int agcontains(Agraph_t *, void *obj)
returns non-zero if obj is a member of (sub)graph
Definition obj.c:233
int agobjkind(void *obj)
Definition obj.c:252
Agraph_t * agroot(void *obj)
Definition obj.c:168
@ 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:41
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:170
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:89
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:202
int agdelrec(void *obj, const char *name)
deletes a named record from one object
Definition rec.c:137
int aghtmlstr(const char *)
Definition refstr.c:401
char * agstrcanon(char *, char *)
Definition write.c:219
int agstrfree(Agraph_t *, const char *, bool is_html)
Definition refstr.c:378
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:370
char * agstrbind(Agraph_t *g, const char *)
Definition refstr.c:337
char * agcanonStr(char *str)
Definition write.c:249
char * agstrdup_html(Agraph_t *, const char *)
Definition refstr.c:374
Agraph_t * agparent(Agraph_t *g)
Definition subg.c:88
Agraph_t * agidsubg(Agraph_t *g, IDTYPE id)
constructor
Definition subg.c:49
Agraph_t * agfstsubg(Agraph_t *g)
Definition subg.c:75
Agraph_t * agnxtsubg(Agraph_t *subg)
Definition subg.c:80
Agraph_t * agsubg(Agraph_t *g, char *name, int cflag)
Definition subg.c:55
int agdelsubg(Agraph_t *g, Agraph_t *sub)
Definition subg.c:96
static uint64_t id
Definition gv2gml.c:42
static opts_t opts
Definition gvgen.c:394
textitem scanner parser str
Definition htmlparse.y:224
string attribute container
Definition cgraph.h:633
char ** str
the attribute string values indexed by Agsym_s.id
Definition cgraph.h:636
Dict_t * dict
shared dict of Agsym_s to interpret Agattr_s.str
Definition cgraph.h:635
Agrec_t h
Definition cgraph.h:634
client event callbacks, used in Agcbstack_s
Definition cgraph.h:387
agobjupdfn_t mod
Definition cgraph.h:390
agobjfn_t ins
Definition cgraph.h:389
struct Agcbdisc_s::@63 edge
struct Agcbdisc_s::@63 graph
struct Agcbdisc_s::@63 node
agobjfn_t del
Definition cgraph.h:391
object event callbacks
Definition cgraph.h:398
void * state
Definition cgraph.h:400
Agcbdisc_t * f
Definition cgraph.h:399
Agcbstack_t * prev
Definition cgraph.h:401
shared resources for Agraph_s
Definition cgraph.h:410
Dict_t * lookup_by_id[3]
Definition cgraph.h:417
Agdisc_t disc
Definition cgraph.h:411
Agdstate_t state
Definition cgraph.h:412
Dict_t * lookup_by_name[3]
Definition cgraph.h:416
Agcbstack_t * cb
Definition cgraph.h:415
void * strdict
shared string dict
Definition cgraph.h:413
uint64_t seq[3]
Definition cgraph.h:414
Dict_t * n
Definition cgraph.h:654
Dict_t * e
Definition cgraph.h:654
struct Agdatadict_s::@64 dict
Dict_t * g
Definition cgraph.h:654
Agrec_t h
< set of dictionaries per graph
Definition cgraph.h:652
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:336
Agiddisc_t * id
Definition cgraph.h:337
Agiodisc_t * io
Definition cgraph.h:338
client state (closures)
Definition cgraph.h:362
void * id
Definition cgraph.h:363
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:322
void(* close)(void *state)
Definition cgraph.h:321
void(* free)(void *state, int objtype, IDTYPE id)
Definition cgraph.h:319
IO services.
Definition cgraph.h:326
int(* afread)(void *chan, char *buf, int bufsize)
Definition cgraph.h:327
int(* flush)(void *chan)
Definition cgraph.h:329
int(* putstr)(void *chan, const char *str)
Definition cgraph.h:328
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:424
struct graphviz_node_set * n_id
the node set indexed by ID
Definition cgraph.h:430
Dict_t * g_seq
Definition cgraph.h:432
Agraph_t * root
subgraphs - ancestors
Definition cgraph.h:438
Dtlink_t seq_link
Definition cgraph.h:427
Dict_t * g_id
Definition cgraph.h:432
Agobj_t base
Definition cgraph.h:425
Dict_t * e_seq
Definition cgraph.h:431
Dict_t * n_seq
the node set in sequence
Definition cgraph.h:429
Agclos_t * clos
shared resources
Definition cgraph.h:439
Agraph_t * parent
Definition cgraph.h:438
Agdesc_t desc
Definition cgraph.h:426
Dtlink_t id_link
Definition cgraph.h:428
Dict_t * e_id
holders for edge sets
Definition cgraph.h:431
void * g_seq2
Definition cgraph.h:437
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:641
Dtlink_t link
Definition cgraph.h:642
char * name
Definition cgraph.h:643
unsigned char kind
Definition cgraph.h:646
int id
index in Agattr_s.str
Definition cgraph.h:645
unsigned char fixed
Definition cgraph.h:647
char * defval
Definition cgraph.h:644
unsigned char print
Definition cgraph.h:648
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:100
options for passing to graphviz_acyclic
Definition cgraph.h:927
options for passing to graphviz_tred
Definition cgraph.h:946
options for passing to graphviz_unflatten
Definition cgraph.h:963