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#ifdef __cplusplus
15extern "C" {
16#endif
17
18
19
20#ifndef KKUTILS_H_
21#define KKUTILS_H_
22
23#include "defs.h"
24
25#ifdef __cplusplus
26
27 inline double distance_kD(double **coords, int dim, int i, int j) {
28 /* compute a k-D Euclidean distance between 'coords[*][i]' and 'coords[*][j]' */
29 double sum = 0;
30 for (int k = 0; k < dim; k++) {
31 sum +=
32 (coords[k][i] - coords[k][j]) * (coords[k][i] -
33 coords[k][j]);
34 } return sqrt(sum);
35 }
36 void compute_apsp(vtx_data * graph, int n, DistType ** (&Dij));
37 void compute_apsp_artifical_weights(vtx_data * graph, int n,
38 DistType ** (&Dij));
39
40 void quicksort_place(double *place, int *ordering, int first, int last);
41 void free_graph(vtx_data * (&graph));
42#else
43 extern void fill_neighbors_vec_unweighted(vtx_data *, int vtx,
44 int *vtx_vec);
45 extern int common_neighbors(vtx_data *, int v, int u, int *);
46 extern void empty_neighbors_vec(vtx_data * graph, int vtx,
47 int *vtx_vec);
48 extern DistType **compute_apsp(vtx_data *, int);
49 extern DistType **compute_apsp_artifical_weights(vtx_data *, int);
50 extern double distance_kD(double **, int, int, int);
51 extern void quicksort_place(double *, int *, int, int);
52 extern void quicksort_placef(float *, int *, int, int);
53 extern void compute_new_weights(vtx_data * graph, int n);
54 extern void restore_old_weights(vtx_data * graph, int n,
55 float *old_weights);
56#endif
57
58#endif
59
60#ifdef __cplusplus
61}
62#endif
63