pub fn breadth_first_search_digraph<N, E, Ix>(
graph: &DiGraph<N, E, Ix>,
source: &N,
) -> Result<Vec<N>>Expand description
Performs breadth-first search (BFS) from a given starting node in a directed graph
§Arguments
graph- The directed graph to traversesource- The source node
§Returns
Result<Vec<N>>- The nodes visited in BFS order
§Time Complexity
O(V + E) where V is the number of vertices and E is the number of edges. Each vertex and edge is visited at most once.
§Space Complexity
O(V) for the visited set and queue.