algo — C++23 日本語リファレンス GitHub

tree_bfs

関数 · 木の基本関数

// (1)
template <graph_type G>
std::vector<int> tree_bfs(const G &g, int r = 0);

// (2)
std::vector<int> tree_bfs(const std::vector<int> &parents);

概要

(1) 根rからのBFS順を返す

(2) 親配列が表す木のBFS順を返す

関連項目