alright... i looked at
Graph, which has a directed mode (i assume that's what you mean by uni-directed - i'm thinking uni is one, so one direction -, i could be wrong)
for an undirected graph, you could use
$g->connected_components. i don't think it explicitly says how to get this for a directed graph. you'd have to roll your own... my idea is at least O(n^2) so there's probably a better way, but here ya go:
sub di_graph_connected {
my $g = shift; # $g is of type 'Graph'
my @verts = $g->vertices;
my @pairs = ();
foreach my $front ( @verts ) {
foreach my $back ( @verts ) {
push @pairs, [ $front, $back ] if $g->has_edge( $front, $b
+ack );
}
}
return @pairs;
}
(code untested)
hope this helps!