bfs
Performs a Breadth-First Search, which finds the shortest path from the starting node to all other nodes, assuming the graph is unweighted (all edges have a weight of 1.0) It stores results that can be retrieved with the following functions:
depth()currentVisitedNodes()visitedNodes()finalPath()foundTarget()distanceTo(node: T)maxDistance()furthestNode()
Parameters
A list of starting nodes for the BFS traversal.
An optional node that, if specified, the bfs will stop once it's found. Finding the target will make foundTarget() return true, and store the path to the found target node for use in visualizations.
A boolean indicating whether to reset the previous search results. If set to false, previously visited nodes will not be visited again.
Nodes further away from the startNodes than maxDistance will not be traversed.
Throws
If any of the starting nodes is not found in the graph, or if the graph is sparse, and the target node is not defined beforehand.
Overload of fun bfs(startNodes: List