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

Implements depth-first search (DFS) algorithms for graph traversal and pathfinding. More...

#include <functional>
#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::depth_first_search (const G &graph, typename G::id_type root, typename G::id_type target)
 Performs a depth-first search (DFS) to find a path from root to target node in a graph.
template<Internal::valid_graph_type G>
GraphLib::depth_first_search (const G &graph, typename G::id_type root)
 Performs a depth-first search (DFS) to construct a spanning tree rooted at the given node.

Detailed Description

Implements depth-first search (DFS) algorithms for graph traversal and pathfinding.

This header provides two DFS-related function templates:

  • Finding a 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 dfs.h.