I\'m a newbie to Java.
I have provided a short snippet from my code for BFS.
public int bfs(Person p, Person q) {
private HashMap
First I would suggest you start reading a Java tutorial...
https://docs.oracle.com/javase/tutorial/java/TOC.html
For your issues specifically:
As for your code, you can initialize your variables right when you declare them:
Map marked = new HashMap();
int count = 0; // or whatever initial value