@@ -73,8 +73,21 @@ impl Network {
7373 /// * `value_children` - The indexes of the node's value children.
7474 /// * `volatility_children` - The indexes of the node's volatility children.
7575 /// * `volatility_parents` - The indexes of the node's volatility parents.
76- #[ pyo3( signature = ( kind="continuous-state" , value_parents=None , value_children=None , volatility_parents=None , volatility_children=None , ) ) ]
77- pub fn add_nodes ( & mut self , kind : & str , value_parents : Option < Vec < usize > > ,
76+ #[ pyo3( signature = (
77+ kind="continuous-state" ,
78+ value_parents=None ,
79+ value_children=None ,
80+ volatility_parents=None ,
81+ volatility_children=None ,
82+ ef_dimension=None ,
83+ ef_distribution=None ,
84+ ef_learning=None ,
85+ )
86+ ) ]
87+ pub fn add_nodes (
88+ & mut self ,
89+ kind : & str ,
90+ value_parents : Option < Vec < usize > > ,
7891 value_children : Option < Vec < usize > > ,
7992 volatility_parents : Option < Vec < usize > > , volatility_children : Option < Vec < usize > > , ) {
8093
@@ -86,6 +99,7 @@ impl Network {
8699 self . inputs . push ( node_id) ;
87100 }
88101
102+ // Update the edges variable
89103 let edges = AdjacencyLists {
90104 node_type : String :: from ( kind) ,
91105 value_parents : value_parents,
@@ -94,6 +108,11 @@ impl Network {
94108 volatility_children : volatility_children,
95109 } ;
96110
111+ // Add emtpy adjacency lists in the new node
112+ self . edges . insert ( node_id, edges) ;
113+
114+ // TODO: Update the edges of parents and children accordingly
115+
97116 // add edges and attributes
98117 if kind == "continuous-state" {
99118
@@ -107,7 +126,6 @@ impl Network {
107126 ( String :: from ( "autoconnection_strength" ) , 1.0 ) ] . into_iter ( ) . collect ( ) ;
108127
109128 self . attributes . floats . insert ( node_id, attributes) ;
110- self . edges . insert ( node_id, edges) ;
111129
112130 } else if kind == "ef-state" {
113131
@@ -123,6 +141,7 @@ impl Network {
123141
124142 }
125143 }
144+ }
126145
127146 pub fn set_update_sequence ( & mut self ) {
128147 self . update_sequence = set_update_sequence ( self ) ;
0 commit comments