#!/usr/bin/perl use GraphViz; use CGI; my $q = new CGI; print $q->header(-type => 'image/png'); my $g = GraphViz->new(no_overlap=>0, directed =>1, rankdir => 0, random_start => 1); my @staff = qw[Andrew Marc Brian Dan Matthew Paul Sandra John Andrew Larry Mike Tom Tom Jennifer Nigel Eric Jim Judy Alex Chris Nolan Matt Andy Drew Dina Kate Ron Sidney Jeremy Danny Steve Sturges Devman Ashoff Dina]; # open(STAFF,"< /home/bmc/bin/engineers.pl | "); #my @staff = ; #for (@staff) { # s/ /_/g; #} my %not_linked; foreach my $staff (@staff) { $g->add_node($staff, shape => 'record', cluster => "devteam org chart (CLASSIFIED)", rank=>"top"); $not_linked{$staff} = 1; } foreach my $s1 (@staff) { $boss = rand(1); my $s2; do { my $ran = rand(@staff); $s2 = $staff[$ran]; } while ($s1 eq $s2 || ($boss >= 0.5 && $hash{$s1}{$s2} eq 1) || ($boss < 0.5 && $hash{$s2}{$s1} eq 1)); if ($boss >= 0.5) { $g->add_edge($s1 => $s2); $hash{$s1}{$s2} = 1; } else { $g->add_edge($s2 => $s1); $hash{$s2}{$s1} = 1; } } print $g->as_png;