Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Graphs;
- public class PQEntry implements Comparable<PQEntry> {
- public int node;
- public int nodeVal;
- public PQEntry(int node, int nodeVal) {
- this.node = node;
- this.nodeVal = nodeVal;
- }
- @Override
- public String toString() {
- return "Node: " + this.node + ", Value: " + this.nodeVal;
- }
- public int getNodeVal() {
- return this.nodeVal;
- }
- @Override
- public int compareTo(PQEntry other) {
- return Integer.compare(this.getNodeVal(), other.nodeVal);
- }
- }
- PriorityQueue<PQEntry> pq = new PriorityQueue();
Add Comment
Please, Sign In to add comment