File: gengraph

package info (click to toggle)
mcl 1%3A14-137-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 10,704 kB
  • ctags: 5,125
  • sloc: ansic: 53,217; sh: 4,448; perl: 3,967; makefile: 422
file content (54 lines) | stat: -rwxr-xr-x 968 bytes parent folder | download | duplicates (5)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/local/bin/perl -w

#  (C) Copyright 2009 Stijn van Dongen
 #
#  This file is part of MCL.  You can redistribute and/or modify MCL under the
#  terms of the GNU General Public License; either version 3 of the License or
#  (at your option) any later version.  You should have received a copy of the
#  GPL along with MCL, in the file COPYING.


sub explain {
print <<EOH;
to be written
EOH
}

use strict;
use Getopt::Long;


if (!@ARGV) {
   print STDERR "issue 'gengraph --help' for help\n";
}

my $mode = "";
my $help = 0;
my $N = 4;
my $W = 1;

if
(! GetOptions
   (  "mode=s"          =>   \$mode
   ,  "N=i"             =>   \$N
   ,  "weight=f"        =>   \$W
   ,  "help"            =>   \$help
   )
)
   {  print STDERR "option processing failed\n";
      exit(1);
   }

&explain && exit(0) if $help;

$mode = lc($mode);

if ($mode eq 'k') {
   for (my $i=0;$i<$N;$i++) {
      for (my $j=0;$j<$N;$j++) {
         print "$i\t$j\t$W\n";
      }
   }
}