Graphviz  2.41.20170921.2350
sparsegraph.h
Go to the documentation of this file.
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
15 extern "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 
94 extern void freeGraphData(vtx_data * graph);
95 extern void freeGraph(v_data * graph);
96 
97 #endif
98 
99 #endif
100 
101 #ifdef __cplusplus
102 }
103 #endif
float * eweights
Definition: sparsegraph.h:83
double y
Definition: geometry.h:27
double x
Definition: geometry.h:27
#define max(x, y)
Definition: stress.c:794
int nedges
Definition: sparsegraph.h:80
int * edges
Definition: sparsegraph.h:81
Agraph_t * graph(char *name)
Definition: gv.cpp:38
int DistType
Definition: sparsegraph.h:92
float * ewgts
Definition: sparsegraph.h:82
void freeGraphData(vtx_data *graph)
Definition: delaunay.c:908
Definition: geometry.h:26
float * ewgts
Definition: sparsegraph.h:76
int * edges
Definition: sparsegraph.h:75
int nedges
Definition: sparsegraph.h:74
void freeGraph(v_data *graph)
Definition: delaunay.c:897