-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraph.h
More file actions
53 lines (39 loc) · 1.11 KB
/
Graph.h
File metadata and controls
53 lines (39 loc) · 1.11 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
44
45
46
47
48
49
50
51
52
53
//
// Graph.h
// Graphs
//
// Created by Kode Creer on 3/5/19.
// Copyright © 2019 Kode Creer. All rights reserved.
//
#ifndef Graph_h
#define Graph_h
#include <iostream>
#include <cstdlib>
#include <set>
template <class Item>
class Graph{
public:
//Member constants
static const size_t MAXIMUM = 20;
//CONSTRUCTOR
Graph(){many_vertices = 0;};
//MODIFICATION MEMEBER FUNCTIONS
void add_vertex(const Item& label);
void add_edge(size_t source, size_t target, size_t weight);
void remove_edge(size_t source, size_t target);
Item& operator [](size_t vertex);
//CONSTANT MEMBER FUNCTIONS
size_t size() const { return many_vertices;}
bool is_edge(size_t source, size_t target) const;
int edge_at(size_t source, size_t target) const;
std::set<size_t> neighbors(size_t vertex) const;
Item operator [] (size_t vertex) const;
//DATA MEMBERS
private:
bool bool_edges[MAXIMUM][MAXIMUM];
int edges[MAXIMUM][MAXIMUM];
Item labels[MAXIMUM];
size_t many_vertices;
};
#include "Graph.template"
#endif /* Graph_h */