Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches

symbols, and records More...

Collaboration diagram for attributes:

Modules

 records
 These records are attached by client programs dynamically at runtime.
 

Files

file  attr.c
 implementation of dynamic attributes
 

Data Structures

struct  Agattr_s
 string attribute container More...
 
struct  Agsym_s
 string attribute descriptor symbol in Agattr_s.dict More...
 
struct  Agdatadict_s
 

Functions

Agdatadict_tagdatadict (Agraph_t *g, bool cflag)
 
Agattr_tagattrrec (void *obj)
 
void agraphattr_init (Agraph_t *g)
 
int agraphattr_delete (Agraph_t *g)
 
void agnodeattr_init (Agraph_t *g, Agnode_t *n)
 
void agnodeattr_delete (Agnode_t *n)
 
void agedgeattr_init (Agraph_t *g, Agedge_t *e)
 
void agedgeattr_delete (Agedge_t *e)
 
Agsym_tagattr (Agraph_t *g, int kind, char *name, const char *value)
 creates or looks up attributes of a graph
 
Agsym_tagattrsym (void *obj, char *name)
 looks up a string attribute for a graph object given as an argument
 
Agsym_tagnxtattr (Agraph_t *g, int kind, Agsym_t *attr)
 permits traversing the list of attributes of a given type
 
int agcopyattr (void *oldobj, void *newobj)
 copies all of the attributes from one object to another
 
char * agget (void *obj, char *name)
 
char * agxget (void *obj, Agsym_t *sym)
 
int agset (void *obj, char *name, const char *value)
 
int agxset (void *obj, Agsym_t *sym, const char *value)
 
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
 

Detailed Description

Programmer-defined values may be dynamically attached to graphs, subgraphs, nodes, and edges. Such values are either character string data (see agattr) (for I/O) or uninterpreted binary records (for implementing algorithms efficiently).

String attributes are handled automatically in reading and writing graph files. A string attribute is identified by name and by an internal symbol table entry (Agsym_t) created by Libcgraph. Attributes of nodes, edges, and graphs (with their subgraphs) have separate namespaces. The contents of an Agsym_t have a char* name for the attribute's name, a char* defval field for the attribute's default value, and an int id field containing the index of the attribute's specific value for an object in the object's array of attribute values.

Function Documentation

◆ agattr()

Agsym_t * agattr ( Agraph_t g,
int  kind,
char *  name,
const char *  value 
)
Parameters
ggraph. When is NULL, the default is set for all graphs created subsequently.
kindmay be AGRAPH, AGNODE, or AGEDGE.
valuedefault value. When is (char*)0, the request is to search for an existing attribute of the given kind and name.

If the attribute already exists, its default for creating new objects is set to the given value; if it does not exist, a new attribute is created with the given default value, and the default is applied to all pre-existing objects of the given kind

Definition at line 338 of file attr.c.

References agopen(), getattr(), ProtoDesc, ProtoGraph, and setattr().

Referenced by addRevEdge(), agedgeattr(), agnodeattr(), agraphattr(), agsafeset(), attach_edge_colors(), attached_clustering(), attrstmt(), attrstmt(), bindattrs(), bindattrs(), bindedgeattr(), cloneDfltAttrs(), cloneGraph(), cloneGraph(), clust_in_layer(), color(), constrainY(), copy_attr(), copyAttr(), copyAttr(), deselect_all(), doApply(), dot_sameports(), Dot_SetClusterColor(), dotneato_args_initialize(), emit_graph(), export_dot(), fdp_init_graph(), fdp_init_node_edge(), fdp_initParams(), get_checkbox_widget_to_attribute(), get_color_button_widget_to_attribute(), get_combobox_widget_to_attribute(), get_scalebtn_widget_to_attribute(), get_spinbtn_widget_to_attribute(), get_text_widget_to_attribute(), getAttrBool(), getAttrFloat(), getAttrInt(), getAttrStr(), getDfltAttr(), getv(), getv(), getval(), global_def(), graph_init(), graphRecord(), gvContext(), gvContextPlugins(), gvplugin_graph(), Import_coord_clusters_from_dot(), Import_dot_splines(), init_info(), init_nop(), initGraphAttrs(), initialPositions(), layout(), loadGraph(), lookup(), makeDotGraph(), makeGraphData(), mkport(), mkport(), neatoModel(), nxtAttr(), on_attrAddBtn_clicked(), patchwork_init_graph(), plot_dot_map(), posOf(), post(), pre(), safe_dcl(), scan_graph_mode(), select_edge(), select_node(), set_visibility(), setattr(), setAttr(), setDfltAttr(), setedgeattributes(), setgraphattributes(), setnodeattributes(), setState(), setv(), setv(), SparseMatrix_import_dot(), twopi_layout(), update_graph_params(), updateRecord(), write_hdr(), and writeHdr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agattrrec()

