bfs_shortest_path#

bfs_shortest_path(graph: PlanarDiagram, start, goal)#

Find the shortest path in a graph using the Breadth-First Search (BFS) algorithm.

This function explores paths in a graph layer by layer starting from the start node to find the shortest possible path to the goal node. The function returns the shortest path if one exists. If no path exists between start and goal, the function returns None.

Args:
graph (PlanarDiagram): The graph structure to search, where nodes and connections are

defined as per the PlanarDiagram class or equivalent structure.

start: The starting node for the search. goal: The target node to find the shortest path to.

Returns:
list: A list representing the nodes in the shortest path from start to goal,

including both endpoints. If no path exists, returns None.