File: 11_to_dreadnaut.t

package info (click to toggle)
libgraph-nauty-perl 0.5.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 160 kB
  • sloc: perl: 202; makefile: 3
file content (33 lines) | stat: -rw-r--r-- 450 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use strict;
use warnings;
use Graph::Nauty;
use Graph::Undirected;
use Test::More tests => 2;

my $g = Graph::Undirected->new;

my $n = 5;
for (0..$n-1) {
    $g->add_edge( $_, ($_ - 1) % $n );
    $g->add_edge( $_, ($_ + 1) % $n );
}

is( Graph::Nauty::_to_dreadnaut( $g ), <<END );
n=5 g
1 4;
0 2;
1 3;
2 4;
0 3.
f=[0|1|2|3|4]
END

is( Graph::Nauty::_to_dreadnaut( $g, sub { $_[0] % 2 } ), <<END );
n=5 g
2 3;
3 4;
0 4;
0 1;
1 2.
f=[0,1,2|3,4]
END