-
Notifications
You must be signed in to change notification settings - Fork 0
/
GraphStructure.h
executable file
·135 lines (114 loc) · 2.96 KB
/
GraphStructure.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#pragma once
#include "Edge.h"
#include "Vertex.h"
#include <iostream>
#include <map>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
class GraphStructure {
public:
/**
* gets the weight of the edge
* @param s - source vertex
* @param d - destinatino vertex
* @return edge weight
*/
int getEdgeWeight(Vertex s, Vertex d);
/**
* gets the edge label between the two inputs
* @param s - source vertex
* @param d - destination vertex
* @return edge label if edge exists
*/
string getEdgeLabel(Vertex s, Vertex d);
/**
* @param source vertex
* @param destination vertex
* @return returns the edge connecting the two vertices (source ->
* destinatino) if it exists
*/
Edge getEdge(Vertex source, Vertex destination);
/**
* @return a list of all edges in graph
*/
vector<Edge> getEdges();
/**
* inserts edge between two vertices, creating the two vertices if not done so
* already
* @param s - source vertex
* @param d - destination vertex
*/
void insertEdge(Vertex s, Vertex d);
/**
* removes the edge between two vertices
* @param s - source vertex
* @param d - destination vertex
*/
// MIGHT NOT HAVE TO CONSIDER THIS
void removeEdge(Vertex s, Vertex d);
/**
* gets the vertex by its IAPA label
* @param label- IAPA label
* @return Vertex object
*/
Vertex getVertexByLabel(string label);
/**
* gets the vertex by its IAPA label
* @param label- IAPA label
* @return if vertex exists
*/
bool isVertexThere(string label);
/**
* Inserts new vertex into graph, if the vertex is not in the graph
* @param v - vertex to insert
*/
void insertVertex(Vertex v);
/**
* removes the vertex
* @param v - vertex to remove, if the vertex exists
*/
// MIGHT NOT AHVE TO CONSIDER THIS EITHER
void removeVertex(Vertex v);
/**
* Assumes that vertex is valid
* @param v - vertex to retreive label for
* @return label
*/
string getVertexLabel(Vertex v);
/**
* @return all vertices in graph
*/
vector<Vertex> getVertices();
/**
* returns the starting vertex in the graph
* for which the algorithms are going to be run on
* Default vertex will be the first vertex read in
* @return vertex
*/
Vertex getStartingVertex();
/**
* sets the starting vertex
* @param startingVertex - new starting vertex
*/
void setStartingVertex(Vertex startingVertex);
/**
* Gets all the adjacent vertices to "v"
* @param v - vertex to get neighbors for
* @return vector of adjacent verticies
*/
vector<Vertex> getAdjacentVertices(Vertex v);
/**
* clear's the graph
*/
void clear();
private:
// the starting vertex
Vertex startingVertex;
// maps the source vertex to all adjacent vertices and describes the edge
// between each of those mappings
map<Vertex, map<Vertex, Edge>> adj_list;
// contains list of all vertices and their labels
map<Vertex, string> vertex_labels;
};