#include <iostream>
#include <openGPMP/disct.hpp>
#include <vector>
Go to the source code of this file.
◆ main()
Definition at line 5 of file graphs_ex.cpp.
13 std::cout <<
"DFS Traversal starting from vertex 0: ";
15 std::cout << std::endl;
17 std::cout <<
"BFS Traversal starting from vertex 0: ";
19 std::cout << std::endl;
25 std::cout <<
"Kruskal's Minimum Spanning Tree:\n";
26 std::vector<std::pair<int, std::pair<int, int>>> kruskalMST = g.kruskal();
27 for (
const auto &edge : kruskalMST) {
28 std::cout <<
"Edge: " << edge.second.first <<
" - "
29 << edge.second.second <<
" | Weight: " << edge.first <<
"\n";
34 std::cout <<
"Graph for Topological Sorting:\n";
36 dag.add_edge(0, 1, 1);
37 dag.add_edge(0, 2, 1);
38 dag.add_edge(1, 3, 1);
39 dag.add_edge(2, 3, 1);
40 dag.add_edge(3, 4, 1);
41 dag.add_edge(4, 5, 1);
References gpmp::Graph::add_edge(), gpmp::Graph::bellman_ford(), gpmp::Graph::bfs(), gpmp::Graph::dfs(), gpmp::Graph::dijkstra(), gpmp::Graph::floyd_warshall(), gpmp::Graph::kruskal(), and gpmp::Graph::topo_sort().