edge_bundling.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. #pragma once
  11. #include <sparse/SparseMatrix.h>
  12. #include <vector>
  13. struct pedge {
  14. double 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 */
  15. int npoints;/* number of poly points */
  16. int len;/* length of arra x. len >= npoints */
  17. int dim;/* dim >= 2. Point i is stored from x[i*dim]*/
  18. double edge_length;
  19. std::vector<double> x; ///< coordinates of the npoints poly points. Dimension dim*npoints
  20. std::vector<double> wgts;/* number of original edges each section represnet. Dimension npoint - 1. This only applied for agglomerative bundling Null for other methods */
  21. };
  22. std::vector<pedge> edge_bundling(SparseMatrix A, int dim,
  23. const std::vector<double> &x, int maxit_outer,
  24. double K, int method, int nneighbor,
  25. int compatibility_method, int max_recursion,
  26. double angle_param, double angle);
  27. void pedge_delete(pedge &e);
  28. void pedge_wgts_realloc(pedge &e, int n);
  29. void pedge_export_gv(FILE *fp, int ne, const std::vector<pedge> &edges);
  30. enum {METHOD_NONE = -1, METHOD_FD, METHOD_INK_AGGLOMERATE, METHOD_INK};
  31. enum {COMPATIBILITY_DIST = 0, COMPATIBILITY_FULL};
  32. pedge pedge_wgt_new(int np, int dim, double *x, double wgt);
  33. void pedge_double(pedge &e);