-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGraph.h
50 lines (44 loc) · 1.15 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
43
44
45
46
47
48
49
50
#ifndef _GRAPH_H
#define _GRAPH_H
#include "GArray.h"
#include "assoc.h"
using namespace std;
class GrItem{
private:
int it;
int itsup;
public:
GrItem(int itt=0, int ittsup=0):it(itt), itsup(ittsup){};
int& adj(){ return it; }
int& sup(){ return itsup; }
static int cmp_grit(const void *a, const void *b);
friend ostream& operator << (ostream& fout, GrItem git);
};
class GrNode: public GArray<GrItem *>{
private:
int theItem;
int theItemSup;
long theSupSum;
//Array<int> *theSup;
public:
GrNode(int sz=0):GArray<GrItem *>(sz), //theSup(Array<int>(sz)),
theItem(-1), theItemSup(0), theSupSum(0){}
int& item(){ return theItem; }
int& sup(){ return theItemSup; }
long & supsum(){ return theSupSum; }
boolean find(int val);
static int cmp_vertex(const void *a, const void *b);
};
class Graph: public GArray<GrNode *>{
private:
public:
static int numF1;
Graph(int nv):GArray<GrNode *>(nv){}
~Graph();
void add_node(int item, int sup, int supsum=0);
void add_adj(int vert, int nbr, int nbrsup);
boolean connected(int vi, int vj);
void sort();
//void print_iset(Itemset *it);
};
#endif //_GRAPH_H