#ifndef MST_H #define MST_H #include #include #include namespace bayesnet { class MST { private: torch::Tensor weights; std::vector features; int root = 0; public: MST() = default; MST(const std::vector& features, const torch::Tensor& weights, const int root); std::vector> maximumSpanningTree(); }; class Graph { private: int V; // number of nodes in graph std::vector >> G; // std::vector for graph std::vector >> T; // std::vector for mst std::vector parent; public: explicit Graph(int V); void addEdge(int u, int v, float wt); int find_set(int i); void union_set(int u, int v); void kruskal_algorithm(); void display_mst(); std::vector >> get_mst() { return T; } }; } #endif