Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
stuff.c File Reference
#include "config.h"
#include <math.h>
#include <neatogen/neato.h>
#include <neatogen/stress.h>
#include <stdlib.h>
#include <time.h>
#include <util/alloc.h>
#include <unistd.h>
Include dependency graph for stuff.c:

Go to the source code of this file.

Macros

#define Msub(i, j)   M[(i)*Ndim+(j)]
 

Functions

static Agnode_tchoose_node (graph_t *, int)
 
static void make_spring (graph_t *, Agnode_t *, Agnode_t *, double)
 
static void move_node (graph_t *, int, Agnode_t *)
 
static double fpow32 (double x)
 
static double distvec (double *p0, double *p1, double *vec)
 
double ** new_array (int m, int n, double ival)
 
void free_array (double **rv)
 
static double *** new_3array (int m, int n, int p, double ival)
 
static void free_3array (double ***rv)
 
static int lenattr (edge_t *e, Agsym_t *index, double *val)
 
static int degreeKind (graph_t *g, node_t *n, node_t **op)
 
static node_tprune (graph_t *G, node_t *np, node_t *next)
 
static double setEdgeLen (graph_t *G, node_t *np, Agsym_t *lenx, double dfltlen)
 
int scan_graph_mode (graph_t *G, int mode)
 
int scan_graph (graph_t *g)
 
void free_scan_graph (graph_t *g)
 
void jitter_d (node_t *np, int nG, int n)
 
void jitter3d (node_t *np, int nG)
 
void randompos (node_t *np, int nG)
 
void initial_positions (graph_t *G, int nG)
 
void diffeq_model (graph_t *G, int nG)
 
static double total_e (graph_t *G, int nG)
 
void solve_model (graph_t *G, int nG)
 
static void update_arrays (graph_t *G, int nG, int i)
 
static void D2E (graph_t *G, int nG, int n, double *M)
 
static void heapup (node_t *v)
 
static void heapdown (node_t *v)
 
void neato_enqueue (node_t *v)
 
node_tneato_dequeue (void)
 
void shortest_path (graph_t *G, int nG)
 
void s1 (graph_t *G, node_t *node)
 

Variables

static double Epsilon2
 
static node_t ** Heap
 
static int Heapsize
 
static node_tSrc
 

Macro Definition Documentation

◆ Msub

#define Msub (   i,
 
)    M[(i)*Ndim+(j)]

Definition at line 479 of file stuff.c.

Function Documentation

◆ choose_node()

node_t * choose_node ( graph_t G,
int  nG 
)
static

Definition at line 514 of file stuff.c.

References cnt(), Epsilon2, G, GD_move, GD_neato_nlist, GD_sum_t, MaxIter, ND_pinned, Ndim, NULL, P_SET, and Verbose.

Referenced by solve_model().

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

◆ D2E()

static void D2E ( graph_t G,
int  nG,
int  n,
double *  M 
)
static

Definition at line 480 of file stuff.c.

References D, fpow32(), G, GD_dist, GD_neato_nlist, GD_spring, MAXDIM, Msub, ND_pos, Ndim, and scale().

Referenced by move_node().

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

◆ degreeKind()

static int degreeKind ( graph_t g,
node_t n,
node_t **  op 
)
static

Definition at line 132 of file stuff.c.

References agfstedge(), aghead, agnxtedge(), agtail, and NULL.

Referenced by prune(), and scan_graph_mode().

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

◆ diffeq_model()

void diffeq_model ( graph_t G,
int  nG 
)

Definition at line 357 of file stuff.c.

References agfindedge, D, del(), dist(), distvec(), ED_factor, elapsed_sec(), G, GD_dist, GD_neato_nlist, GD_spring, GD_sum_t, GD_t, MAXDIM, ND_pos, Ndim, Spring_coeff, start_timer(), and Verbose.

Referenced by kkNeato().

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

◆ distvec()

static double distvec ( double *  p0,
double *  p1,
double *  vec 
)
static

Definition at line 34 of file stuff.c.

References dist(), and Ndim.

Referenced by diffeq_model(), and update_arrays().

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

◆ fpow32()

static double fpow32 ( double  x)
static