Agattr_t * agattrrec ( void *  obj)

Definition at line 229 of file attr.c.

References AgDataRecName, and aggetrec().

Referenced by addattr(), agattrsym(), agedgeattr_delete(), agedgeattr_init(), agget(), agnodeattr_delete(), agnodeattr_init(), agraphattr_delete(), agxget(), agxset(), irrelevant_subgraph(), not_default_attrs(), write_nondefault_attrs(), and writeNondefaultAttr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agattrsym()

Agsym_t * agattrsym ( void *  obj,
char *  name 
)

Definition at line 156 of file attr.c.

References agattrrec(), agdictsym(), and NULL.

Referenced by agcopyattr(), agget(), agset(), copyAttr(), getval(), lookup(), post(), and setattr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agcopyattr()

int agcopyattr ( void *  oldobj,
void *  newobj 
)
Returns
fails and returns non-zero if argument objects are different kinds, or if all of the attributes of the source object have not been declared for the target object

Definition at line 549 of file attr.c.

References agattrsym(), aghtmlstr(), agmarkhtmlstr(), agnxtattr(), agraphof(), AGTYPE, agxget(), agxset(), and Agsym_s::name.

Referenced by addRevEdge(), cloneEdge(), cloneEdge(), cloneNode(), and projectG().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agdatadict()

Agdatadict_t * agdatadict ( Agraph_t g,
bool  cflag 
)

Definition at line 49 of file attr.c.

References aggetrec(), DataDictName, and init_all_attrs().

Referenced by agdictof(), agmakedatadict(), agraphattr_delete(), agxset(), irrelevant_subgraph(), setattr(), unviewsubgraphsattr(), write_body(), write_dicts(), writeBody(), and writeDicts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agedgeattr_delete()

void agedgeattr_delete ( Agedge_t e)

Definition at line 429 of file attr.c.

References agattrrec(), AgDataRecName, agdelrec(), and freeattr().

Referenced by agdeledge().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agedgeattr_init()

void agedgeattr_init ( Agraph_t g,
Agedge_t e 
)

Definition at line 420 of file attr.c.

References agattrrec(), and agmakeattrs().

Referenced by init_all_attrs(), and newedge().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agget()

char * agget ( void *  obj,
char *  name 
)

Definition at line 439 of file attr.c.

References agattrrec(), agattrsym(), Agsym_s::id, and NULL.

Referenced by adjustNodes(), agwrite(), angleSet(), attach_attrs_and_arrows(), bind_shape(), changetopfishfocus(), checkClusterStyle(), chkBoundBox(), chkOrder(), circularLayout(), color(), common_init_edge(), compile_samerank(), copy_attr(), do_graph_label(), dot2_rank(), dot_mincross(), dot_rank(), dotLayout(), edgeAttrs(), emit_background(), emit_begin_edge(), emit_begin_node(), emit_cluster_colors(), emit_clusters(), emit_colors(), emit_edge_graphics(), emit_html_label(), emit_page(), epsf_init(), esepFactor(), fdp_xLayout(), gdgen_begin_page(), genRound(), get_attribute_value(), getdouble(), getdoubles2ptf(), getEdgeHead(), getEdgeTail(), getObjId(), getPack(), getPackModeInfo(), getPenColor(), graph_init(), graphAdjustMode(), graphAttrs(), gvLayoutJobs(), Import_coord_clusters_from_dot(), init_gvc(), init_job_viewport(), init_layering(), init_nop(), init_xdot(), initGraphAttrs(), initObjMapData(), is_a_cluster(), is_a_strong_cluster(), iterateBody(), iterateHdr(), labelOf(), load_settings_from_graph(), majorization(), makeCompoundEdge(), makeGraphData(), mincross_options(), neato_layout(), neatoLayout(), neatoMode(), neatoModel(), nsiter2(), object_color(), orthoEdges(), parse_layers(), parseXdotwithattrs(), poly_gencode(), poly_init(), populate_data(), prepare_topological_fisheye(), printHref(), putGraphs(), rank(), rank1(), rank_set_class(), rankset_kind(), scan_graph_mode(), sepFactor(), set_checkbox_widget(), set_color_button_widget(), set_combobox_widget(), set_label(), set_scalebtn_widget_to_attribute(), set_spinbtn_widget(), set_text_widget(), setAspect(), setEdgeType(), setRatio(), setSeed(), setup_tree(), simpleScale(), size_reclbl(), svg_begin_job(), svg_print_id_class(), TB_balance(), tuneControl(), twopi_layout(), update_graph_from_settings(), write_plain(), writeEdge(), writePort(), and xdot_begin_graph().

