Graph Theory
Loading...
Searching...
No Matches
graph.h
1#pragma once
2#include <new>
3#include <utility>
4
5struct Point {
6 float x, y, z;
7 int first_edge = -1;
8 int e_count = 0;
9};
10
11struct Edge {
12 int target_point;
13 float e_weight;
14};
15
16class Graph {
17private:
18 Point* all_points = nullptr;
19 Edge* all_edges = nullptr;
20 size_t next_possible_edge = 0;
21 size_t p_capacity = 0;
22 size_t e_capacity = 0;
23
24public:
25 Graph(size_t maxPoints, size_t maxEdges) noexcept;
26 ~Graph();
27
28 // Move constructor
29 Graph(Graph&& other) noexcept;
30
31 Edge* get_p_edges(int p_index) noexcept;
32
33 void add_edge(int start_point_index, int end_point_index) noexcept;
34
35 //Preventing mem-spikes by preventing copying and enforcing deletions.
36 Graph(const Graph&) = delete;
37 Graph& operator=(const Graph&) = delete;
38};
Graph(size_t maxPoints, size_t maxEdges) noexcept
Definition Graph.cpp:11
Edge * get_p_edges(int p_index) noexcept
Definition Graph.cpp:54
~Graph()
Definition Graph.cpp:29
void add_edge(int start_point_index, int end_point_index) noexcept
Definition Graph.cpp:78
Definition graph.h:11
Definition graph.h:5