Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /usr/share/doc/perl-GraphViz/examples/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/doc/perl-GraphViz/examples/undirected.pl
#!/usr/bin/perl -w
#
# This is a simple example of constructing
# undirected graphs. It shows factors, kinda ;-)


use strict;
use lib '../lib';
use GraphViz;

my $g = GraphViz->new(layout => 'neato', directed => 0, no_overlap => 1);

foreach my $i (1..16) {
  my $used = 0;
  $used = 1 if $i >= 2 and $i <= 4;
  foreach my $j (2..4) {
    if ($i != $j && $i % $j == 0) {
      $g->add_edge($i => $j);
      $used = 1;
    }
  }
  $g->add_node($i) if $used;
}

#print $g->_as_debug;
#print $g->as_text;
$g->as_png("undirected.png");


Hry