GraphLib
Bearbeitung der Aufgabe Mini Graph Library für OOP WiSe 2023/24
Loading...
Searching...
No Matches
bfs.h File Reference

Implements breadth-first search (BFS) algorithms for graph traversal and pathfinding. More...

#include <queue>
#include <set>
#include <vector>
#include "GraphLib/internal/concepts.h"

Go to the source code of this file.

Functions

template<Internal::valid_graph_type G>
std::vector< typename G::id_type > GraphLib::breadth_first_search (const G &graph, typename G::id_type root, typename G::id_type target)
 Performs a breadth-first search (BFS) to find a path from root to target node in a graph.
template<Internal::valid_graph_type G>
GraphLib::breadth_first_search (const G &graph, typename G::id_type root)
 Performs a breadth-first search (BFS) to construct a spanning tree rooted at the given node.

Detailed Description

Implements breadth-first search (BFS) algorithms for graph traversal and pathfinding.

This header provides two BFS-related function templates:

  • Finding a shortest path between two nodes in a graph.
  • Constructing a spanning tree rooted at a specified node.

The functions support generic graph types satisfying the GraphLib concepts.

Definition in file bfs.h.