-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCGraph.h
51 lines (39 loc) · 1.16 KB
/
CGraph.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
51
#ifndef _CGraph_20140215
#define _CGraph_20140215
#include <iostream>
#include "CList.h"
#include "Eigen/Core"
using namespace std;
using namespace Eigen;
#define GRAPH_RESERVE_UNIT 0x100
#define tLC(a, b) topLeftCorner(a, b)
#define bRC(a, b) bottomRightCorner(a, b)
class CGraphAdj;
class CGraphInc;
class CGraphAdj {
MatrixXi adj;
VectorXi node_id, rc_index;
unsigned long num_nodes, num_edges, reserve;
CList *id_rest;
public:
CGraphAdj(unsigned long n);
CGraphAdj(MatrixXi ad, VectorXi id = VectorXi::Zero(0));
~CGraphAdj();
MatrixXi get_adj();
VectorXi get_node_ids();
VectorXi get_rc_indices();
unsigned long get_num_edges_between(unsigned long u, unsigned long v);
unsigned long get_node_id(unsigned long k);
unsigned long get_rc_index(unsigned long v);
unsigned long get_num_nodes();
unsigned long get_num_edges();
unsigned long add_node();
CList* add_nodes(unsigned long n);
void remove_node(unsigned long v);
void remove_nodes(CList* v_list);
void add_edge(unsigned long u, unsigned long v, bool directed = false);
bool remove_edge(unsigned long u, unsigned long v, bool directed = false);
};
class CGraphInc {
};
#endif