Graphviz  2.29.20120524.0446
lib/neatogen/overlap.h
Go to the documentation of this file.
00001 /* $Id$ $Revision$ */
00002 /* vim:set shiftwidth=4 ts=8: */
00003 
00004 /*************************************************************************
00005  * Copyright (c) 2011 AT&T Intellectual Property 
00006  * All rights reserved. This program and the accompanying materials
00007  * are made available under the terms of the Eclipse Public License v1.0
00008  * which accompanies this distribution, and is available at
00009  * http://www.eclipse.org/legal/epl-v10.html
00010  *
00011  * Contributors: See CVS logs. Details at http://www.graphviz.org/
00012  *************************************************************************/
00013 
00014 #ifndef OVERLAP_H
00015 #define OVERLAP_H
00016 
00017 #include "post_process.h"
00018 
00019 typedef  StressMajorizationSmoother OverlapSmoother;
00020 
00021 #define OverlapSmoother_struct StressMajorizationSmoother_struct
00022 
00023 void OverlapSmoother_delete(OverlapSmoother sm);
00024 
00025 OverlapSmoother OverlapSmoother_new(SparseMatrix A, int m,
00026                                     int dim, real lambda0, real *x, real *width, int include_original_graph, int neighborhood_only,
00027                                     real *max_overlap, real *min_overlap,
00028                                     int edge_labeling_scheme, int n_constr_nodes, int *constr_nodes, SparseMatrix A_constr, int shrink
00029                                     );
00030 
00031 enum {ELSCHEME_NONE = 0, ELSCHEME_PENALTY, ELSCHEME_PENALTY2, ELSCHEME_STRAIGHTLINE_PENALTY, ELSCHEME_STRAIGHTLINE_PENALTY2};
00032 
00033 struct relative_position_constraints_struct{
00034   real constr_penalty; /* penalty parameter used in making edge labels as much on the line as possible */
00035   int edge_labeling_scheme;/* specifying whether to treat node of the form |edgelabel|* as a special node representing an edge label.
00036                                0 (no action, default), 1 (penalty based method to make that kind of node close to the center of its neighbor),
00037                                2 (penalty based method to make that kind of node close to the "old" center of its neighbor),
00038                                3 (two step process of overlap removal and straightening) */
00039   int n_constr_nodes;/*n_constr_nodes: number of nodes that has constraints, these are nodes that is
00040                        constrained to be close to the average of its neighbors.*/
00041   int *constr_nodes;/*constr_nodes: a list of nodes that need to be constrained. If NULL, unused.*/
00042   int *irn;/* working arrays to hold the Laplacian of the constrain graph */
00043   int *jcn;
00044   real *val;
00045   SparseMatrix A_constr; /*A_constr: neighbors of node i are in the row i of this matrix. i needs to sit
00046                            in between these neighbors as much as possible. this must not be NULL
00047                            if constr_nodes != NULL.*/
00048 
00049 };
00050 
00051 typedef struct relative_position_constraints_struct*  relative_position_constraints;
00052 
00053 real OverlapSmoother_smooth(OverlapSmoother sm, int dim, real *x);
00054 
00055 void remove_overlap(int dim, SparseMatrix A, real *x, real *label_sizes, int ntry, real initial_scaling, 
00056                     int edge_labeling_scheme, int n_constr_nodes, int *constr_nodes, SparseMatrix A_constr, int *flag);
00057 
00058 #endif