use of jcog.data.graph.NodeGraph in project narchy by automenta.
the class NodeGraphTest method testDFS.
@Test
public void testDFS() {
NodeGraph n = g1();
List<String> trace = new FasterList();
n.dfs("a", new Search() {
@Override
protected boolean next(BooleanObjectPair move, NodeGraph.Node next) {
trace.add(path.toString());
return true;
}
});
assertEquals(4, trace.size());
assertEquals("[[true:a => ab => b], [true:a => ab => b, true:b => bc => c], [true:a => ab => b, true:b => bc => c, true:c => cd => d], [true:a => ae => e]]", trace.toString());
}
use of jcog.data.graph.NodeGraph in project narchy by automenta.
the class NodeGraphTest method testBFS.
@Test
public void testBFS() {
NodeGraph n = g1();
List<String> trace = new FasterList();
n.bfs("a", new Search() {
@Override
protected boolean next(BooleanObjectPair move, NodeGraph.Node next) {
trace.add(path.toString());
return true;
}
});
assertEquals(4, trace.size());
assertEquals("[[true:a => ab => b], [true:a => ae => e], [true:a => ab => b, true:b => bc => c], [true:a => ab => b, true:b => bc => c, true:c => cd => d]]", trace.toString());
}
Aggregations