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#ifndef SPARSEGRAPH_H
19#define SPARSEGRAPH_H
20
21#include "config.h"
22
23#ifdef __cplusplus
24 enum Style { regular, invisible };
25 struct vtx_data {
26 int nedges;
27 int *edges;
28 float *ewgts;
29 Style *styles;
30 float *edists; /* directed dist reflecting the direction of the edge */
31 };
32
33 typedef int DistType; /* must be signed!! */
34#if 0
35 inline double max(double x, double y) {
36 if (x >= y)
37 return x;
38 else
39 return y;
40 } inline double min(double x, double y) {
41 if (x <= y)
42 return x;
43 else
44 return y;
45 }
46
47 inline int max(int x, int y) {
48 if (x >= y)
49 return x;
50 else
51 return y;
52 }
53
54 inline int min(int x, int y) {
55 if (x <= y)
56 return x;
57 else
58 return y;
59 }
60#endif
61
62 struct Point {
63 double x;
64 double y;
65 int operator==(Point other) {
66 return x == other.x && y == other.y;
67 }};
68#else
69
70#ifdef USE_STYLES
71 typedef enum { regular, invisible } Style;
72#endif
73 typedef struct {
74 int nedges; /* no. of neighbors, including self */
75 int *edges; /* edges[0..(nedges-1)] are neighbors; edges[0] is self */
76 float *ewgts; /* preferred edge lengths */
77 } v_data;
78
79 typedef struct {
80 int nedges; /* no. of neighbors, including self */
81 int *edges; /* edges[0..(nedges-1)] are neighbors; edges[0] is self */
82 float *ewgts; /* preferred edge lengths */
83 float *eweights; /* edge weights */
84#ifdef USE_STYLES
85 Style *styles;
86#endif
87#ifdef DIGCOLA
88 float *edists; /* directed dist reflecting the direction of the edge */
89#endif
90 } vtx_data;
91
92 typedef int DistType; /* must be signed!! */
93
94extern void freeGraphData(vtx_data * graph);
95extern void freeGraph(v_data * graph);
96
97#endif
98
99#endif
100
101#ifdef __cplusplus
102}
103#endif
104