~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to xmetanet/graph.h

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
 
 
3
typedef int node_type;
 
4
#define PLAIN 0
 
5
#define SINK 1
 
6
#define SOURCE 2
 
7
 
 
8
#define LOOP 1000
 
9
#define HIDDEN -9999
 
10
 
 
11
#define MAXARCS 21
 
12
#define ERRTYPE -9999
 
13
 
 
14
#define MAXNAM 80
 
15
 
 
16
typedef struct nodedef {
 
17
  int number;
 
18
  char *name;
 
19
  char *label;
 
20
  list *connected_arcs;
 
21
  list *loop_arcs;
 
22
  double demand;
 
23
  node_type type;
 
24
  int x, y;
 
25
  int col;
 
26
  int diam;
 
27
  int border;
 
28
  int fontSize;
 
29
  int hilited;
 
30
} node, *nodeptr;
 
31
 
 
32
extern void DrawNode();
 
33
extern void EraseNode();
 
34
extern void HiliteNode();
 
35
extern void HiliteNode1();
 
36
extern node *NodeAlloc();
 
37
extern void PrintNode();
 
38
extern void UnhiliteNode();
 
39
extern void UnhiliteNode1();
 
40
 
 
41
typedef struct arcdef {
 
42
  int number;
 
43
  char *name;
 
44
  char *label;
 
45
  node *head;
 
46
  node *tail;
 
47
  double unitary_cost;
 
48
  double minimum_capacity;
 
49
  double maximum_capacity;
 
50
  double length;
 
51
  double quadratic_weight;
 
52
  double quadratic_origin;
 
53
  double weight;
 
54
  int g_type;
 
55
  int x0, y0, x1, y1, x2, y2, x3, y3, xmax, ymax, xa0, ya0,
 
56
  xa1, ya1, xa2, ya2;
 
57
  double si, co;
 
58
  int col;
 
59
  int width;
 
60
  int hiWidth;
 
61
  int fontSize;
 
62
  int hilited;
 
63
} arc, *arcptr;
 
64
 
 
65
extern arc *ArcAlloc();
 
66
extern void DrawArc();
 
67
extern void EraseArc();
 
68
extern void HiliteArc();
 
69
extern void HiliteArc1();
 
70
extern void PrintArc();
 
71
extern void SetCoordinatesArc();
 
72
extern void UnhiliteArc();
 
73
extern void UnhiliteArc1();
 
74
 
 
75
typedef struct graphdef {
 
76
  char name[MAXNAM];
 
77
  int directed;
 
78
  int node_number;
 
79
  int arc_number;
 
80
  int sink_number;
 
81
  int source_number;
 
82
  list *sinks; 
 
83
  list *sources;
 
84
  list *arcs; /* in decreasing order of arc numbers */
 
85
  list *nodes; /* in decreasing order of node numbers */
 
86
  arc **arcArray;
 
87
  node **nodeArray;
 
88
  int nodeDiam;
 
89
  int nodeBorder;
 
90
  int arcWidth;
 
91
  int arcHiWidth;
 
92
  int fontSize;
 
93
} graph;
 
94
 
 
95
extern void DestroyGraph();
 
96
extern void DrawGraph();
 
97
extern graph *DuplicateGraph();
 
98
extern graph *GraphAlloc();
 
99
 
 
100
extern arc *AddArc();
 
101
extern node *AddNode();
 
102
extern arc *GetArc();
 
103
extern node *GetNode();
 
104
 
 
105
extern void MakeArraysGraph();
 
106
 
 
107
typedef struct GG {
 
108
  int n_hilited_arcs;
 
109
  int n_hilited_nodes;
 
110
  list *hilited_arcs;
 
111
  list *hilited_nodes;
 
112
  node *moving;
 
113
  int modified;
 
114
} GG;
 
115
 
 
116
extern GG theGG;
 
117
extern graph *theGraph;
 
118
 
 
119
#define NodeDiam(n) ((n->diam) ? (n->diam) : (theGraph->nodeDiam))
 
120
#define NodeBorder(n) ((n->border) ? (n->border) : (theGraph->nodeBorder))
 
121
#define NodeFontSize(n) ((n->fontSize) ? (n->fontSize) : (theGraph->fontSize))
 
122
 
 
123
#define ArcWidth(a) ((a->width) ? (a->width) : (theGraph->arcWidth))
 
124
#define ArcHiWidth(a) ((a->hiWidth) ? (a->hiWidth) : (theGraph->arcHiWidth))
 
125
#define ArcFontSize(n) ((a->fontSize) ? (a->fontSize) : (theGraph->fontSize))