-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEdge.java
More file actions
60 lines (51 loc) · 1.16 KB
/
Edge.java
File metadata and controls
60 lines (51 loc) · 1.16 KB
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
53
54
55
56
57
58
59
60
package programmingAssignment4;
/**
* Represents an edge between two vertices in a graph. Modified Christine Reilly's Edge class.
*
* @author rosspowell
*/
public class Edge {
/** The starting vertex of this edge */
private int start;
/** The destination vertex of this edge */
private int dest;
/** The weight of this edge */
private int weight;
/** Default Constructor initializes the data members to 0*/
public Edge() {
start = 0;
dest = 0;
weight = 0;
}
/** Constructor initializes the data members */
public Edge(int s, int d, int w) {
start = s;
dest = d;
weight = w;
}
/**
* Return the value of the start vertex
*/
public int getStart() {
return start;
}
/**
* Return the value of the destination vertex
*/
public int getDest() {
return dest;
}
/**
* Return the value of the edge weight
*/
public int getWeight() {
return weight;
}
/**
* used in shortest path method to set the weight of an edge to 1.
* @param w
*/
public void setWeight(int w) {
weight = w;
}
}