File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 24
24
25
25
#include < cmath>
26
26
#include < cstring>
27
+ #include < deque>
27
28
#include < fstream>
28
29
#include < functional>
29
30
#include < iostream>
@@ -60,9 +61,15 @@ using shared = std::shared_ptr<T>;
60
61
template <typename T>
61
62
using T_EdgeSet = std::unordered_set<shared<const Edge<T>>, edgeHash<T>>;
62
63
64
+ template <typename T>
65
+ using T_EdgeVector = std::vector<shared<const Edge<T>>>;
66
+
63
67
template <typename T>
64
68
using T_NodeSet = std::unordered_set<shared<const Node<T>>, nodeHash<T>>;
65
69
70
+ template <typename T>
71
+ using T_NodeVector = std::vector<shared<const Node<T>>>;
72
+
66
73
template <typename T>
67
74
class Graph ;
68
75
@@ -125,6 +132,16 @@ class Graph {
125
132
*/
126
133
virtual const T_EdgeSet<T> &getEdgeSet () const ;
127
134
135
+ /* *
136
+ * \brief
137
+ * Function that return the Edge set of the Graph
138
+ * Note: No Thread Safe
139
+ *
140
+ * @returns a list of Edges of the graph
141
+ *
142
+ */
143
+ virtual T_EdgeVector<T> getEdgeVector () const ;
144
+
128
145
/* *
129
146
* \brief
130
147
* Function set the Edge Set of the Graph
@@ -278,6 +295,16 @@ class Graph {
278
295
*/
279
296
virtual const T_NodeSet<T> getNodeSet () const ;
280
297
298
+ /* *
299
+ * \brief
300
+ * Function that return the Node Set of the Graph
301
+ * Note: No Thread Safe
302
+ *
303
+ * @returns a list of Nodes of the graph
304
+ *
305
+ */
306
+ virtual const T_NodeVector<T> getNodeVector () const ;
307
+
281
308
/* *
282
309
* \brief
283
310
* Function that return the Set of isolated nodes
Original file line number Diff line number Diff line change @@ -59,6 +59,12 @@ const T_EdgeSet<T> &Graph<T>::getEdgeSet() const {
59
59
return edgeSet;
60
60
}
61
61
62
+ template <typename T>
63
+ T_EdgeVector<T> Graph<T>::getEdgeVector() const {
64
+ T_EdgeVector<T> edgeVector (edgeSet.begin (), edgeSet.end ());
65
+ return edgeVector;
66
+ }
67
+
62
68
template <typename T>
63
69
void Graph<T>::setEdgeSet(const T_EdgeSet<T> &edgeSet) {
64
70
this ->edgeSet .clear ();
@@ -311,6 +317,17 @@ const T_NodeSet<T> Graph<T>::getNodeSet() const {
311
317
return nodeSet;
312
318
}
313
319
320
+ template <typename T>
321
+ const T_NodeVector<T> Graph<T>::getNodeVector() const {
322
+ auto &nodeSet = getNodeSet ();
323
+ T_NodeVector<T> nodeVector (nodeSet.begin (), nodeSet.end ());
324
+ // Merge with the isolated nodes
325
+ nodeVector.insert (nodeVector.end (), this ->isolatedNodesSet .begin (),
326
+ this ->isolatedNodesSet .end ());
327
+
328
+ return nodeVector;
329
+ }
330
+
314
331
template <typename T>
315
332
const T_NodeSet<T> Graph<T>::getIsolatedNodeSet() const {
316
333
return isolatedNodesSet;
You can’t perform that action at this time.
0 commit comments