Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
neatoinit.c File Reference

API neatogen/neatoprocs.h: neato_init_node, user_pos, neato_cleanup, init_nop, setSeed, checkStart, neato_layout. More...

#include "config.h"
#include <time.h>
#include <unistd.h>
#include <neatogen/neato.h>
#include <pack/pack.h>
#include <neatogen/stress.h>
#include <neatogen/kkutils.h>
#include <common/pointset.h>
#include <common/render.h>
#include <common/utils.h>
#include <neatogen/sgd.h>
#include <cgraph/cgraph.h>
#include <float.h>
#include <stdbool.h>
#include <stddef.h>
#include <util/agxbuf.h>
#include <util/alloc.h>
#include <util/bitarray.h>
#include <util/gv_ctype.h>
#include <util/prisize_t.h>
#include <util/startswith.h>
#include <util/strcasecmp.h>
#include <util/streq.h>
Include dependency graph for neatoinit.c:

Go to the source code of this file.

Macros

#define srand48   srand
 
#define BS   "%lf,%lf,%lf,%lf"
 
#define SLEN(s)   (sizeof(s)-1)
 
#define SMART   "self"
 
#define REGULAR   "regular"
 
#define RANDOM   "random"
 
#define exp_name   "stresswt"
 

Enumerations

enum  pos_edge { NoEdges , SomeEdges , AllEdges }
 

Functions

void neato_init_node (node_t *n)
 
static void neato_init_edge (edge_t *e)
 
bool user_pos (attrsym_t *posptr, attrsym_t *pinptr, node_t *np, int nG)
 
static void neato_init_node_edge (graph_t *g)
 
static void neato_cleanup_graph (graph_t *g)
 
void neato_cleanup (graph_t *g)
 
static int numFields (const char *pos)
 
static void set_label (void *obj, textlabel_t *l, char *name)
 
static int user_spline (attrsym_t *E_pos, edge_t *e)
 
static pos_edge nop_init_edges (Agraph_t *g)
 
static void freeEdgeInfo (Agraph_t *g)
 
static int chkBB (Agraph_t *g, attrsym_t *G_bb, boxf *bbp)
 
static void add_cluster (Agraph_t *g, Agraph_t *subg)
 
static void nop_init_graphs (Agraph_t *, attrsym_t *, attrsym_t *)
 
static void dfs (Agraph_t *subg, Agraph_t *parentg, attrsym_t *G_lp, attrsym_t *G_bb)
 
int init_nop (Agraph_t *g, int adjust)
 
static void neato_init_graph (Agraph_t *g)
 
static int neatoModel (graph_t *g)
 
static int neatoMode (graph_t *g)
 
static int checkEdge (PointMap *pm, edge_t *ep, int idx)
 
static vtx_datamakeGraphData (graph_t *g, int nv, int *nedges, int mode, int model, node_t ***nodedata)
 
static void initRegular (graph_t *G, int nG)
 
int setSeed (graph_t *G, int dflt, long *seedp)
 
static int checkExp (graph_t *G)
 
int checkStart (graph_t *G, int nG, int dflt)
 
static void majorization (graph_t *mg, graph_t *g, int nv, int mode, int model, int dim, adjust_data *am)
 
static void subset_model (Agraph_t *G, int nG)
 
static void mds_model (graph_t *g)
 
static void kkNeato (Agraph_t *g, int nG, int model)
 
static void neatoLayout (Agraph_t *mg, Agraph_t *g, int layoutMode, int layoutModel, adjust_data *am)
 
static void addZ (Agraph_t *g)
 
static void doEdges (Agraph_t *g)
 
void neato_layout (Agraph_t *g)
 

Variables

static attrsym_tN_pos
 
static int Pack
 
static char * cc_pfx = "_neato_cc"
 

Macro Definition Documentation

◆ BS

#define BS   "%lf,%lf,%lf,%lf"

Definition at line 433 of file neatoinit.c.

◆ exp_name

#define exp_name   "stresswt"

Definition at line 1000 of file neatoinit.c.

◆ RANDOM

#define RANDOM   "random"

Definition at line 942 of file neatoinit.c.

◆ REGULAR

#define REGULAR   "regular"

Definition at line 941 of file neatoinit.c.

◆ SLEN

#define SLEN (   s)    (sizeof(s)-1)

Definition at line 939 of file neatoinit.c.

◆ SMART

#define SMART   "self"

Definition at line 940 of file neatoinit.c.

◆ srand48

#define srand48   srand

Definition at line 50 of file neatoinit.c.

Enumeration Type Documentation

◆ pos_edge

enum pos_edge
Enumerator
NoEdges 
SomeEdges 
AllEdges 

Definition at line 374 of file neatoinit.c.

Function Documentation

