| 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 | * http://www.eclipse.org/legal/epl-v10.html |
| 7 | * |
| 8 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ |
| 9 | *************************************************************************/ |
| 10 | #ifndef EDGE_BUNDLING_H |
| 11 | #define EDGE_BUNDLING_H |
| 12 | |
| 13 | #include <SparseMatrix.h> |
| 14 | |
| 15 | struct pedge_struct { |
| 16 | real wgt; /* weight, telling how many original edges this edge represent. If this edge consists of multiple sections of different weights then this is a lower bound. This only applied for agglomerative bundling */ |
| 17 | int npoints;/* number of poly points */ |
| 18 | int len;/* length of arra x. len >= npoints */ |
| 19 | int dim;/* dim >= 2. Point i is stored from x[i*dim]*/ |
| 20 | real edge_length; |
| 21 | real *x;/* coordinates of the npoints poly points. Dimension dim*npoints */ |
| 22 | real *wgts;/* number of original edges each section represnet. Dimension npoint - 1. This only applied for agglomerative bundling Null for other methods */ |
| 23 | }; |
| 24 | |
| 25 | typedef struct pedge_struct* pedge; |
| 26 | |
| 27 | pedge* edge_bundling(SparseMatrix A, int dim, real *x, int maxit_outer, real K, int method, int nneighbor, int compatibility_method, int max_recursion, real angle_param, real angle, int open_gl); |
| 28 | void pedge_delete(pedge e); |
| 29 | pedge pedge_realloc(pedge e, int np); |
| 30 | pedge pedge_wgts_realloc(pedge e, int n); |
| 31 | void pedge_export_mma(FILE *fp, int ne, pedge *edges); |
| 32 | void pedge_export_gv(FILE *fp, int ne, pedge *edges); |
| 33 | enum {METHOD_NONE = -1, METHOD_FD, METHOD_INK_AGGLOMERATE, METHOD_INK}; |
| 34 | enum {COMPATIBILITY_DIST = 0, COMPATIBILITY_FULL}; |
| 35 | pedge pedge_new(int np, int dim, real *x); |
| 36 | pedge pedge_wgt_new(int np, int dim, real *x, real wgt); |
| 37 | pedge pedge_double(pedge e); |
| 38 | |
| 39 | /* flip the polyline so that last point becomes the first, second last the second, etc*/ |
| 40 | pedge pedge_flip(pedge e); |
| 41 | |
| 42 | |
| 43 | #endif /* EDGE_BUNDLING_H */ |
| 44 | |
| 45 | |
| 46 | |