I'm having to traverse a graph for an assignment at uni, and I'm having an issue when using a Set. I've got the algorithm written already but for some reason this seems to be holding it up. Currently, I'm receiving a NullPointerException on the first line of the following (according to BlueJ):
Set<String> neighboursNames = map.getNeighboursNames(v);
List<String> reachable = new ArrayList<String>(neighboursNames);
When the getNeighboursNames() method is returning a Set of Strings as the names of the neighbouring nodes. I have been instructed that this is the correct method to use, and the variable v is referring to the current name of the current node.
Could somebody please point out where I might have gone wrong because I really can't see it, or let me know if there's nothing wrong with this section and the issue must lie elsewhere in the code.
Any help on this is appreciated, I've tried several things so far without success.