Add cycle detect adding edges
This commit is contained in:
@@ -8,6 +8,8 @@ namespace bayesnet {
|
||||
private:
|
||||
map<string, Node*> nodes;
|
||||
map<string, torch::Tensor> cpds; // Map from CPD key to CPD tensor
|
||||
Node* root = nullptr;
|
||||
bool isCyclic(const std::string&, std::unordered_set<std::string>&, std::unordered_set<std::string>&);
|
||||
public:
|
||||
~Network();
|
||||
void addNode(string, int);
|
||||
@@ -16,6 +18,8 @@ namespace bayesnet {
|
||||
void fit(const vector<vector<int>>&, const int);
|
||||
torch::Tensor& getCPD(const string&);
|
||||
void setCPD(const string&, const torch::Tensor&);
|
||||
void setRoot(string);
|
||||
Node* getRoot();
|
||||
};
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user