Graphs/graph.hpp
2025-05-26 21:52:07 +03:00

71 lines
No EOL
1.3 KiB
C++

#pragma once
#include "tools.hpp"
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
struct Edge;
struct Node {
Edge *nextNodes;
tls::Index index;
tls::Value value;
};
struct Edge {
tls::Weight wght;
Node *receiver;
Edge() {
wght = 1;
receiver = new Node;
}
};
struct Graph {
Node *firstNode;
tls::Size size;
Graph() {
firstNode = new Node;
size = 1;
}
//void link(tls::Index origin, tls::Index *stocks);
void fill(tls::Index origin);
};
void Graph::fill(tls::Index origin){
if (origin == this->size) return;
tls::DiEgo tmp;
tmp.strock(origin);
// std::cout << "Got numbers: ";
// for (int j = 0; j < tmp.size_kusochki; j++) {
// std::cout << tmp.kusochki[j] << " ";
// }
Graph* template_graph;
for (tls::Index k = 0; k < tmp.size_kusochki; k++){
this->firstNode->nextNodes = new Edge;
this->firstNode->nextNodes->receiver->index = tmp.kusochki[k];
fill();
}
delete[] tmp.kusochki;
}
void link(tls::Index origin, tls::Index *stocks){
}
// kfu