-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEdge.java
More file actions
59 lines (47 loc) · 1.32 KB
/
Copy pathEdge.java
File metadata and controls
59 lines (47 loc) · 1.32 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
package com.geeksforgeeks.graph;
public class Edge<T> {
private int weight;
private Vertex<T> vertex1;
private Vertex<T> vertex2;
private Boolean isDirected;
public Edge(Vertex vertex1, Vertex vertex2, Boolean isDirected, int weight) {
this.weight = weight;
this.vertex1 = vertex1;
this.vertex2 = vertex2;
this.isDirected = isDirected;
}
Edge(Vertex vertex1, Vertex vertex2, boolean isDirected) {
this.vertex1 = vertex1;
this.vertex2 = vertex2;
this.isDirected = isDirected;
}
public int getWeight() {
return weight;
}
public void setWeight(int weight) {
this.weight = weight;
}
public Vertex getVertex1() {
return vertex1;
}
public void setVertex1(Vertex vertex1) {
this.vertex1 = vertex1;
}
public Vertex getVertex2() {
return vertex2;
}
public void setVertex2(Vertex vertex2) {
this.vertex2 = vertex2;
}
public Boolean getDirected() {
return isDirected;
}
public void setDirected(Boolean directed) {
isDirected = directed;
}
@Override
public String toString() {
return "Edge [isDirected=" + isDirected + ", vertex1=" + vertex1
+ ", vertex2=" + vertex2 + ", weight=" + weight + "]";
}
}