Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
hierarchy.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <assert.h>
#include <common/arith.h>
#include <topfish/hierarchy.h>
#include <util/alloc.h>
Include dependency graph for hierarchy.c:

Go to the source code of this file.

Macros

#define A   1.0
 
#define B   1.0
 
#define C   3.0
 
#define D   1.0
 

Functions

static double unweighted_common_fraction (v_data *graph, int v, int u, float *v_vector)
 
static void fill_neighbors_vec (v_data *graph, int vtx, float *vtx_vec)
 
static void fill_neighbors_vec_unweighted (v_data *graph, int vtx, float *vtx_vec)
 
static void empty_neighbors_vec (v_data *graph, int vtx, float *vtx_vec)
 
static int dist3 (v_data *graph, int node1, int node2)
 
static double ddist (ex_vtx_data *geom_graph, int v, int u)
 
void quicksort_place (double *, int *, size_t size)
 
static int maxmatch (v_data *graph, ex_vtx_data *geom_graph, int nvtxs, int *mflag, int dist2_limit)
 
static void makev2cv (int *mflag, int nvtxs, int *v2cv, int *cv2v)
 
static int make_coarse_graph (v_data *graph, int nedges, v_data **cgp, int cnvtxs, int *v2cv, int *cv2v)
 
static int make_coarse_ex_graph (ex_vtx_data *graph, int nedges, ex_vtx_data **cgp, int cnvtxs, int *v2cv, int *cv2v)
 
static void coarsen_match (v_data *graph, ex_vtx_data *geom_graph, int nvtxs, int nedges, int geom_nedges, v_data **cgraph, ex_vtx_data **cgeom_graph, int *cnp, int *cnedges, int *cgeom_nedges, int **v2cvp, int **cv2vp, int dist2_limit)
 
static v_datacpGraph (v_data *graph, int n, int nedges)
 
static ex_vtx_datacpExGraph (ex_vtx_data *graph, int n, int nedges)
 
Hierarchycreate_hierarchy (v_data *graph, int nvtxs, int nedges, ex_vtx_data *geom_graph, int ngeom_edges, hierparms_t *parms)
 
static double dist_from_foci (ex_vtx_data *graph, int node, int *foci, int num_foci)
 
void set_active_levels (Hierarchy *hierarchy, int *foci_nodes, int num_foci, levelparms_t *parms)
 
static double findClosestActiveNode (Hierarchy *hierarchy, int node, int level, double x, double y, double closest_dist, int *closest_node, int *closest_node_level)
 
static int find_leftmost_descendant (Hierarchy *hierarchy, int node, int level, int cur_level)
 
double find_closest_active_node (Hierarchy *hierarchy, double x, double y, int *closest_fine_node)
 
int init_ex_graph (v_data *graph1, v_data *graph2, int n, double *x_coords, double *y_coords, ex_vtx_data **gp)
 
size_t extract_active_logical_coords (Hierarchy *hierarchy, int node, int level, double *x_coords, double *y_coords, size_t counter)
 
int set_active_physical_coords (Hierarchy *hierarchy, int node, int level, double *x_coords, double *y_coords, int counter)
 
void find_physical_coords (Hierarchy *hierarchy, int level, int node, double *x, double *y)
 
void find_active_ancestor_info (Hierarchy *hierarchy, int level, int node, int *levell, int *nodee)
 
void find_old_physical_coords (Hierarchy *hierarchy, int level, int node, double *x, double *y)
 
int find_active_ancestor (Hierarchy *hierarchy, int level, int node)
 
void init_active_level (Hierarchy *hierarchy, int level)
 

Macro Definition Documentation

◆ A

#define A   1.0

Definition at line 116 of file hierarchy.c.

◆ B

#define B   1.0

Definition at line 117 of file hierarchy.c.

◆ C

#define C   3.0

Definition at line 118 of file hierarchy.c.

◆ D

#define D   1.0

Definition at line 119 of file hierarchy.c.

Function Documentation

◆ coarsen_match()

static void coarsen_match ( v_data graph,
ex_vtx_data geom_graph,
int  nvtxs,
int  nedges,
int  geom_nedges,
v_data **  cgraph,
ex_vtx_data **  cgeom_graph,
int *  cnp,
int *  cnedges,
int *  cgeom_nedges,
int **  v2cvp,
int **  cv2vp,
int  dist2_limit 
)
static

Definition at line 561 of file hierarchy.c.

References free(), graph(), gv_calloc(), make_coarse_ex_graph(), make_coarse_graph(), makev2cv(), maxmatch(), and nedges.

Referenced by create_hierarchy().

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

◆ cpExGraph()

static ex_vtx_data * cpExGraph ( ex_vtx_data graph,
int  n,
int  nedges 
)
static

Definition at line 644 of file hierarchy.c.

References cpGraph(), v_data::edges, graph(), gv_calloc(), nedges, and NULL.

Referenced by create_hierarchy().

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

◆ cpGraph()

