Graphviz 12.0.1~dev.20240716.0800
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 <neatogen/sgd.h>
#include <cgraph/alloc.h>
#include <cgraph/bitarray.h>
#include <cgraph/cgraph.h>
#include <cgraph/gv_ctype.h>
#include <cgraph/prisize_t.h>
#include <cgraph/startswith.h>
#include <cgraph/strcasecmp.h>
#include <cgraph/streq.h>
#include <float.h>
#include <stdbool.h>
#include <stddef.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 430 of file neatoinit.c.

◆ exp_name

#define exp_name   "stresswt"

Definition at line 996 of file neatoinit.c.

◆ RANDOM

#define RANDOM   "random"

Definition at line 939 of file neatoinit.c.

◆ REGULAR

#define REGULAR   "regular"

Definition at line 938 of file neatoinit.c.

◆ SLEN

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

Definition at line 936 of file neatoinit.c.

◆ SMART

#define SMART   "self"

Definition at line 937 of file neatoinit.c.

◆ srand48

#define srand48   srand

Definition at line 47 of file neatoinit.c.

Enumeration Type Documentation

◆ pos_edge

enum pos_edge
Enumerator
NoEdges 
SomeEdges 
AllEdges 

Definition at line 371 of file neatoinit.c.

Function Documentation

◆ add_cluster()

static void add_cluster ( Agraph_t g,
Agraph_t subg 
)
static

Definition at line 454 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 1351 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 690 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 998 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 1018 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 432 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 475 of file neatoinit.c.

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

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 1383 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 410 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 534 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 919 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 1286 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 1119 of file neatoinit.c.

References agerr(), agfindgraphattr, agfstnode(), agget(), agnxtnode(), AGPREV, AM_IPSEP, AM_VPSC, checkExp(), checkStart(), DFLT_MARGIN, 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 778 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 1266 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 152 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 144 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 64 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 615 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 56 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 124 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 1391 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 1321 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 657 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 627 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 378 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 498 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 166 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 182 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 951 of file neatoinit.c.

References agget(), agset(), 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 1245 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 71 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 262 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 54 of file neatoinit.c.

Referenced by neato_layout().

◆ N_pos

attrsym_t* N_pos
static

Definition at line 50 of file neatoinit.c.

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

◆ Pack

int Pack
static

Definition at line 51 of file neatoinit.c.

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