-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathEdge.h
52 lines (30 loc) · 1 KB
/
Edge.h
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
46
47
48
49
50
51
52
#ifndef EDGE_H
#define EDGE_H
#include <string>
#include "Node.h"
//-------------------------------------------------------------------------------------------------
class Edge
{
public:
//! @Lifetime
Edge(Node& rSrc, Node& rDst);
Edge(const Edge& rOther) : Edge(rOther.m_srcNode, rOther.m_dstNode) { }
virtual ~Edge();
//! @Edge Information
/** returns true, if the given node is connected with thie edge as source or destination. */
bool isConnectedTo(const Node& rNode) const;
/** get a string representation of this edge. */
std::string toString() const;
/** Override this function in order to retrieve the correct weight. */
virtual double getWeight() const = 0;
Node& getSrcNode() { return m_srcNode; }
Node& getDstNode() { return m_dstNode; }
private:
Node& m_srcNode;
Node& m_dstNode;
#ifdef TESTING
friend class GraphTesting;
#endif
};
//-------------------------------------------------------------------------------------------------
#endif