static v_data * cpGraph ( v_data graph,
int  n,
int  nedges 
)
static

Definition at line 612 of file hierarchy.c.

References cpGraph(), v_data::edges, v_data::ewgts, graph(), gv_calloc(), nedges, and NULL.

Referenced by cpExGraph(), cpGraph(), and create_hierarchy().

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

◆ create_hierarchy()

Hierarchy * create_hierarchy ( v_data graph,
int  nvtxs,
int  nedges,
ex_vtx_data geom_graph,
int  ngeom_edges,
hierparms_t parms 
)

Definition at line 665 of file hierarchy.c.

References coarsen_match(), cpExGraph(), cpGraph(), Hierarchy::cv2v, Hierarchy::geom_graphs, ex_vtx_data::globalIndex, graph(), Hierarchy::graphs, gv_alloc(), gv_calloc(), gv_recalloc(), MAX, Hierarchy::maxNodeIndex, nedges, Hierarchy::nedges, Hierarchy::nlevels, Hierarchy::nvtxs, parms, and Hierarchy::v2cv.

Referenced by makeHier().

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

◆ ddist()

static double ddist ( ex_vtx_data geom_graph,
int  v,
int  u 
)
static

Definition at line 121 of file hierarchy.c.

References ex_vtx_data::x_coord, and ex_vtx_data::y_coord.

Referenced by dist_from_foci(), and maxmatch().

Here is the caller graph for this function:

◆ dist3()

static int dist3 ( v_data graph,
int  node1,
int  node2 
)
static

Definition at line 91 of file hierarchy.c.

References graph().

Referenced by maxmatch().

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

◆ dist_from_foci()

static double dist_from_foci ( ex_vtx_data graph,
int  node,
int *  foci,
int  num_foci 
)
static

Definition at line 733 of file hierarchy.c.

References ddist(), distance(), graph(), and MIN.

Referenced by set_active_levels().

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

◆ empty_neighbors_vec()

static void empty_neighbors_vec ( v_data graph,
int  vtx,
float *  vtx_vec 
)
static

Definition at line 82 of file hierarchy.c.

References graph().

Referenced by maxmatch().

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

◆ extract_active_logical_coords()

size_t extract_active_logical_coords ( Hierarchy hierarchy,
int  node,
int  level,
double *  x_coords,
double *  y_coords,
size_t  counter 
)

Definition at line 999 of file hierarchy.c.

References Hierarchy::cv2v, extract_active_logical_coords(), Hierarchy::geom_graphs, and graph().

Referenced by extract_active_logical_coords(), and positionAllItems().

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

◆ fill_neighbors_vec()

static void fill_neighbors_vec ( v_data graph,
int  vtx,
float *  vtx_vec 
)
static

Definition at line 59 of file hierarchy.c.

References graph(), and NULL.

Referenced by maxmatch().

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

◆ fill_neighbors_vec_unweighted()

static void fill_neighbors_vec_unweighted ( v_data graph,
int  vtx,
float *  vtx_vec 
)
static

Definition at line 73 of file hierarchy.c.

References graph().

Referenced by maxmatch().

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

◆ find_active_ancestor()

int find_active_ancestor ( Hierarchy hierarchy,
int  level,
int  node 
)

◆ find_active_ancestor_info()

void find_active_ancestor_info ( Hierarchy hierarchy,
int  level,
int  node,
int *  levell,
int *  nodee 
)

Definition at line 1078 of file hierarchy.c.

References ex_vtx_data::active_level, Hierarchy::geom_graphs, and Hierarchy::v2cv.

Referenced by drawtopfishedges().

Here is the caller graph for this function:

◆ find_closest_active_node()

double find_closest_active_node ( Hierarchy hierarchy,
double  x,
double  y,
int *  closest_fine_node 
)

Definition at line 929 of file hierarchy.c.

References find_leftmost_descendant(), findClosestActiveNode(), Hierarchy::nlevels, and Hierarchy::nvtxs.

Referenced by changetopfishfocus().

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

◆ find_leftmost_descendant()

static int find_leftmost_descendant ( Hierarchy hierarchy,
int  node,
int  level,
int  cur_level 
)
static

Definition at line 913 of file hierarchy.c.

References Hierarchy::cv2v.

Referenced by find_closest_active_node().

Here is the caller graph for this function:

◆ find_old_physical_coords()

void find_old_physical_coords ( Hierarchy hierarchy,
int  level,
int  node,
double *  x,
double *  y 
)

Definition at line 1097 of file hierarchy.c.

References Hierarchy::geom_graphs, ex_vtx_data::old_active_level, ex_vtx_data::old_physical_x_coord, ex_vtx_data::old_physical_y_coord, and Hierarchy::v2cv.

Referenced by get_temp_coords().

Here is the caller graph for this function:

◆ find_physical_coords()

void find_physical_coords ( Hierarchy hierarchy,
int  level,
int  node,
double *  x,
double *  y 
)

