source: liacs/ai/graaf/array2dot.pl@ 7

Last change on this file since 7 was 2, checked in by Rick van der Zwet, 15 years ago

Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)

  • Property svn:executable set to *
File size: 555 bytes
Line 
1#!/usr/bin/env perl
2
3@graph;
4
5if ( -r $ARGV[0] ) {
6 open INPUT, $ARGV[0];
7 @input = <INPUT>;
8 close INPUT;
9} else {
10 @input = <STDIN>;
11}
12
13print <<EOF;
14graph G { node [shape=circle,fontname="Lucida Console",margin=0,0];
15EOF
16
17$max = shift(@input);
18$max = $max - 1;
19foreach $i (0 .. $max) {
20 @graph = split(' ',shift(@input));
21 foreach $j (($i + 1) .. $max) {
22 if ($graph[$j] > 0) {
23 $graph[$j] /= 2.4;
24 print "C$i -- C$j [len=$graph[$j]];\n";
25 }
26 }
27
28 print "C$i [label=\"C$i\"];\n";
29}
30
31print "}";
Note: See TracBrowser for help on using the repository browser.