-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraph.h
More file actions
43 lines (30 loc) · 1.13 KB
/
graph.h
File metadata and controls
43 lines (30 loc) · 1.13 KB
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 GRAPH_H
#define GRAPH_H
#include <utility>
#include "component.h"
class Graph {
public:
// an 100-element vector of vectors of pairs
// rows represent vertices
// columns represent the edges of a vertex
// pair.first is the vertex's neighbor, pair.second is the weight
std::vector<edges> adjList;
// a vector of components, i.e. connected subgraphs
std::vector<Component> cp;
// a 20-element array for hobbies
double hobbies[NUM_VERTEX][20] = {{0}};
Graph();
// forms the components vector for this graph
void checkComponent();
// checks if two nodes are connected
bool checkConnected(int x, int y);
// returns the degree of a given vertex
int degree(int v);
// returns the number of closed triangles present in the graph
int totalClosedTriangles();
// returns the number of open triangles present in the graph
int totalOpenTriangles();
// performs depth first search; helper for checkComponent()
void dfs(Component &c, bool visited[], int v);
};
#endif