Work in progress: No visualisation. Context displayed as JSON.

See binary search for a complete example. Stay tuned for updates.

graph = {"you":["alice","bob","claire"],"bob":["anuj","peggy"],"alice":["peggy"],"claire":["thom","jonny"],"anuj":[],"peggy":[],"thom":[],"jonny":[]}
name = "you"
0. function bfs(graph, name) {
1. const queue = [...graph[name]];
2. const searched = [];
3.
4. while (queue.length > 0) {
5. const person = queue.shift();
6.
7. if (searched.indexOf(person) === -1) {
8. if (isSeller(person)) {
9. return person;
10. }
11.
12. queue.push(...graph[person]);
13. searched.push(person);
14. }
15. }
16.
17. return false;
18. }