#!/usr/bin/env perl

@graph;

if ( -r $ARGV[0] ) {
    open INPUT, $ARGV[0];
    @input = <INPUT>;
    close INPUT;
} else {
    @input = <STDIN>;
}

print <<EOF;
graph G { node [shape=circle,fontname="Lucida Console",margin=0,0];
EOF

$max = shift(@input);
$max = $max - 1;
foreach $i (0 .. $max) {
    @graph = split(' ',shift(@input));
    foreach $j (($i + 1) .. $max) {
        if ($graph[$j] > 0) {
            $graph[$j] /= 2.4;
            print "C$i -- C$j [len=$graph[$j]];\n";
        }
    }

    print "C$i [label=\"C$i\"];\n";
}

print "}";
