-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNode.java
More file actions
39 lines (33 loc) · 684 Bytes
/
Node.java
File metadata and controls
39 lines (33 loc) · 684 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
import java.util.*;
public class Node implements Comparable<Node>{
private int nodeID;
private int degree;
/**
* Initializes the Node fields
*
* @param id The ID of the particular Node
*/
public Node(int id) {
nodeID = id;
degree = 0;
}
/**
* Gets the Node ID
*
* @return The Node ID
*/
public int getID() {
return nodeID;
}
public void incrementDegree(){
degree++;
}
public int getDegree(){
return degree;
}
@Override
public int compareTo(Node o) {
// TODO Auto-generated method stub
return degree - o.getDegree();
}
}