Definition at line 1064 of file hierarchy.c.

References ex_vtx_data::active_level, Hierarchy::geom_graphs, ex_vtx_data::physical_x_coord, ex_vtx_data::physical_y_coord, and Hierarchy::v2cv.

Referenced by get_temp_coords().

Here is the caller graph for this function:

◆ findClosestActiveNode()

static double findClosestActiveNode ( Hierarchy hierarchy,
int  node,
int  level,
double  x,
double  y,
double  closest_dist,
int *  closest_node,
int *  closest_node_level 
)
static

Definition at line 867 of file hierarchy.c.

References Hierarchy::cv2v, dist(), findClosestActiveNode(), Hierarchy::geom_graphs, and graph().

Referenced by find_closest_active_node(), and findClosestActiveNode().

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

◆ init_active_level()

void init_active_level ( Hierarchy hierarchy,
int  level 
)

Definition at line 1129 of file hierarchy.c.

References Hierarchy::geom_graphs, graph(), Hierarchy::nlevels, and Hierarchy::nvtxs.

Referenced by makeHier().

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

◆ init_ex_graph()

int init_ex_graph ( v_data graph1,
v_data graph2,
int  n,
double *  x_coords,
double *  y_coords,
ex_vtx_data **  gp 
)

Definition at line 946 of file hierarchy.c.

References v_data::edges, ex_vtx_data::edges, gv_calloc(), nedges, v_data::nedges, ex_vtx_data::nedges, neighbor, ex_vtx_data::size, ex_vtx_data::x_coord, and ex_vtx_data::y_coord.

Referenced by makeHier().

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

◆ make_coarse_ex_graph()

static int make_coarse_ex_graph ( ex_vtx_data graph,
int  nedges,
ex_vtx_data **  cgp,
int  cnvtxs,
int *  v2cv,
int *  cv2v 
)
static

Definition at line 482 of file hierarchy.c.

References ex_vtx_data::edges, free(), graph(), gv_calloc(), nedges, ex_vtx_data::nedges, neighbor, ex_vtx_data::size, ex_vtx_data::x_coord, and ex_vtx_data::y_coord.

Referenced by coarsen_match().

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

◆ make_coarse_graph()

static int make_coarse_graph ( v_data graph,
int  nedges,
v_data **  cgp,
int  cnvtxs,
int *  v2cv,
int *  cv2v 
)
static

Definition at line 337 of file hierarchy.c.

References v_data::edges, v_data::ewgts, free(), graph(), gv_calloc(), nedges, v_data::nedges, neighbor, and NULL.

Referenced by coarsen_match().

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

◆ makev2cv()

static void makev2cv ( int *  mflag,
int  nvtxs,
int *  v2cv,
int *  cv2v 
)
static

Definition at line 312 of file hierarchy.c.

Referenced by coarsen_match().

Here is the caller graph for this function:

◆ maxmatch()

static int maxmatch ( v_data graph,
ex_vtx_data geom_graph,
int  nvtxs,
int *  mflag,
int  dist2_limit 
)
static

Definition at line 133 of file hierarchy.c.

References A, B, C, ddist(), dist3(), ex_vtx_data::edges, empty_neighbors_vec(), fill_neighbors_vec(), fill_neighbors_vec_unweighted(), free(), graph(), gv_calloc(), MIN, nedges, ex_vtx_data::nedges, neighbor, NULL, quicksort_place(), ex_vtx_data::size, and unweighted_common_fraction().

Referenced by coarsen_match().

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

◆ quicksort_place()

void quicksort_place ( double *  place,
int *  ordering,
size_t  size 
)
extern

Definition at line 105 of file rescale_layout.c.

References cmp(), and gv_sort().

Referenced by maxmatch(), and set_active_levels().

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

◆ set_active_levels()

void set_active_levels ( Hierarchy hierarchy,
int *  foci_nodes,
int  num_foci,
levelparms_t parms 
)

Definition at line 753 of file hierarchy.c.

References ex_vtx_data::active_level, Hierarchy::cv2v, dist_from_foci(), free(), Hierarchy::geom_graphs, graph(), gv_calloc(), MIN, Hierarchy::nlevels, Hierarchy::nvtxs, parms, and quicksort_place().

Referenced by changetopfishfocus(), and prepare_topological_fisheye().

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

◆ set_active_physical_coords()

int set_active_physical_coords ( Hierarchy hierarchy,
int  node,
int  level,
double *  x_coords,
double *  y_coords,
int  counter 
)

Definition at line 1033 of file hierarchy.c.

References Hierarchy::cv2v, Hierarchy::geom_graphs, graph(), and set_active_physical_coords().

Referenced by positionAllItems(), and set_active_physical_coords().

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

◆ unweighted_common_fraction()

static double unweighted_common_fraction ( v_data graph,
int  v,
int  u,
float *  v_vector 
)
static

Definition at line 35 of file hierarchy.c.

References graph(), and neighbor.

Referenced by maxmatch().

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