Graph:...losure(3pm)
β¨ Graph::TransitiveClosure π
okay bestie, so this page is the manual for Graph::TransitiveClosure, a Perl module from the User Contributed Perl Documentation fam, and honestly? it's giving "I can see the whole graph from here" energy π¦
πΈ NAME πΈ
Graph::TransitiveClosure β create and query transitive closure of graph
β¨ SYNOPSIS β¨
no cap, just look at this:
use Graph::TransitiveClosure;
use Graph::Directed; # or Undirected
my $g = Graph::Directed->new;
$g->add_...(); # build $g
# Compute the transitive closure graph.
my $tcg = Graph::TransitiveClosure->new($g);
$tcg->is_reachable($u, $v) # Identical to $tcg->has_edge($u, $v)
# Being reflexive is the default, meaning that null transitions
# (transitions from a vertex to the same vertex) are included.
my $tcg = Graph::TransitiveClosure->new($g, reflexive => 1);
my $tcg = Graph::TransitiveClosure->new($g, reflexive => 0);
# is_reachable(u, v) is always reflexive.
$tcg->is_reachable($u, $v)
# You can check any graph for transitivity.
$g->is_transitive()
my $tcg = Graph::TransitiveClosure->new($g, path_length => 1);
$tcg->path_length($u, $v)
# path_vertices is on by default so this is a no-op.
my $tcg = Graph::TransitiveClosure->new($g, path_vertices => 1);
$tcg->path_vertices($u, $v)
# see how many paths exist from $u to $v
my $tcg = Graph::TransitiveClosure->new($g, path_count => 1);
$tcg->path_length($u, $v)
# Both path_length and path_vertices.
my $tcg = Graph::TransitiveClosure->new($g, path => 1);
$tcg->path_vertices($u, $v)
$tcg->length($u, $v)
my $tcg = Graph::TransitiveClosure->new($g, attribute_name => 'length');
$tcg->path_length($u, $v)
π DESCRIPTION π
so here's the tea, bestie π«Ά you can use Graph::TransitiveClosure to compute the transitive closure graph of a graph, and optionally also the minimum paths (both lengths and vertices) between vertices. and then β the main character moment β you can query the transitiveness between vertices with the is_reachable() and is_transitive() methods, and the paths with path_length() and path_vertices(). periodt. π
for further documentation, see the Graph::TransitiveClosure::Matrix. iykyk.
π Class Methods π
new($g, %opt)β Construct a new transitive closure object. and like, lowkey important: strictly speaking the returned object is not a graph β it's a graph plus other stuff. but fr fr, you should be able to use it as a graph plus a couple of methods inherited from theGraph::TransitiveClosure::Matrixclass. slay. β¨
π¦ Object Methods π¦
these are only the methods that are 'native' to the class β see Graph::TransitiveClosure::Matrix for more. don't @ me.
is_transitive($g)β Return true if the Graph$gis transitive. simple as that, no notes. πtransitive_closure_matrixβ Return the transitive closure matrix of the transitive closure object. it's giving matrix reveal moment π
and that's the whole page, bestie!! no crumbs left behind π
this lil icon of a doc came to you via perl v5.40.1, dated 2025-03-28 β so if you're reading this, know that the vibes are timestamped and officially archived. mwah ππΈ
π¦ 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