-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEdge.cpp
More file actions
42 lines (34 loc) · 878 Bytes
/
Edge.cpp
File metadata and controls
42 lines (34 loc) · 878 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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: Edge.cpp
* Author: Raell
*
* Created on May 18, 2018, 6:47 PM
*/
#include "Edge.h"
// Edge object containing source, destination and weight
Edge::Edge(unsigned s, unsigned d, float w) {
source = s;
destination = d;
weight = w;
}
// Returns source of edge
unsigned Edge::getSource() const {
return source;
}
// Returns destination of edge
unsigned Edge::getDestination() const {
return destination;
}
// Returns weight of edge
float Edge::getWeight() const {
return weight;
}
// Returns new Edge with swapped source and destination
Edge Edge::swap() {
return Edge(destination, source, weight);
}