Definition at line 28 of file stuff.c.

Referenced by D2E().

Here is the caller graph for this function:

◆ free_3array()

static void free_3array ( double ***  rv)
static

Definition at line 89 of file stuff.c.

References free().

Referenced by free_scan_graph().

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

◆ free_array()

void free_array ( double **  rv)

Definition at line 62 of file stuff.c.

References free().

Referenced by circuit_model(), circuitModel(), free_scan_graph(), and lu_decompose().

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

◆ free_scan_graph()

void free_scan_graph ( graph_t g)

Definition at line 301 of file stuff.c.

References free(), free_3array(), free_array(), GD_dist, GD_neato_nlist, GD_spring, GD_sum_t, GD_t, Nop, and NULL.

Referenced by neato_cleanup_graph(), and neato_layout().

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

◆ heapdown()

static void heapdown ( node_t v)
static

Definition at line 600 of file stuff.c.

References Heap, Heapsize, left, ND_dist, ND_heapindex, and right.

Referenced by neato_dequeue().

Here is the caller graph for this function:

◆ heapup()

static void heapup ( node_t v)
static

Definition at line 583 of file stuff.c.

References Heap, ND_dist, and ND_heapindex.

Referenced by neato_enqueue(), and s1().

Here is the caller graph for this function:

◆ initial_positions()

void initial_positions ( graph_t G,
int  nG 
)

Definition at line 333 of file stuff.c.

References agwarningf(), checkStart(), G, GD_neato_nlist, hasPos, init(), INIT_RANDOM, INIT_REGULAR, INIT_SELF, randompos(), and Verbose.

Referenced by kkNeato(), and sgd().

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

◆ jitter3d()

void jitter3d ( node_t np,
int  nG 
)

Definition at line 320 of file stuff.c.

References jitter_d().

Referenced by initRegular(), randompos(), and user_pos().

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

◆ jitter_d()

void jitter_d ( node_t np,
int  nG,
int  n 
)

Definition at line 313 of file stuff.c.

References drand48(), ND_pos, and Ndim.

Referenced by jitter3d(), and user_pos().

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

◆ lenattr()

static int lenattr ( edge_t e,
Agsym_t index,
double *  val 
)
static

Definition at line 108 of file stuff.c.

References agwarningf(), agxget(), Nop, and NULL.

Referenced by setEdgeLen().

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

◆ make_spring()

void make_spring ( graph_t G,
Agnode_t u,
Agnode_t v,
double  f 
)
static

Definition at line 705 of file stuff.c.

References G, GD_dist, and ND_id.

Referenced by s1().

Here is the caller graph for this function:

◆ move_node()

void move_node ( graph_t G,
int  nG,
Agnode_t n 
)
static

Definition at line 550 of file stuff.c.

References agnameof(), D2E(), Damping, drand48(), free(), G, GD_move, GD_sum_t, gv_calloc(), MAXDIM, ND_id, ND_pos, Ndim, solve(), test_toggle(), and update_arrays().

Referenced by solve_model().

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

◆ neato_dequeue()

node_t * neato_dequeue ( void  )

Definition at line 636 of file stuff.c.

References Heap, heapdown(), Heapsize, ND_heapindex, and NULL.

Referenced by s1().

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

◆ neato_enqueue()

void neato_enqueue ( node_t v)

Definition at line 624 of file stuff.c.

References Heap, Heapsize, heapup(), and ND_heapindex.

Referenced by s1().

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

◆ new_3array()

static double *** new_3array ( int  m,
int  n,
int  p,
double  ival 
)
static

Definition at line 71 of file stuff.c.

References gv_calloc(), and NULL.

Referenced by scan_graph_mode().

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

◆ new_array()

double ** new_array ( int  m,
int  n,
double  ival 
)

Definition at line 47 of file stuff.c.

References gv_calloc().

Referenced by circuit_model(), circuitModel(), lu_decompose(), and scan_graph_mode().

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

◆ prune()

static node_t * prune ( graph_t G,
node_t np,
node_t next 
)
static

Definition at line 168 of file stuff.c.

References agdelete(), agnxtnode(), degreeKind(), and G.

Referenced by scan_graph_mode().

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

