Graph:...al::BFS(3pm)
β¨ Graph::Traversal::BFS β bestie edition π
okay so this is Graph::Traversal::BFS, from the User Contributed Perl Documentation section of the manual (it's a 3pm page, iykyk π
). Sit down, grab a strawberry π, we're doing breadth-first traversal.
πΈ NAME πΈ
Graph::Traversal::BFS β breadth-first traversal of graphs. that's it, that's the whole vibe. we go wide before we go deep π¦
π SYNOPSIS π
use Graph;
my $g = Graph->new;
$g->add_edge(...);
use Graph::Traversal::BFS;
my $b = Graph::Traversal::BFS->new($g, %opt);
$b->bfs; # Do the traversal.
literally the whole plot: make a Graph, add some edges, pull in the traversal class, build a $b with your graph and your %opt, then call $b->bfs and boom π₯ β that's your traversal, done, slay.
π DESCRIPTION π
With this class one can traverse a Graph in breadth-first order. so like, all the neighbors first, then their neighbors, level by level, like ripples in a pond π or like when a rumor spreads through the group chat β everyone at the same distance hears it at the same time, no cap.
The callback parameters %opt are explained over in Graph::Traversal. go read that one, bestie, it's the whole lore π
π₯ Methods π₯
The following methods are available β yes, it's a short list, quality over quantity, main character energy only:
bfsβ Traverse the graph in breadth-first order. Returns all vertices traversed in post-order. so you get the whole lineup back at the end π«Ά
π SEE ALSO π
Graph::TraversalGraph::Traversal::DFSGraph
go check those out, they're the supporting cast and honestly they ate β¨
and that's the page, bestie!! this one's from perl v5.40.1, dated 2025-03-28 β love that for us ππβ¨
π¦ where this page comes from
- debian trixie: libgraph-perl 1:0.9735-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libgraph-perl 1:0.9735-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libgraph-perl 1:0.9735-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms