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