-
Notifications
You must be signed in to change notification settings - Fork 0
/
Graph_Node.cpp
63 lines (52 loc) · 1018 Bytes
/
Graph_Node.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "Graph_Node.h"
Graph_Node::Graph_Node(string name,int n,vector<string> vals)
{
Node_Name=name;
nvalues=n;
values=vals;
}
string Graph_Node::get_name()
{
return Node_Name;
}
vector<int> Graph_Node::get_children()
{
return Children;
}
vector<string> Graph_Node::get_Parents()
{
return Parents;
}
vector<float> Graph_Node::get_CPT()
{
return CPT;
}
int Graph_Node::get_nvalues()
{
return nvalues;
}
vector<string> Graph_Node::get_values()
{
return values;
}
void Graph_Node::set_CPT(vector<float> new_CPT)
{
CPT.clear();
CPT=new_CPT;
}
void Graph_Node::set_Parents(vector<string> Parent_Nodes)
{
Parents.clear();
Parents=Parent_Nodes;
}
// add another node in a graph as a child of this node
int Graph_Node::add_child(int new_child_index )
{
for(int i=0;i<Children.size();i++)
{
if(Children[i]==new_child_index)
return 0;
}
Children.push_back(new_child_index);
return 1;
}