@@ -83,34 +83,38 @@ class Graph {
8383 split_distribution_ = std::move (split_dist);
8484 }
8585
86- [[nodiscard]] int getVertexValue (size_t layerID) const {
87- if (layerID >= arrayV_.size ()) {
88- throw std::invalid_argument (" ArrayV does not contain this ID." );
89- }
90- return arrayV_[layerID];
91- }
92-
93- [[nodiscard]] int getEdgeValue (size_t pos) const {
94- if (pos >= arrayE_.size ()) {
95- throw std::invalid_argument (" ArrayE does not contain this." );
96- }
97- return arrayE_[pos];
98- }
99-
10086 [[nodiscard]] size_t getInputsSize (size_t layerID) const {
10187 if (layerID >= in_edges_.size ()) {
102- throw std::invalid_argument (" Input edges array do not contain this ID." );
88+ throw std::invalid_argument (
89+ " Input edges array does not contain this ID." );
10390 }
10491 return in_edges_[layerID].size ();
10592 }
10693
10794 [[nodiscard]] std::vector<int > getInLayers (size_t layerID) const {
10895 if (layerID >= in_edges_.size ()) {
109- throw std::invalid_argument (" Input edges array do not contain this ID." );
96+ throw std::invalid_argument (
97+ " Input edges array does not contain this ID." );
11098 }
11199 return in_edges_[layerID];
112100 }
113101
102+ [[nodiscard]] size_t getOutputsSize (size_t layerID) const {
103+ if (layerID >= layers_.size ()) {
104+ throw std::invalid_argument (" Layers array does not contain this ID." );
105+ }
106+ return arrayV_[layerID + 1 ] - arrayV_[layerID];
107+ }
108+
109+ [[nodiscard]] std::vector<int > getOutLayers (size_t layerID) const {
110+ if (layerID >= layers_.size ()) {
111+ throw std::invalid_argument (
112+ " Output edges array does not contain this ID." );
113+ }
114+ return std::vector<int >(arrayE_.begin () + arrayV_[layerID],
115+ arrayE_.begin () + arrayV_[layerID + 1 ]);
116+ }
117+
114118 [[nodiscard]] int getLayersCount () const { return V_ ; }
115119
116120 [[nodiscard]] std::shared_ptr<Layer> getLayerFromID (size_t layerID) const {
@@ -237,8 +241,9 @@ class Graph {
237241 }
238242 // remove outputs
239243 int amount_connected = arrayV_[id + 1 ] - arrayV_[id];
244+ std::vector<int > array_e_copy = arrayE_;
240245 for (int i = 0 ; i < amount_connected; i++) {
241- removeConnection (id, arrayE_ [arrayV_[id] + i]);
246+ removeConnection (id, array_e_copy [arrayV_[id] + i]);
242247 }
243248 // remove vertex
244249 in_edges_.erase (in_edges_.begin () + id);
0 commit comments