@Test public void testSimpleGraph() throws Exception { ListMultimap<String, String> edges = LinkedListMultimap.create(); edges.put("a", "b"); edges.put("a", "c"); edges.put("b", "d"); edges.put("c", "d"); ImportTraverser<String> traverser = new ImportTraverser<String>(s -> edges.get(s), CacheBuilder.newBuilder().build()); List<String> traversal = traverser.traverseGraphRecursively("a"); Assert.assertEquals(traversal, Lists.newArrayList("b", "d", "c")); traversal = traverser.traverseGraphRecursively("b"); Assert.assertEquals(traversal, Lists.newArrayList("d")); traversal = traverser.traverseGraphRecursively("c"); Assert.assertEquals(traversal, Lists.newArrayList("d")); traversal = traverser.traverseGraphRecursively("d"); Assert.assertEquals(traversal, Lists.newArrayList()); }
List<T> traverseGraphRecursively(T startingNode) { return doTraverseGraphRecursively(startingNode, new NodePath<>(startingNode)); }
ImportTraverser { List<T> traverseGraphRecursively(T startingNode) { return doTraverseGraphRecursively(startingNode, new NodePath<>(startingNode)); } }
ImportTraverser { List<T> traverseGraphRecursively(T startingNode) { return doTraverseGraphRecursively(startingNode, new NodePath<>(startingNode)); }  }
ImportTraverser { List<T> traverseGraphRecursively(T startingNode) { return doTraverseGraphRecursively(startingNode, new NodePath<>(startingNode)); }   }
ImportTraverser { List<T> traverseGraphRecursively(T startingNode) { return doTraverseGraphRecursively(startingNode, new NodePath<>(startingNode)); }    }