◆ add_cluster()

static void add_cluster ( Agraph_t g,
Agraph_t subg 
)
static

Definition at line 457 of file neatoinit.c.

References do_graph_label(), GD_clust, GD_n_cluster, and gv_recalloc().

Referenced by dfs().

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

◆ addZ()

static void addZ ( Agraph_t g)
static

Definition at line 1355 of file neatoinit.c.

References agfstnode(), agnxtnode(), agxset(), N_z, ND_pos, Ndim, and POINTS_PER_INCH.

Referenced by neato_layout().

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

◆ checkEdge()

static int checkEdge ( PointMap pm,
edge_t ep,
int  idx 
)
static

Definition at line 693 of file neatoinit.c.

References aghead, agtail, insertPM(), and ND_id.

Referenced by makeGraphData().

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

◆ checkExp()

static int checkExp ( graph_t G)
static

Definition at line 1002 of file neatoinit.c.

References agfindgraphattr, agwarningf(), exp_name, G, and late_int().

Referenced by majorization().

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

◆ checkStart()

int checkStart ( graph_t G,
int  nG,
int  dflt 
)

Definition at line 1022 of file neatoinit.c.

References agwarningf(), G, init(), INIT_RANDOM, INIT_REGULAR, initRegular(), N_pos, seed, setSeed(), and srand48.

Referenced by initial_positions(), and majorization().

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

◆ chkBB()

static int chkBB ( Agraph_t g,
attrsym_t G_bb,
boxf bbp 
)
static

Definition at line 435 of file neatoinit.c.

References agxget(), BS, boxf::LL, boxf::UR, pointf_s::x, and pointf_s::y.

Referenced by dfs().

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

◆ dfs()

static void dfs ( Agraph_t subg,
Agraph_t parentg,
attrsym_t G_lp,
attrsym_t G_bb 
)
static

Definition at line 478 of file neatoinit.c.

References add_cluster(), agbindrec(), agfstsubg(), agnxtsubg(), chkBB(), dfs(), GD_bb, is_a_cluster(), and nop_init_graphs().

Referenced by dfs(), and nop_init_graphs().

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

◆ doEdges()

static void doEdges ( Agraph_t g)
static

Definition at line 1387 of file neatoinit.c.

References compute_bb(), and spline_edges0().

Here is the call graph for this function:

◆ freeEdgeInfo()

static void freeEdgeInfo ( Agraph_t g)
static

Definition at line 413 of file neatoinit.c.

References agfstnode(), agfstout(), agnxtnode(), agnxtout(), ED_head_label, ED_label, ED_tail_label, ED_xlabel, free_label(), and gv_free_splines().

Referenced by init_nop().

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

◆ init_nop()

int init_nop ( Agraph_t g,
int  adjust 
)

Definition at line 537 of file neatoinit.c.

References adjust, adjustNodes(), agattr(), agerrorf(), agfindgraphattr, agfstnode(), agget(), agnameof(), agnxtnode(), AGRAPH, AllEdges, compute_bb(), freeEdgeInfo(), GD_bb, GD_drawing, GD_label, GD_neato_nlist, GVSPLINES, hasPos, mapbool(), ND_coord, ND_pos, ND_xlabel, neato_set_aspect(), neato_translate(), NoEdges, Nop, nop_init_edges(), nop_init_graphs(), POINTS_PER_INCH, R_NONE, scan_graph(), set_label(), spline_edges0(), startswith(), State, and xdotBB().

Referenced by init_graph(), and neato_layout().

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

◆ initRegular()

static void initRegular ( graph_t G,
int  nG 
)
static

Definition at line 922 of file neatoinit.c.

References agfstnode(), agnxtnode(), G, jitter3d(), M_PI, ND_pinned, ND_pos, Ndim, P_SET, and Spring_coeff.

Referenced by checkStart().

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

◆ kkNeato()

static void kkNeato ( Agraph_t g,
int  nG,
int  model 
)
static

Definition at line 1290 of file neatoinit.c.

References agerr(), agnameof(), AGPREV, agwarningf(), circuit_model(), diffeq_model(), Epsilon, initial_positions(), MaxIter, mds_model(), MODEL_CIRCUIT, MODEL_MDS, MODEL_SUBSET, shortest_path(), solve_model(), start_timer(), subset_model(), and Verbose.

Referenced by neatoLayout().

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

◆ majorization()

static void majorization ( graph_t mg,
graph_t g,
int  nv,
int  mode,
int  model,
int  dim,
adjust_data am 
)
static

Definition at line 1123 of file neatoinit.c.

