-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomponent.h
More file actions
43 lines (29 loc) · 1004 Bytes
/
component.h
File metadata and controls
43 lines (29 loc) · 1004 Bytes
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
#ifndef COMPONENT_H
#define COMPONENT_H
#include <unordered_map>
#include <vector>
#define NUM_VERTEX 101
using edges = std::vector< std::pair<int, double> >;
class Component {
public:
// an unordered_map of vectors of pairs
// each key 0represents a vertex
// each value is a vector of edges of a vertex
// pair.first is the vertex's neighbor, pair.second is the weight
std::unordered_map<int, edges> c;
Component() = default;
// copy constructor
Component(const Component &comp);
// returns a vector with all the centers in a component
std::vector<int> center();
// returns the diameter of the component
double diameter();
// returns the eccentricity of a vertex
double eccentricity(int v);
// returns the radius of the component
double radius();
int combination(int n);
int openTriangles();
int closedTriangles();
};
#endif