Add BFS and DFS for tree.

This commit is contained in:
Oleksii Trekhleb
2018-04-25 17:35:44 +03:00
parent b175aabf8d
commit 85585769ea
8 changed files with 346 additions and 6 deletions

View File

@@ -39,7 +39,7 @@ describe('depthFirstSearch', () => {
const enterVertexCallback = jest.fn();
const leaveVertexCallback = jest.fn();
// Traverse graphs without callbacks first.
// Traverse graphs without callbacks first to check default ones.
depthFirstSearch(graph, vertexA);
// Traverse graph with enterVertex and leaveVertex callbacks.