Here is the call graph for this function:

◆ agnodeattr_delete()

void agnodeattr_delete ( Agnode_t n)

Definition at line 410 of file attr.c.

References agattrrec(), AgDataRecName, agdelrec(), and freeattr().

Referenced by agdelnode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agnodeattr_init()

void agnodeattr_init ( Agraph_t g,
Agnode_t n 
)

Definition at line 401 of file attr.c.

References agattrrec(), and agmakeattrs().

Referenced by init_all_attrs(), and initnode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agnxtattr()

Agsym_t * agnxtattr ( Agraph_t g,
int  kind,
Agsym_t attr 
)
Parameters
attrif NULL the function returns the first attribute
Returns
the next one in succession or NULL at the end of the list.

Definition at line 353 of file attr.c.

References agdictof(), dtfirst, and dtnext.

Referenced by agcopyattr(), cloneAttrs(), cloneDfltAttrs(), cloneGraph(), copyAttr(), emitEdgeAttrs(), emitGraphAttrs(), emitNodeAttrs(), fillDict(), firstattr(), firstattr(), firstattr(), listEdgeAttrs(), listGraphAttrs(), listNodeAttrs(), load_attr_list(), load_settings_from_graph(), mapN(), nextattr(), nextattr(), nextattr(), nxtAttr(), update_graph_from_settings(), and write_attrs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agraphattr_delete()

int agraphattr_delete ( Agraph_t g)

Definition at line 381 of file attr.c.

References Ag_G_global, agattrrec(), agdatadict(), agdelrec(), agdtclose(), Agdatadict_s::dict, Agdatadict_s::e, freeattr(), Agdatadict_s::g, Agattr_s::h, Agdatadict_s::h, Agdatadict_s::n, and Agrec_s::name.

Referenced by agclose().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agraphattr_init()

void agraphattr_init ( Agraph_t g)

Definition at line 370 of file attr.c.

References agmakeattrs(), agmakedatadict(), agparent(), Agraph_s::desc, and Agdesc_s::has_attrs.

Referenced by agopen1(), and agraphattr_init_wrapper().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agsafeset()

int agsafeset ( void *  obj,
char *  name,
const char *  value,
const char *  def 
)

Definition at line 507 of file attr.c.

References agattr(), agraphof(), AGTYPE, and agxset().

Referenced by addEdgeGraphics(), addEdgeGraphics(), addEdgeLabelGraphics(), addEdgeLabelGraphics(), addEdgePos(), addEdgePos(), addNodeGraphics(), addNodeGraphics(), addNodeLabelGraphics(), addNodeLabelGraphics(), addRevEdge(), gvLayout(), main(), main(), unknown(), unknown(), and xdot_end_graph().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agset()

int agset ( void *  obj,
char *  name,
const char *  value 
)

Definition at line 466 of file attr.c.

References agattrsym(), agxset(), FAILURE, and NULL.

Referenced by attach_attrs_and_arrows(), cloneAttrs(), cloneNode(), color(), doApply(), make_flat_adj_edges(), patchwork_init_node(), setSeed(), and twopi_layout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agxget()

◆ agxset()