-
Notifications
You must be signed in to change notification settings - Fork 0
/
graph.h
42 lines (35 loc) · 1.04 KB
/
graph.h
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
/***************************************
April 2014 Chaofan Li <chaof@tamu.edu>
April 2016 Yuchao Zhou <yzhou110@hawk.iit.edu>
***************************************/
#ifndef __GRAPH_H__
#define __GRAPH_H__
#define MAX_EDGE_WEIGHT 5000000
#define MIN_PARTITION_SIZE 100
#define MAX_PARTITION_SIZE 10
#include <stdio.h>
typedef struct _Vertex{
int degree ;
int label ;
int rank ;//for use with Make-Set-Find
int group;
int (*list)[2];//[label, weight]
struct _Vertex *parent ;//for use with Make-Set-Find
} Vertex;
typedef struct _Graph{
int V ;
int E ;
int (*edge_list)[2] ; // [label,weight]
int (*edge_pair)[2] ; //[v1, v2]
Vertex **adj_list ;
} Graph;
extern Graph *new_graph(int V, Vertex *vertex_list[]) ;
extern Vertex *new_vertex(int label) ;
extern void free_vertex(Vertex *v);
extern void free_graph(Graph *G);
extern void add_adjacency_vertex(Vertex *v, int label, int weight) ;
extern Graph *gen(int D, int V) ;
extern void pg(Graph *, FILE *fp) ;
extern void pv(Vertex *, FILE *fp) ;
extern void edges(Graph *, FILE* output) ;
#endif