Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
hierarchy.h
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (c) 2011 AT&T Intellectual Property
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11#pragma once
12
14#include <stddef.h>
15
16typedef struct {
17 int nedges; // degree, including self-loop
18 int *edges; // neighbors; edges[0] = self
19 int size; // no. of original nodes contained
20 int active_level; // Node displayed iff active_level == node's level
21 int globalIndex; // Each node has a unique ID over all levels
22
23 // position of node in universal coordinate system
24 float x_coord;
25 float y_coord;
26
27 // position of node in physical (device) coordinate system
30 //previous coords and active level (for animation)
34
35
37
38typedef struct {
42 int * nvtxs;
43 int * nedges;
44 /* Node i on level k is mapped to coarse node v2cv[k][i] on level k+1
45 */
46 int ** v2cv;
47 /* Coarse node i on level k contains nodes cv2v[k][2*i] and
48 * cv2v[k][2*i+1] on level k-1. If it contains only 1 node, then
49 * cv2v[k][2*i+1] will be -1
50 */
51 int ** cv2v;
53} Hierarchy;
54
55typedef struct {
56 int num_fine_nodes; /* 50 */
57 double coarsening_rate; /* 2.5 */
59
60typedef struct {
61 // if dist2_limit true, don't contract nodes of distance larger than 2
62 // if false then also distance 3 is possible
63 int dist2_limit; /* TRUE */
65
66Hierarchy* create_hierarchy(v_data * graph, int nvtxs, int nedges,
67 ex_vtx_data* geom_graph, int ngeom_edges, hierparms_t*);
68
69void set_active_levels(Hierarchy*, int*, int, levelparms_t*);
70double find_closest_active_node(Hierarchy*, double x, double y, int*);
71
72size_t extract_active_logical_coords(Hierarchy *hierarchy, int node, int level,
73 double *x_coords, double *y_coords, size_t counter);
74int set_active_physical_coords(Hierarchy *, int node, int level,
75 double *x_coords, double *y_coords, int counter);
76
77void init_active_level(Hierarchy* hierarchy, int level);
78
79// creating a geometric graph:
80int init_ex_graph(v_data * graph1, v_data * graph2, int n,
81 double *x_coords, double *y_coords, ex_vtx_data ** gp);
82
83// layout distortion:
84void rescale_layout_polar(double * x_coords, double * y_coords,
85 double * x_foci, double * y_foci, int num_foci, size_t n, int interval,
86 double width, double height, double distortion);
87
88void find_physical_coords(Hierarchy*, int, int, double *x, double *y);
89void find_old_physical_coords(Hierarchy * hierarchy, int level, int node, double *x,double *y);
90
91
92int find_active_ancestor(Hierarchy*, int, int);
93void find_active_ancestor_info(Hierarchy * hierarchy, int level, int node, int *levell,int *nodee);
94
95void quicksort_place(double *place, int *ordering, size_t size);
Agraph_t * graph(char *name)
Definition gv.cpp:30
Hierarchy * create_hierarchy(v_data *graph, int nvtxs, int nedges, ex_vtx_data *geom_graph, int ngeom_edges, hierparms_t *)
Definition hierarchy.c:665
size_t extract_active_logical_coords(Hierarchy *hierarchy, int node, int level, double *x_coords, double *y_coords, size_t counter)
Definition hierarchy.c:999
void set_active_levels(Hierarchy *, int *, int, levelparms_t *)
Definition hierarchy.c:753
void find_active_ancestor_info(Hierarchy *hierarchy, int level, int node, int *levell, int *nodee)
Definition hierarchy.c:1078
void init_active_level(Hierarchy *hierarchy, int level)
Definition hierarchy.c:1129
void rescale_layout_polar(double *x_coords, double *y_coords, double *x_foci, double *y_foci, int num_foci, size_t n, int interval, double width, double height, double distortion)
int find_active_ancestor(Hierarchy *, int, int)
Definition hierarchy.c:1115
void quicksort_place(double *place, int *ordering, size_t size)
void find_old_physical_coords(Hierarchy *hierarchy, int level, int node, double *x, double *y)
Definition hierarchy.c:1097
int set_active_physical_coords(Hierarchy *, int node, int level, double *x_coords, double *y_coords, int counter)
Definition hierarchy.c:1033
double find_closest_active_node(Hierarchy *, double x, double y, int *)
Definition hierarchy.c:929
void find_physical_coords(Hierarchy *, int, int, double *x, double *y)
Definition hierarchy.c:1064
int init_ex_graph(v_data *graph1, v_data *graph2, int n, double *x_coords, double *y_coords, ex_vtx_data **gp)
Definition hierarchy.c:946
static int nedges
total no. of edges used in routing
Definition routespl.c:31
v_data ** graphs
Definition hierarchy.h:40
int * nvtxs
Definition hierarchy.h:42
int ** cv2v
Definition hierarchy.h:51
int * nedges
Definition hierarchy.h:43
ex_vtx_data ** geom_graphs
Definition hierarchy.h:41
int nlevels
Definition hierarchy.h:39
int ** v2cv
Definition hierarchy.h:46
int maxNodeIndex
Definition hierarchy.h:52
float physical_y_coord
Definition hierarchy.h:29
float old_physical_y_coord
Definition hierarchy.h:32
float old_physical_x_coord
Definition hierarchy.h:31
int old_active_level
Definition hierarchy.h:33
float physical_x_coord
Definition hierarchy.h:28
int globalIndex
Definition hierarchy.h:21
float x_coord
Definition hierarchy.h:24
int active_level
Definition hierarchy.h:20
float y_coord
Definition hierarchy.h:25
int * edges
Definition hierarchy.h:18
int dist2_limit
Definition hierarchy.h:63
int num_fine_nodes
Definition hierarchy.h:56
double coarsening_rate
Definition hierarchy.h:57