-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEdge.java
More file actions
45 lines (39 loc) · 748 Bytes
/
Edge.java
File metadata and controls
45 lines (39 loc) · 748 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
public class Edge {
// Components of an Edge
private final int source;
private final int destination;
private final int weight;
/*
* Edge Constructor
*/
public Edge(int s, int f, int weight) {
this.source = s;
this.destination = f;
this.weight = weight;
}
/*
* return edge source
*/
public int get_Source() {
return this.source;
}
/*
* return edge destination
*/
public int get_Destination() {
return this.destination;
}
/*
* get the weight of the edge
*/
public int getWeight() {
return this.weight;
}
/*
* prints out the edge content
*/
public String toString() {
return "source = " + this.source + " destination = " + this.destination + " weight = " + this.weight + "."
+ "\n";
}
}