Graphviz  2.41.20171026.1811
spring_electrical.h
Go to the documentation of this file.
1 /* $Id$ $Revision$ */
2 /* vim:set shiftwidth=4 ts=8: */
3 
4 /*************************************************************************
5  * Copyright (c) 2011 AT&T Intellectual Property
6  * All rights reserved. This program and the accompanying materials
7  * are made available under the terms of the Eclipse Public License v1.0
8  * which accompanies this distribution, and is available at
9  * http://www.eclipse.org/legal/epl-v10.html
10  *
11  * Contributors: See CVS logs. Details at http://www.graphviz.org/
12  *************************************************************************/
13 
14 #ifndef SPRING_ELECTRICAL_H
15 #define SPRING_ELECTRICAL_H
16 
17 #include <SparseMatrix.h>
18 
20 
21 /* a flag to indicate that p should be set auto */
22 #define AUTOP -1.0001234
23 
25 
26 enum {QUAD_TREE_HYBRID_SIZE = 10000};
27 
29 
31 
33  real p;/*a negativve real number default to -1. repulsive force = dist^p */
34  real q;/*a positive real number default to 2. attractive force = dist^q */
35  int random_start;/* whether to apply SE from a random layout, or from exisiting layout */
36  real K;/* the natural distance. If K < 0, K will be set to the average distance of an edge */
37  real C;/* another parameter. f_a(i,j) = C*dist(i,j)^2/K * d_ij, f_r(i,j) = K^(3-p)/dist(i,j)^(-p). By default C = 0.2. */
38  int multilevels;/* if <=1, single level */
39  int multilevel_coarsen_scheme;/* pass on to Multilevel_control->coarsen_scheme */
40  int multilevel_coarsen_mode;/* pass on to Multilevel_control->coarsen_mode */
41  int quadtree_size;/* cut off size above which quadtree approximation is used */
42  int max_qtree_level;/* max level of quadtree */
43  real bh;/* Barnes-Hutt constant, if width(snode)/dist[i,snode] < bh, treat snode as a supernode. default 0.2*/
44  real tol;/* minimum different between two subsequence config before terminating. ||x-xold|| < tol */
45  int maxiter;
46  real cool;/* default 0.9 */
47  real step;/* initial step size */
52  int smoothing;
53  int overlap;
55  int tscheme; /* octree scheme. 0 (no octree), 1 (normal), 2 (fast) */
56  int method;/* spring_electical, spring_maxent */
57  real initial_scaling;/* how to scale the layout of the graph before passing to overlap removal algorithm.
58  positive values are absolute in points, negative values are relative
59  to average label size.
60  */
61  real rotation;/* degree of rotation */
62  int edge_labeling_scheme; /* specifying whether to treat node of the form |edgelabel|* as a special node representing an edge label.
63  0 (no action, default), 1 (penalty based method to make that kind of node close to the center of its neighbor),
64  1 (penalty based method to make that kind of node close to the old center of its neighbor),
65  3 (two step process of overlap removal and straightening) */
66 };
67 
69 
70 spring_electrical_control spring_electrical_control_new(void);
71 void spring_electrical_control_print(spring_electrical_control ctrl);
72 
73 void spring_electrical_embedding(int dim, SparseMatrix A0, spring_electrical_control ctrl, real *node_weights, real *x, int *flag);
74 void spring_electrical_embedding_fast(int dim, SparseMatrix A0, spring_electrical_control ctrl, real *node_weights, real *x, int *flag);
75 
76 void multilevel_spring_electrical_embedding(int dim, SparseMatrix A0, SparseMatrix D, spring_electrical_control ctrl, real *node_weights, real *label_sizes,
77  real *x, int n_edge_label_nodes, int *edge_label_nodes, int *flag);
78 
79 void export_embedding(FILE *fp, int dim, SparseMatrix A, real *x, real *width);
80 void spring_electrical_control_delete(spring_electrical_control ctrl);
81 void print_matrix(real *x, int n, int dim);
82 
84 
85 void spring_electrical_spring_embedding(int dim, SparseMatrix A, SparseMatrix D, spring_electrical_control ctrl, real *node_weights, real *x, int *flag);
86 void force_print(FILE *fp, int n, int dim, real *x, real *force);
87 
88 enum {MAX_I = 20, OPT_UP = 1, OPT_DOWN = -1, OPT_INIT = 0};
90  int i;
92  int direction;
93 };
95 void oned_optimizer_delete(oned_optimizer opt);
96 oned_optimizer oned_optimizer_new(int i);
97 void oned_optimizer_train(oned_optimizer opt, real work);
98 int oned_optimizer_get(oned_optimizer opt);
99 void interpolate_coord(int dim, SparseMatrix A, real *x);
101 void pcp_rotate(int n, int dim, real *x);
102 #endif
spring_electrical_control spring_electrical_control_new()
void spring_electrical_control_delete(spring_electrical_control ctrl)
oned_optimizer oned_optimizer_new(int i)
void spring_electrical_embedding(int dim, SparseMatrix A0, spring_electrical_control ctrl, real *node_weights, real *x, int *flag)
void interpolate_coord(int dim, SparseMatrix A, real *x)
void spring_electrical_embedding_fast(int dim, SparseMatrix A0, spring_electrical_control ctrl, real *node_weights, real *x, int *flag)
struct oned_optimizer_struct * oned_optimizer
void oned_optimizer_delete(oned_optimizer opt)
void export_embedding(FILE *fp, int dim, SparseMatrix A, real *x, real *width)
void print_matrix(real *x, int n, int dim)
void spring_electrical_spring_embedding(int dim, SparseMatrix A0, SparseMatrix D, spring_electrical_control ctrl, real *node_weights, real *x, int *flag)
void force_print(FILE *fp, int n, int dim, real *x, real *force)
void spring_electrical_control_print(spring_electrical_control ctrl)
real average_edge_length(SparseMatrix A, int dim, real *coord)
void multilevel_spring_electrical_embedding(int dim, SparseMatrix A, SparseMatrix D, spring_electrical_control ctrl, real *node_weights, real *label_sizes, real *x, int n_edge_label_nodes, int *edge_label_nodes, int *flag)
void pcp_rotate(int n, int dim, real *x)
int oned_optimizer_get(oned_optimizer opt)
int power_law_graph(SparseMatrix A)
void oned_optimizer_train(oned_optimizer opt, real work)
pointf coord(node_t *n)
Definition: utils.c:202
struct spring_electrical_control_struct * spring_electrical_control
#define real
Definition: general.h:34