### Question:
AdjacencyListGraph { public boolean boundedBFS(K src, K trg) { if (!adjacencyMap.containsKey(src)) { return false; } else { Set<K> visited = new HashSet<>(); Queue<Node> queue = new LinkedList<>(); for (K neighbor : adjacencyMap.get(src)) { queue.add(new Node(neighbor, 1)); } visited.add(src); while (!queue.isEmpty()) { Node current = queue.peek(); if (current.id().equals(trg)) { return true; } else { queue.remove(); visited.add(current.id()); if (current.level() < factorK) { for (K neighbor : adjacencyMap.get(current.id())) { if (!visited.contains(neighbor)) { queue.add(new Node(neighbor, current.level() + 1)); } } } } } return false; } } AdjacencyListGraph(int factorK);  AdjacencyListGraph(AdjacencyListGraph<K> graph);  AdjacencyListGraph(AdjacencyListGraph<K> graph, K src, K trg); int size(); boolean boundedBFS(K src, K trg); AdjacencyListGraph<K> merge(AdjacencyListGraph<K> graph); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testBoundedBFS() { AdjacencyListGraph<Integer> g = new AdjacencyListGraph<>(3); g.addEdge(1, 4); g.addEdge(4, 5); g.addEdge(5, 6); g.addEdge(4, 7); g.addEdge(7, 8); assertFalse(g.boundedBFS(2, 3)); g.addEdge(2, 3); assertFalse(g.boundedBFS(3, 4)); g.addEdge(3, 4); assertTrue(g.boundedBFS(3, 6)); assertFalse(g.boundedBFS(8, 9)); g.addEdge(8, 9); assertFalse(g.boundedBFS(8, 6)); g.addEdge(8, 6); assertTrue(g.boundedBFS(5, 9)); }