Debian Codegraph @

lib/neatogen/overlap.h

raw
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 <sfdpgen/post_process.h>
14 #include <stdbool.h>
15 #include <util/api.h>
16
17 typedef StressMajorizationSmoother OverlapSmoother;
18
19 #define OverlapSmoother_struct StressMajorizationSmoother_struct
20
21 PRIVATE void OverlapSmoother_delete(OverlapSmoother sm);
22
23 PRIVATE OverlapSmoother OverlapSmoother_new(SparseMatrix A, int m, int dim, double *x,
24 double *width, bool neighborhood_only,
25 double *max_overlap, double *min_overlap,
26 int edge_labeling_scheme,
27 int n_constr_nodes, int *constr_nodes,
28 SparseMatrix A_constr, int shrink);
29
30 enum {ELSCHEME_NONE = 0, ELSCHEME_PENALTY, ELSCHEME_PENALTY2, ELSCHEME_STRAIGHTLINE_PENALTY, ELSCHEME_STRAIGHTLINE_PENALTY2};
31
32 struct relative_position_constraints_struct{
33 double constr_penalty; /* penalty parameter used in making edge labels as much on the line as possible */
34 int edge_labeling_scheme;/* specifying whether to treat node of the form |edgelabel|* as a special node representing an edge label.
35 0 (no action, default), 1 (penalty based method to make that kind of node close to the center of its neighbor),
36 2 (penalty based method to make that kind of node close to the "old" center of its neighbor),
37 3 (two step process of overlap removal and straightening) */
38 int n_constr_nodes;/*n_constr_nodes: number of nodes that has constraints, these are nodes that is
39 constrained to be close to the average of its neighbors.*/
40 int *constr_nodes;/*constr_nodes: a list of nodes that need to be constrained. If NULL, unused.*/
41 int *irn;/* working arrays to hold the Laplacian of the constrain graph */
42 int *jcn;
43 double *val;
44 SparseMatrix A_constr; /*A_constr: neighbors of node i are in the row i of this matrix. i needs to sit
45 in between these neighbors as much as possible. this must not be NULL
46 if constr_nodes != NULL.*/
47
48 };
49
50 typedef struct relative_position_constraints_struct* relative_position_constraints;
51
52 PRIVATE double OverlapSmoother_smooth(OverlapSmoother sm, int dim, double *x);
53
54 PRIVATE void remove_overlap(int dim, SparseMatrix A, double *x, double *label_sizes,
55 int ntry, double initial_scaling, int edge_labeling_scheme,
56 int n_constr_nodes, int *constr_nodes,
57 SparseMatrix A_constr, bool doShrink);