-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.cc
More file actions
39 lines (31 loc) · 760 Bytes
/
node.cc
File metadata and controls
39 lines (31 loc) · 760 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
#include <iostream>
#include "Node.h"
std::string Node::getName() const { return node_name; }
void
Node::setValue(int v) { value = v; }
int
Node::getValue() const { return value; }
void
Node::addEdge(Node* destination, int length)
{
edges.emplace_back(destination, length);
}
const std::vector<Edge>&
Node::getEdges() const { return edges; }
bool
operator<(const Node &n1, const Node &n2)
{
return (n1.value < n2.value);
}
std::ostream&
operator<<(std::ostream& os, const Node& n)
{
os << "Node [" << n.getName() << ", " << n.getValue() << "]";
return os;
}
bool
operator==(const std::shared_ptr<Node>& sp, const Node* n)
{
std::cout << sp.get() << " =?= " << n << "\n";
return sp.get() == n;
}