References agerr(), agfindgraphattr, agfstnode(), agget(), agnxtnode(), AGPREV, AM_IPSEP, AM_VPSC, checkExp(), checkStart(), DFLT_MARGIN, dim, expand_t::doAdd, elapsed_sec(), Epsilon, free(), freeGraphData(), gv_calloc(), init(), INIT_RANDOM, INIT_SELF, late_double(), makeGraphData(), mapbool(), MaxIter, adjust_data::mode, MODE_HIER, MODE_MAJOR, ND_height, ND_id, ND_pos, ND_width, Ndim, opt_exp_flag, opt_smart_init, opts, PS2INCH, sepFactor(), start_timer(), str, stress_majorization_kD_mkernel(), Verbose, pointf_s::x, expand_t::x, pointf_s::y, and expand_t::y.

Referenced by neatoLayout().

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

◆ makeGraphData()

static vtx_data * makeGraphData ( graph_t g,
int  nv,
int *  nedges,
int  mode,
int  model,
node_t ***  nodedata 
)
static

Definition at line 781 of file neatoinit.c.

References acyclic(), agattr(), AGEDGE, agfstedge(), agfstnode(), agget(), aghead, agnedges(), agnxtedge(), agnxtnode(), agtail, checkEdge(), clearPM(), E_weight, ED_dist, ED_factor, free(), freePM(), graph(), gv_calloc(), gv_recalloc(), MODE_HIER, MODE_IPSEP, MODEL_SUBSET, ND_id, nedges, newPM(), NULL, ps, and startswith().

Referenced by majorization(), and subset_model().

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

◆ mds_model()

static void mds_model ( graph_t g)
static

Definition at line 1270 of file neatoinit.c.

References agfstnode(), agfstout(), aghead, agnxtnode(), agnxtout(), AGSEQ, agtail, ED_dist, and GD_dist.

Referenced by kkNeato().

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

◆ neato_cleanup()

void neato_cleanup ( graph_t g)

Definition at line 155 of file neatoinit.c.

References agfstnode(), agfstout(), agnxtnode(), agnxtout(), gv_cleanup_edge(), gv_cleanup_node(), and neato_cleanup_graph().

Here is the call graph for this function:

◆ neato_cleanup_graph()

static void neato_cleanup_graph ( graph_t g)
static

Definition at line 147 of file neatoinit.c.

References free(), free_scan_graph(), GD_clust, Nop, and Pack.

Referenced by neato_cleanup().

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

◆ neato_init_edge()

static void neato_init_edge ( edge_t e)
static

Definition at line 67 of file neatoinit.c.

References agbindrec(), common_init_edge(), E_weight, ED_factor, and late_double().

Referenced by neato_init_node_edge().

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

◆ neato_init_graph()

static void neato_init_graph ( Agraph_t g)
static

Definition at line 618 of file neatoinit.c.

References agfindgraphattr, agroot(), EDGETYPE_LINE, GD_ndim, GD_odim, late_int(), MAXDIM, MIN, Ndim, neato_init_node_edge(), Agraph_s::root, and setEdgeType().

Referenced by neato_layout().

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

◆ neato_init_node()

void neato_init_node ( node_t n)

Definition at line 59 of file neatoinit.c.

References agbindrec(), agraphof(), common_init_node(), GD_flip, GD_ndim, gv_calloc(), gv_nodesize(), and ND_pos.

Referenced by circular_init_node_edge(), cluster_init_graph(), init_node_edge(), neato_init_node_edge(), sfdp_init_node_edge(), and twopi_init_node_edge().

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

◆ neato_init_node_edge()

static void neato_init_node_edge ( graph_t g)
static

Definition at line 127 of file neatoinit.c.

References agfindnodeattr, agfstnode(), agfstout(), agnnodes(), agnxtnode(), agnxtout(), N_pos, neato_init_edge(), neato_init_node(), and user_pos().

Referenced by neato_init_graph().

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

◆ neato_layout()

void neato_layout ( Agraph_t g)

Definition at line 1395 of file neatoinit.c.

References addZ(), agdelete(), agdelrec(), agerr(), agget(), AGPREV, cc_pfx, CL_OFFSET, compute_bb(), doEdges, pack_info::doSplines, EDGETYPE_LINE, pack_info::fixed, free(), free_scan_graph(), get_inputscale(), getPack(), getPackModeInfo(), graphAdjustMode(), graphviz_node_induce(), gv_calloc(), gv_postprocess(), init_nop(), l_node, l_undef, mapbool(), pack_info::margin, pack_info::mode, neato_init_graph(), neatoLayout(), neatoMode(), neatoModel(), Nop, NULL, Pack, packGraphs(), pccomps(), POINTS_PER_INCH, PSinputscale, removeOverlapWith(), setEdgeType(), and spline_edges().

Referenced by nop1_layout(), and nop2_layout().

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

◆ neatoLayout()

