Загрузить файлы в «/»
This commit is contained in:
commit
5caf37e303
3 changed files with 179 additions and 0 deletions
70
graph.hpp
Normal file
70
graph.hpp
Normal file
|
@ -0,0 +1,70 @@
|
|||
#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){
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue