File: graph.h

package info (click to toggle)
scilab 2.6-4
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 54,632 kB
  • ctags: 40,267
  • sloc: ansic: 267,851; fortran: 166,549; sh: 10,005; makefile: 4,119; tcl: 1,070; cpp: 233; csh: 143; asm: 135; perl: 130; java: 39
file content (125 lines) | stat: -rw-r--r-- 2,638 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#include <stdio.h>

typedef int node_type;
#define PLAIN 0
#define SINK 1
#define SOURCE 2

#define LOOP 1000
#define HIDDEN -9999

#define MAXARCS 21
#define ERRTYPE -9999

#define MAXNAM 80

typedef struct nodedef {
  int number;
  char *name;
  char *label;
  list *connected_arcs;
  list *loop_arcs;
  double demand;
  node_type type;
  int x, y;
  int col;
  int diam;
  int border;
  int fontSize;
  int hilited;
} node, *nodeptr;

extern void DrawNode();
extern void EraseNode();
extern void HiliteNode();
extern void HiliteNode1();
extern node *NodeAlloc();
extern void PrintNode();
extern void UnhiliteNode();
extern void UnhiliteNode1();

typedef struct arcdef {
  int number;
  char *name;
  char *label;
  node *head;
  node *tail;
  double unitary_cost;
  double minimum_capacity;
  double maximum_capacity;
  double length;
  double quadratic_weight;
  double quadratic_origin;
  double weight;
  int g_type;
  int x0, y0, x1, y1, x2, y2, x3, y3, xmax, ymax, xa0, ya0,
  xa1, ya1, xa2, ya2;
  double si, co;
  int col;
  int width;
  int hiWidth;
  int fontSize;
  int hilited;
} arc, *arcptr;
 
extern arc *ArcAlloc();
extern void DrawArc();
extern void EraseArc();
extern void HiliteArc();
extern void HiliteArc1();
extern void PrintArc();
extern void SetCoordinatesArc();
extern void UnhiliteArc();
extern void UnhiliteArc1();

typedef struct graphdef {
  char name[MAXNAM];
  int directed;
  int node_number;
  int arc_number;
  int sink_number;
  int source_number;
  list *sinks; 
  list *sources;
  list *arcs; /* in decreasing order of arc numbers */
  list *nodes; /* in decreasing order of node numbers */
  arc **arcArray;
  node **nodeArray;
  int nodeDiam;
  int nodeBorder;
  int arcWidth;
  int arcHiWidth;
  int fontSize;
} graph;

extern void DestroyGraph();
extern void DrawGraph();
extern graph *DuplicateGraph();
extern graph *GraphAlloc();

extern arc *AddArc();
extern node *AddNode();
extern arc *GetArc();
extern node *GetNode();

extern void MakeArraysGraph();

typedef struct GG {
  int n_hilited_arcs;
  int n_hilited_nodes;
  list *hilited_arcs;
  list *hilited_nodes;
  node *moving;
  int modified;
} GG;

extern GG theGG;
extern graph *theGraph;

#define NodeDiam(n) ((n->diam) ? (n->diam) : (theGraph->nodeDiam))
#define NodeBorder(n) ((n->border) ? (n->border) : (theGraph->nodeBorder))
#define NodeFontSize(n) ((n->fontSize) ? (n->fontSize) : (theGraph->fontSize))

#define ArcWidth(a) ((a->width) ? (a->width) : (theGraph->arcWidth))
#define ArcHiWidth(a) ((a->hiWidth) ? (a->hiWidth) : (theGraph->arcHiWidth))
#define ArcFontSize(n) ((a->fontSize) ? (a->fontSize) : (theGraph->fontSize))