|
6 |
0 |
if (Graph::Graph6::read_graph(ref $filename_or_fh ? 'fh' : 'filename', $filename_or_fh, 'format_func', sub {
my($format) = @_;
$graph = 'Graph'->new('undirected', $format ne 'digraph6');
$check_countedged = $format eq 'sparse6';
}
, 'num_vertices_func', sub {
my($n) = @_;
$width = length $n - 1;
foreach my $i (0 .. $n - 1) {
my $name = &$vertex_name_func($i);
$graph->add_vertex($name);
};
}
, 'edge_func', sub {
my($from, $to) = @_;
$from = &$vertex_name_func($from);
$to = &$vertex_name_func($to);
if ($check_countedged and $graph->has_edge($from, $to)) {
$graph = _countedged_copy($graph);
undef $check_countedged;
};
$graph->add_edge($from, $to);
}
)) { } |