I am doing the implementation of the prim algorithm
s = q2.poll (). getVal ();
if(visited[s]==false) {
mst.add(q.poll());
}
else {
while(visited[s]==true) {
q.poll();
s = q2.poll().getVal();
}
And when executing I get a null pointer exception for when I assign a value to s in the while.