static void neatoLayout ( Agraph_t mg,
Agraph_t g,
int  layoutMode,
int  layoutModel,
adjust_data am 
)
static

Definition at line 1325 of file neatoinit.c.

References agget(), agnnodes(), DFLT_ITERATIONS, kkNeato(), majorization(), MaxIter, MODE_KK, MODE_MAJOR, MODE_SGD, Ndim, scan_graph_mode(), sgd(), and str.

Referenced by neato_layout().

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

◆ neatoMode()

static int neatoMode ( graph_t g)
static

Definition at line 660 of file neatoinit.c.

References agget(), agnameof(), agwarningf(), MODE_HIER, MODE_IPSEP, MODE_KK, MODE_MAJOR, MODE_SGD, str, and streq().

Referenced by neato_layout().

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

◆ neatoModel()

static int neatoModel ( graph_t g)
static

Definition at line 630 of file neatoinit.c.

References agattr(), AGEDGE, agerr(), agget(), agnameof(), AGPREV, agwarningf(), MODEL_CIRCUIT, MODEL_MDS, MODEL_SHORTPATH, MODEL_SUBSET, and streq().

Referenced by neato_layout().

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

◆ nop_init_edges()

static pos_edge nop_init_edges ( Agraph_t g)
static

Definition at line 381 of file neatoinit.c.

References agfindedgeattr, agfstnode(), agfstout(), agnedges(), agnxtnode(), agnxtout(), AllEdges, nedges, NoEdges, Nop, SomeEdges, and user_spline().

Referenced by init_nop().

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

◆ nop_init_graphs()

static void nop_init_graphs ( Agraph_t g,
attrsym_t G_lp,
attrsym_t G_bb 
)
static

Definition at line 501 of file neatoinit.c.

References agfstsubg(), agnxtsubg(), agxget(), dfs(), and GD_label.

Referenced by dfs(), and init_nop().

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

◆ numFields()

static int numFields ( const char *  pos)
static

Definition at line 169 of file neatoinit.c.

References cnt(), and gv_isspace().

Referenced by user_spline().

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

◆ set_label()

static void set_label ( void *  obj,
textlabel_t l,
char *  name 
)
static

Definition at line 185 of file neatoinit.c.

References agget(), textlabel_t::pos, and textlabel_t::set.

Referenced by init_nop(), and user_spline().

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

◆ setSeed()

int setSeed ( graph_t G,
int  dflt,
long *  seedp 
)

Definition at line 954 of file neatoinit.c.

References agget(), agset(), agxbfree(), agxbprint(), agxbuse(), G, gv_isalpha(), gv_isdigit(), init(), INIT_RANDOM, INIT_REGULAR, INIT_SELF, NULL, RANDOM, REGULAR, seed, SLEN, SMART, and startswith().

Referenced by checkStart(), fdp_initParams(), and tuneControl().

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

◆ subset_model()

static void subset_model ( Agraph_t G,
int  nG 
)
static

Definition at line 1249 of file neatoinit.c.

References compute_apsp_artificial_weights(), free(), freeGraphData(), G, GD_dist, makeGraphData(), MODE_KK, MODEL_SUBSET, and NULL.

Referenced by kkNeato().

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

◆ user_pos()

bool user_pos ( attrsym_t posptr,
attrsym_t pinptr,
node_t np,
int  nG 
)

Definition at line 74 of file neatoinit.c.

References agerrorf(), agnameof(), agxget(), jitter3d(), jitter_d(), mapbool(), N_z, ND_pinned, ND_pos, Ndim, NULL, P_PIN, P_SET, PSinputscale, and z.

Referenced by init_node_edge(), and neato_init_node_edge().

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

◆ user_spline()

static int user_spline ( attrsym_t E_pos,
edge_t e 
)
static

Definition at line 265 of file neatoinit.c.

References aghead, agnameof(), agtail, agwarningf(), agxget(), arrow_flags(), ED_head_label, ED_label, ED_tail_label, ED_xlabel, bezier::eflag, bezier::ep, free(), gv_calloc(), gv_free_splines(), gv_isspace(), bezier::list, new_spline(), numFields(), ps, set_label(), bezier::sflag, bezier::sp, pointf_s::x, and pointf_s::y.

Referenced by nop_init_edges().

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

Variable Documentation

◆ cc_pfx

char* cc_pfx = "_neato_cc"
static

Definition at line 57 of file neatoinit.c.

Referenced by neato_layout().

◆ N_pos

attrsym_t* N_pos
static

Definition at line 53 of file neatoinit.c.

Referenced by checkStart(), init_node_edge(), and neato_init_node_edge().

◆ Pack

int Pack
static

Definition at line 54 of file neatoinit.c.

Referenced by doDot(), neato_cleanup_graph(), and neato_layout().