◆ randompos()

void randompos ( node_t np,
int  nG 
)

Definition at line 325 of file stuff.c.

References drand48(), jitter3d(), ND_pos, and Ndim.

Referenced by initial_positions().

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

◆ s1()

void s1 ( graph_t G,
node_t node 
)

Definition at line 671 of file stuff.c.

References agfstedge(), aghead, agnxtedge(), agtail, ED_dist, G, GD_neato_nlist, heapup(), Initial_dist, make_spring(), ND_dist, ND_heapindex, ND_hops, neato_dequeue(), neato_enqueue(), and Src.

Referenced by buildBindings(), clip_line(), comp_ascend(), comp_ascend_int(), concat(), concat(), concatPort(), concatPort(), directVis(), gvbisect(), gvrender_comparestr(), indexOf(), is_parallel(), rindexOf(), same_side(), scomp(), shortest_path(), STsetUnion(), SWIG_Tcl_ObjectConstructor(), and tok().

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

◆ scan_graph()

int scan_graph ( graph_t g)

Definition at line 296 of file stuff.c.

References MODE_KK, and scan_graph_mode().

Referenced by init_nop().

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

◆ scan_graph_mode()

int scan_graph_mode ( graph_t G,
int  mode 
)

Definition at line 216 of file stuff.c.

References agattr(), agdelete(), AGEDGE, agfstnode(), agget(), agnameof(), agnedges(), agnnodes(), agnxtnode(), Damping, degreeKind(), DFLT_TOLERANCE, Epsilon, G, GD_dist, GD_neato_nlist, GD_spring, GD_sum_t, GD_t, getdouble(), gv_calloc(), Initial_dist, MODE_KK, MODE_SGD, ND_heapindex, ND_id, Ndim, new_3array(), new_array(), Nop, prune(), Reduce, setEdgeLen(), str, and Verbose.

Referenced by neatoLayout(), and scan_graph().

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

◆ setEdgeLen()

static double setEdgeLen ( graph_t G,
node_t np,
Agsym_t lenx,
double  dfltlen 
)
static

Definition at line 192 of file stuff.c.

References agerr(), agfstout(), agnameof(), agnxtout(), AGPREV, ED_dist, err, G, len(), and lenattr().

Referenced by scan_graph_mode().

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

◆ shortest_path()

void shortest_path ( graph_t G,
int  nG 
)

Definition at line 654 of file stuff.c.

References agfstnode(), agnxtnode(), elapsed_sec(), free(), G, gv_calloc(), Heap, s1(), start_timer(), and Verbose.

Referenced by kkNeato().

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

◆ solve_model()

void solve_model ( graph_t G,
int  nG 
)

Definition at line 432 of file stuff.c.

References agnameof(), agwarningf(), choose_node(), elapsed_sec(), Epsilon, Epsilon2, G, GD_move, MaxIter, move_node(), total_e(), and Verbose.

Referenced by kkNeato().

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

◆ total_e()

static double total_e ( graph_t G,
int  nG 
)
static

Definition at line 408 of file stuff.c.

References G, GD_dist, GD_neato_nlist, GD_spring, ND_pos, and Ndim.

Referenced by solve_model().

Here is the caller graph for this function:

◆ update_arrays()

static void update_arrays ( graph_t G,
int  nG,
int  i 
)
static

Definition at line 452 of file stuff.c.

References del(), dist(), distvec(), G, GD_dist, GD_neato_nlist, GD_spring, GD_sum_t, GD_t, MAXDIM, ND_pos, and Ndim.

Referenced by move_node().

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

Variable Documentation

◆ Epsilon2

double Epsilon2
static

Definition at line 23 of file stuff.c.

Referenced by choose_node(), and solve_model().

◆ Heap

node_t** Heap
static

Definition at line 579 of file stuff.c.

Referenced by heapdown(), heapup(), neato_dequeue(), neato_enqueue(), and shortest_path().

◆ Heapsize

int Heapsize
static

Definition at line 580 of file stuff.c.

Referenced by heapdown(), neato_dequeue(), and neato_enqueue().

◆ Src

node_t* Src
static

Definition at line 581 of file stuff.c.

Referenced by s1().