Graphviz 14.1.6~dev.20260420.0039
Loading...
Searching...
No Matches
graph.c File Reference
#include "config.h"
#include <assert.h>
#include <cgraph/cghdr.h>
#include <cgraph/node_set.h>
#include <limits.h>
#include <stdbool.h>
#include <stdlib.h>
#include <util/alloc.h>
Include dependency graph for graph.c:

Go to the source code of this file.

Functions

static Agclos_tagclos (Agdisc_t *proto)
 
Agraph_tagopen (char *name, Agdesc_t desc, Agdisc_t *arg_disc)
 creates a new graph with the given name and kind
 
Agraph_tagopen1 (Agraph_t *g)
 
int agclose (Agraph_t *g)
 deletes a graph, freeing its associated storage
 
uint64_t agnextseq (Agraph_t *g, int objtype)
 
size_t agnnodes_z (const Agraph_t *g)
 
int agnnodes (Agraph_t *g)
 
int agnedges (Agraph_t *g)
 
int agnsubg (Agraph_t *g)
 
int agisdirected (Agraph_t *g)
 
int agisundirected (Agraph_t *g)
 
int agisstrict (Agraph_t *g)
 
int agissimple (Agraph_t *g)
 
static int cnt (Dict_t *d, Dtlink_t **set)
 
int agcountuniqedges (Agraph_t *g, Agnode_t *n, int want_in, int want_out)
 
int agdegree (Agraph_t *g, Agnode_t *n, int want_in, int want_out)
 
static int agraphseqcmpf (void *arg0, void *arg1)
 
static int agraphidcmpf (void *arg0, void *arg1)
 

Variables

Dtdisc_t Ag_subgraph_seq_disc
 
Dtdisc_t Ag_subgraph_id_disc
 
Agdesc_t Agdirected = {.directed = true, .maingraph = true}
 directed
 
Agdesc_t Agstrictdirected = {.directed = true, .strict = true, .maingraph = true}
 strict directed. A strict graph cannot have multi-edges or self-arcs.
 
Agdesc_t Agundirected = {.maingraph = true}
 undirected
 
Agdesc_t Agstrictundirected = {.strict = true, .maingraph = true}
 strict undirected
 
Agdisc_t AgDefaultDisc = { &AgIdDisc, &AgIoDisc }
 

Function Documentation

◆ agclos()

static Agclos_t * agclos ( Agdisc_t proto)
static

Definition at line 30 of file graph.c.

References AgIdDisc, AgIoDisc, Agclos_s::disc, gv_calloc(), Agdisc_s::id, and Agdisc_s::io.

Referenced by agopen().

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

◆ agnextseq()

uint64_t agnextseq ( Agraph_t g,
int  objtype 
)

Definition at line 152 of file graph.c.

References Agraph_s::clos, and Agclos_s::seq.

Referenced by agnode(), agopen1(), and newedge().

Here is the caller graph for this function:

◆ agnnodes_z()

size_t agnnodes_z ( const Agraph_t g)

get the number of nodes in a graph

Where possible, this should be used in internal code in preference to agnnodes. In future, this should be migrated to the public API and replace agnnodes.

Parameters
gGraph to inspect
Returns
Number of nodes in this graph

Definition at line 157 of file graph.c.

References Agraph_s::n_id, and node_set_size().

Referenced by agnnodes(), getSizes(), and makeInfo().

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

◆ agopen1()

Agraph_t * agopen1 ( Agraph_t g)

Definition at line 68 of file graph.c.

References Ag_mainedge_id_disc, Ag_mainedge_seq_disc, Ag_subedge_id_disc, Ag_subedge_seq_disc, Ag_subgraph_id_disc, Ag_subgraph_seq_disc, Ag_subnode_seq_disc, agdtopen(), agmethod_init(), agnextseq(), agparent(), AGRAPH, agraphattr_init(), agroot(), AGSEQ, Agraph_s::desc, dtinsert, Dttree, Agraph_s::e_id, Agraph_s::e_seq, Agraph_s::g_id, Agraph_s::g_seq, Agdesc_s::has_attrs, Agraph_s::n_id, Agraph_s::n_seq, node_set_new(), and SEQ_MASK.

Referenced by agopen(), and localsubg().

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

◆ agraphidcmpf()

static int agraphidcmpf ( void *  arg0,
void *  arg1 
)
static

Definition at line 252 of file graph.c.

References AGID.

◆ agraphseqcmpf()

static int agraphseqcmpf ( void *  arg0,
void *  arg1 
)
static

Definition at line 240 of file graph.c.

References AGSEQ.

◆ cnt()

static int cnt ( Dict_t d,
Dtlink_t **  set 
)
static

Definition at line 200 of file graph.c.

References dtextract(), dtrestore(), and dtsize().

Referenced by _agstrcanon(), _printXDot(), addEdge(), addEdgeGraphics(), addEdgeGraphics(), addEdgeLabelGraphics(), addEdgeLabelGraphics(), addNodeGraphics(), addNodeGraphics(), addNodeLabelGraphics(), addNodeLabelGraphics(), addXLabels(), agcountuniqedges(), agdegree(), agxbmore(), appendFLineList(), appendFLineList(), bbox(), bbox(), choose_node(), circomps(), cntOverlaps(), color(), config_extra_args(), countPoints(), dfs(), dfs(), dot_splines_(), edge_in_layer(), fdp_extra_args(), fillGraph(), firstlayer(), free_textspan(), genPorts(), get_cycle_centroid(), getFile(), gml_to_gv(), gml_to_gv(), graphviz_tred(), graphviz_unflatten(), gv_fixLocale(), gvdevice_finalize(), improve_antibandwidth_by_swapping(), in_cross(), inflatePts(), initPositions(), isBox(), isConnected(), jsonPolyline(), leave_edge(), main(), make_flat_adj_edges(), make_flat_bottom_edges(), make_flat_edge(), make_regular_edge(), makeSelfArcs(), makeSelfEdge(), makeSimpleFlat(), makeSimpleFlatLabels(), makeXDotSpline(), map_output_bspline(), mkConstraintG(), mkText(), mkText(), nameOf(), neato_extra_args(), numFields(), out_cross(), overlaps(), parse_layerselect(), parse_reclbl(), parseXdotwithattrs(), pathscross(), positionChildren(), ppDirective(), PQdownheap(), processTbl(), reduce(), rmEquality(), sAdjust(), selfBottom(), selfLeft(), selfRight(), selfTop(), spline_edges_(), splitBSpline(), straight_len(), straight_path(), transCopy(), use_library(), vAdjust(), write_dict(), write_nondefault_attrs(), and write_polyline().

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

Variable Documentation

◆ Ag_subgraph_id_disc

Dtdisc_t Ag_subgraph_id_disc
Initial value:
= {
.link = offsetof(Agraph_t, id_link),
.comparf = agraphidcmpf,
}
static int agraphidcmpf(void *arg0, void *arg1)
Definition graph.c:252
graph or subgraph
Definition cgraph.h:424

Definition at line 269 of file graph.c.

Referenced by agfindsubg_by_id(), and agopen1().

◆ Ag_subgraph_seq_disc

Dtdisc_t Ag_subgraph_seq_disc
Initial value:
= {
.link = offsetof(Agraph_t, seq_link),
.comparf = agraphseqcmpf,
}
static int agraphseqcmpf(void *arg0, void *arg1)
Definition graph.c:240

Definition at line 264 of file graph.c.

Referenced by agopen1().