/[paths]/src/graph.h
ViewVC logotype

Annotation of /src/graph.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 76 - (hide annotations)
Fri Aug 31 03:14:09 2012 UTC (8 years, 1 month ago) by ben
File MIME type: text/plain
File size: 1444 byte(s)
make chromatic distance model displayable
1 ben 2 #ifndef GRAPH_H
2     #define GRAPH_H
3     struct event {
4 ben 29 unsigned char pitch; /* midi note number */
5     int duration; /* microsecond */
6     unsigned short int bend; /* pitchbend value */
7     unsigned char velocity;
8     unsigned char volume;
9 ben 64 unsigned int ref; /* crawler ref count */
10 ben 2 };
11    
12     struct node;
13    
14     struct edge {
15     struct node *to;
16 ben 64 struct node *from;
17 ben 2 int distance;
18 ben 72
19     void* egg; /* pointer to graphical representation */
20 ben 2 };
21    
22     struct node {
23 ben 6 struct event event;
24 ben 2 int wheight;
25     struct edge *neighbours;
26 ben 3 int count;
27 ben 72
28     void* egg; /* pointer to graphical representation */
29 ben 2 };
30    
31 ben 4 struct graph {
32     struct node* nodes;
33 ben 64 struct edge* edges;
34 ben 72 int count; /* node count */
35     int lcount; /* link count */
36    
37     void* egg; /* pointer to graphical representation */
38 ben 6 };
39 ben 4
40 ben 76 typedef int (*distance_fun) (struct node* a, struct node* b);
41    
42     int distance_randomize(struct node* a, struct node* b);
43     int distance_chromatic(struct node* a, struct node* b);
44     int distance_diatonic(struct node* a, struct node* b);
45    
46 ben 2 void node_destroy(struct node* n);
47    
48 ben 5 void node_radomize(struct node* n);
49 ben 2
50 ben 10 int node_is_linked(struct node* a, struct node* b);
51    
52 ben 76 int node_link(struct node* a, struct node* b, distance_fun fun);
53 ben 2
54 ben 6 int node_unlink(struct node* a, struct node* b);
55 ben 2
56 ben 11 /* n: node number */
57 ben 5 struct graph* graph_new(int n);
58 ben 2
59 ben 11 /* l: edge number */
60     int graph_randomize1(struct graph*, int l);
61 ben 2
62 ben 11 /* l: min edges per node */
63     int graph_randomize2(struct graph*, int l);
64    
65 ben 10 void graph_destroy(struct graph* g);
66    
67 ben 2 #endif

  ViewVC Help
Powered by ViewVC 1.1.26