Files
Graph_Theory_Using_Flat_Buf…/graph.h

38 lines
794 B
C++

#pragma once
#include <new>
#include <utility>
struct Point {
float x, y, z;
int first_edge = -1;
int e_count = 0;
};
struct Edge {
int target_point;
float e_weight;
};
class Graph {
private:
Point* all_points = nullptr;
Edge* all_edges = nullptr;
size_t next_possible_edge = 0;
size_t p_capacity = 0;
size_t e_capacity = 0;
public:
Graph(size_t maxPoints, size_t maxEdges) noexcept;
~Graph();
// Move constructor
Graph(Graph&& other) noexcept;
Edge* get_p_edges(int p_index) noexcept;
void add_edge(int start_point_index, int end_point_index) noexcept;
//Preventing mem-spikes by preventing copying and enforcing deletions.
Graph(const Graph&) = delete;
Graph& operator=(const Graph&) = delete;
};