#!/usr/bin/perl -w use GraphViz; $in_top = 0; my $g = GraphViz->new(node => {shape => 'point'}); my %pages = (); my %cgis = (); my $lastid = 0; my %cutpoints; while() { chomp; $cutpoints{$_}++; } my %arrow = (); print STDERR "Parsing\n"; while(<>) { if ($in_top) { chomp; last if m!^$!; my ($from,$to) = split /\s*-->\s*/, $_; ($from,$to) = (get_id($from),get_id($to)); next if exists $arrow{$from}{$to} || exists $arrow{$to}{$from}; next if $from == $to; $arrow{$from}{$to}++; $g->add_edge($from => $to); } $in_top = 1 if m!^TOPOLOGIA:!; } print STDERR "$lastid nodes\n"; print STDERR "Printing image\n"; open X, ">foo.ps"; print X $g->as_ps; close X; sub get_id { my $url = shift; for my $re (keys %cutpoints) { if ($url =~ m!^\Q$re\E!) { my $base = $re; push @{$cgis{$base}}, $url; $url = $base; last; } } if ($url =~ m!^([^?]+)\?!) { my $base = $1; push @{$cgis{$base}}, $url; $url = $base; } if (not exists($pages{$url})) { ++$lastid; $pages{$url} = $lastid; $g->add_node($lastid, label => ""); } return $pages{$url} } __DATA__ http://natura.di.uminho.pt/pipermail/