Graphs - Breadth First Search
Question: Breadth First Search (BFS) is an algorithm for traversing graphs level by level. It starts at a vertex and travels to the adjacent vertices, and keeps doing this until it reaches the end of the graph. Define a function 'bfs' which takes in a graph and vertex, that traverses the graph in a BFS manner from that vertex and returns the traversal path as a list. If the graph contains cycles, ignore them.
More Information:
https://en.wikipedia.org/wiki/Breadth-first_searchExample
q)g:`a`b`c`d!(`b`c;`a`d;`a`d;`a) // contains cycles
q)bfs[g;`a]
`a`b`c`a`d`a`d`a`a
q)h:`a`b`c`d!(`b`c;`d;();()) // no cycles
q)bfs[h;`a]
`a`b`c`d