Optimization + PrettyPrint
This commit is contained in:
47
src/main.cpp
47
src/main.cpp
@@ -1,38 +1,35 @@
|
||||
#include "Algo.h"
|
||||
#include "Graphe.h"
|
||||
#include <chrono>
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
auto start = std::chrono::high_resolution_clock::now();
|
||||
Graphe graphe("graphe-communes.gra");
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
|
||||
std::cout << "Temps de chargement du graphe : " << duration << " ms.\n";
|
||||
// std::cout << graphe << std::endl;
|
||||
// auto result = PlusCourtCheminNbArcs(graphe, graphe.getVertex("a"));
|
||||
std::string tab_graphes[4] = {
|
||||
"graphe-oriente-01.gra", "graphe-nonoriente-01.gra", "graphe-communes.gra", "cours-representation.gra"};
|
||||
Graphe graphe(tab_graphes[3]);
|
||||
std::cout << graphe << std::endl;
|
||||
auto result = PlusCourtCheminNbArcs(graphe, graphe.getVertex("a"));
|
||||
|
||||
// std::cout << "Résultat :\n";
|
||||
// for (auto& [vertex, longueur] : result) {
|
||||
// std::cout << vertex->m_Name << " " << longueur << "\n";
|
||||
// }
|
||||
std::cout << "Résultat :\n";
|
||||
for (auto& [vertex, longueur] : result) {
|
||||
std::cout << vertex->m_Name << " " << longueur << "\n";
|
||||
}
|
||||
|
||||
// auto result2 = PlusCourtCheminsNbArcs(graphe, graphe.getVertex("a"));
|
||||
auto result2 = PlusCourtCheminsNbArcs(graphe, graphe.getVertex("a"));
|
||||
|
||||
// std::cout << "Résultat :\n";
|
||||
// for (auto& [vertex, chemin] : result2) {
|
||||
// std::cout << vertex->m_Name << " " << chemin << "\n";
|
||||
// }
|
||||
std::cout << "Résultat :\n";
|
||||
for (auto& [vertex, chemin] : result2) {
|
||||
std::cout << vertex->m_Name << " " << chemin << "\n";
|
||||
}
|
||||
|
||||
// auto result3 = PlusCourtChemin(graphe, graphe.getVertex("a"), graphe.getVertex("e"));
|
||||
auto result3 = PlusCourtChemin(graphe, graphe.getVertex("a"), graphe.getVertex("e"));
|
||||
|
||||
// std::cout << "Résultat :\n";
|
||||
// std::cout << result3 << std::endl;
|
||||
std::cout << "Résultat :\n";
|
||||
std::cout << result3 << std::endl;
|
||||
|
||||
// auto result4 = PlusCourtCheminDjikstra(graphe, graphe.getVertex("a"));
|
||||
// std::cout << "Résultat :\n";
|
||||
// for (auto& [vertex, longueur] : result4) {
|
||||
// std::cout << vertex->m_Name << " " << longueur << "\n";
|
||||
// }
|
||||
auto result4 = PlusCourtCheminDjikstra(graphe, graphe.getVertex("a"));
|
||||
std::cout << "Résultat :\n";
|
||||
for (auto& [vertex, longueur] : result4) {
|
||||
std::cout << vertex->m_Name << " " << longueur << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user