-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVertex.java
More file actions
49 lines (33 loc) · 704 Bytes
/
Copy pathVertex.java
File metadata and controls
49 lines (33 loc) · 704 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
46
47
48
49
package DiGraph_A5;
import java.util.HashMap;
public class Vertex{
long id;
String label;
public Vertex(long id, String label) {
this.id = id;
this.label = label;
}
HashMap<String,Edge> edgesIn = new HashMap<String,Edge>();
HashMap<String,Edge> edgesOut = new HashMap<String,Edge>();
public long getID() {
return id;
}
public String getLabel() {
return label;
}
public void addIn(String s, Edge e) {
edgesIn.put(s, e);
}
public void delIn(String s) {
edgesIn.remove(s);
}
public void addOut(String s, Edge e) {
edgesOut.put(s, e);
}
public void delOut(String s) {
edgesOut.remove(s);
}
public int getInDegree() {
return edgesIn.size();
}
}