-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNode.h
More file actions
45 lines (34 loc) · 775 Bytes
/
Node.h
File metadata and controls
45 lines (34 loc) · 775 Bytes
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
//
// Created by bashirov on 8/5/24.
//
#ifndef PROJECT3_NODE_H
#define PROJECT3_NODE_H
#pragma once
#include <set>
#include <sstream>
#include <iostream>
using namespace std;
class Node {
private:
set<int> adjacentNodeIDs;
public:
void addEdge(int adjacentNodeID) {
adjacentNodeIDs.insert(adjacentNodeID);
}
string toString(){
stringstream out;
auto it = adjacentNodeIDs.begin();
while (it != adjacentNodeIDs.end()){
out << "R"<< *it;
if (++it != adjacentNodeIDs.end()){
out << ",";
}
}
out << endl;
return out.str();
}
const set<int> &getAdjacentNodeIDs() const {
return adjacentNodeIDs;
}
};
#endif //PROJECT3_NODE_H