Graphviz  2.29.20120524.0446
lib/neatogen/kkutils.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 #ifdef __cplusplus
00015 extern "C" {
00016 #endif
00017 
00018 
00019 
00020 #ifndef KKUTILS_H_
00021 #define KKUTILS_H_
00022 
00023 #include "defs.h"
00024 
00025 #ifdef __cplusplus
00026 
00027     inline double distance_kD(double **coords, int dim, int i, int j) {
00028         /* compute a k-D Euclidean distance between 'coords[*][i]' and 'coords[*][j]' */
00029         double sum = 0;
00030         for (int k = 0; k < dim; k++) {
00031             sum +=
00032                 (coords[k][i] - coords[k][j]) * (coords[k][i] -
00033                                                  coords[k][j]);
00034         } return sqrt(sum);
00035     }
00036     void compute_apsp(vtx_data * graph, int n, DistType ** (&Dij));
00037     void compute_apsp_artifical_weights(vtx_data * graph, int n,
00038                                         DistType ** (&Dij));
00039 
00040     void quicksort_place(double *place, int *ordering, int first, int last);
00041     void free_graph(vtx_data * (&graph));
00042 #else
00043     extern void fill_neighbors_vec_unweighted(vtx_data *, int vtx,
00044                                               int *vtx_vec);
00045     extern int common_neighbors(vtx_data *, int v, int u, int *);
00046     extern void empty_neighbors_vec(vtx_data * graph, int vtx,
00047                                     int *vtx_vec);
00048     extern DistType **compute_apsp(vtx_data *, int);
00049     extern DistType **compute_apsp_artifical_weights(vtx_data *, int);
00050     extern double distance_kD(double **, int, int, int);
00051     extern void quicksort_place(double *, int *, int, int);
00052     extern void quicksort_placef(float *, int *, int, int);
00053     extern void compute_new_weights(vtx_data * graph, int n);
00054     extern void restore_old_weights(vtx_data * graph, int n,
00055                                     float *old_weights);
00056 #endif
00057 
00058 #endif
00059 
00060 #ifdef __cplusplus
00061 }
00062 #endif