pub fn dfs<W: GraphWeightTrait, const NODES: usize>(
graph: &Graph<W, NODES>,
source: usize,
destination: usize,
) -> Vec<(usize, String)>Expand description
Performs a Depth-First Search (DFS) on the graph to find a path from the source node to the destination node.
§Arguments
graph- The graph to search.source- The starting node index for the search.destination- The target node index to reach.
§Returns
A vector of nodes (index, label) representing the path from the source to the destination.
If no path is found, returns an empty vector.
§Panics
Panics if the source or destination node indices are out of bounds.