Graphviz 12.0.1~dev.20240716.0800
Loading...
Searching...
No Matches
fdp.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
13#include <common/render.h>
14
15#ifdef FDP_PRIVATE
16
17#define NDIM 2
18
19typedef struct bport_s {
20 edge_t *e;
21 node_t *n;
22 double alpha;
23} bport_t;
24
25/* gdata is attached to the root graph, each cluster graph,
26 * and to each derived graph.
27 * Graphs also use "builtin" fields:
28 * n_cluster, clust - to record clusters
29 */
30typedef struct {
31 bport_t *ports; /* boundary ports. 0-terminated */
32 int nports; /* no. of ports */
33 boxf bb; /* bounding box of graph */
34 int flags;
35 int level; /* depth in graph hierarchy */
36 graph_t *parent; /* smallest containing cluster */
37#ifdef DEBUG
38 graph_t *orig; /* original of derived graph */
39#endif
40} gdata;
41
42#define GDATA(g) ((gdata*)(GD_alg(g)))
43#define BB(g) (GDATA(g)->bb)
44#define PORTS(g) (GDATA(g)->ports)
45#define NPORTS(g) (GDATA(g)->nports)
46#define LEVEL(g) (GDATA(g)->level)
47#define GPARENT(g) (GDATA(g)->parent)
48#ifdef DEBUG
49#define GORIG(g) (GDATA(g)->orig)
50#endif
51
52/*
53 * Real nodes use "builtin" fields:
54 * ND_pos - position information
55 * ND_width,ND_height - node dimensions
56 * ND_pinned
57 * ND_lw,ND_rw,ND_ht - node dimensions in points
58 * ND_id
59 * ND_shape, ND_shape_info
60 *
61 * In addition, we use two of the dot fields for parent and derived node.
62 * Previously, we attached these via ND_alg, but ND_alg may be needed for
63 * spline routing, and splines=compound also requires the parent field.
64 */
65#define DNODE(n) (ND_next(n))
66#define PARENT(n) (ND_clust(n))
67
68/* dndata is attached to nodes in derived graphs.
69 * Derived nodes also use "builtin" fields:
70 * clust - for cluster nodes, points to cluster in real graph.
71 * pos - position information
72 * width,height - node dimensions
73 */
74typedef struct {
75 int deg; /* degree of node */
76 int wdeg; /* weighted degree of node */
77 node_t *dn; /* If derived node is not a cluster, */
78 /* dn points real node. */
79 double disp[NDIM]; /* incremental displacement */
80} dndata;
81
82#define DNDATA(n) ((dndata*)(ND_alg(n)))
83#define DISP(n) (DNDATA(n)->disp)
84#define ANODE(n) (DNDATA(n)->dn)
85#define DEG(n) (DNDATA(n)->deg)
86#define WDEG(n) (DNDATA(n)->wdeg)
87#define IS_PORT(n) (!ANODE(n) && !ND_clust(n))
88
89#endif /* FDP_PRIVATE */
90
91#ifdef __cplusplus
92extern "C" {
93#endif
94
95struct fdpParms_s {
96 int useGrid; /* use grid for speed up */
97 int useNew; /* encode x-K into attractive force */
98 int numIters; /* actual iterations in layout */
99 int unscaled; /* % of iterations used in pass 1 */
100 double C; /* Repulsion factor in xLayout */
101 double Tfact; /* scale temp from default expression */
102 double K; /* spring constant; ideal distance */
103 double T0; /* initial temperature */
104};
105typedef struct fdpParms_s fdpParms_t;
106
107 extern void fdp_layout(Agraph_t * g);
108 extern void fdp_init_node_edge(Agraph_t * g);
109 extern void fdp_cleanup(Agraph_t * g);
110
111#ifdef __cplusplus
112}
113#endif
#define parent(i)
Definition closest.c:78
gval_t gdata
Definition compile.h:50
void fdp_cleanup(Agraph_t *g)
Definition fdpinit.c:143
void fdp_layout(Agraph_t *g)
Definition layout.c:1080
void fdp_init_node_edge(Agraph_t *g)
Definition fdpinit.c:87
static int flags
Definition gc.c:61
#define alpha
Definition shapes.c:4068
graph or subgraph
Definition cgraph.h:425
Definition geom.h:41
double C
Definition fdp.h:100
int useNew
Definition fdp.h:97
int useGrid
Definition fdp.h:96
int unscaled
Definition fdp.h:99
double K
Definition fdp.h:102
double T0
Definition fdp.h:103
int numIters
Definition fdp.h:98
double Tfact
Definition fdp.h:101