-
Notifications
You must be signed in to change notification settings - Fork 10
transitive_closure(reflexive => 0) omits isolated vertices #40
Copy link
Copy link
Open
Description
When computing the non-reflexive transitive closure of a directed graph, isolated vertices are missing from the result.
Test case:
#!/usr/bin/perl
use strict;
use warnings;
use Graph;
my $g = Graph->new(directed => 1);
$g->add_edge('A', 'B');
$g->add_edge('B', 'C');
$g->add_vertex('d'); # <- isolated
$g->add_vertex('e'); # <- isolated
print "graph:" . $g->stringify . "\n";
print "transitive closure:" . $g->transitive_closure(reflexive => 0)->stringify . "\n";Output:
graph:A-B,B-C,d,e
transitive closure:A-B,A-C,B-C
Expected behavior:
graph:A-B,B-C,d,e
transitive closure:A-B,A-C,B-C,d,e
The transitive closure should include all vertices from the original graph, including isolated ones (e, f). These are currently omitted in the closure result.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels