File: clusters2.pl

package info (click to toggle)
libgraphviz-perl 2.24-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 952 kB
  • sloc: perl: 2,174; makefile: 8
file content (29 lines) | stat: -rw-r--r-- 803 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!perl -w

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

my $g = GraphViz->new();

my @default_attrs = (
                     fontsize => '8',
                     fontname => 'arial',
                    );

my $eurocluster = {name=>'Europe',
                   style=>'filled',
                   fillcolor=>'lightgray',
                   fontname=>'arial',
                   fontsize=>'12',
                   };
$g->add_node('London', cluster=>$eurocluster, @default_attrs);
$g->add_node('Paris', cluster=>$eurocluster, @default_attrs);
$g->add_node('New York', @default_attrs);

$g->add_edge('London' => 'Paris', @default_attrs);
$g->add_edge('London' => 'New York', label => 'Far', @default_attrs);
$g->add_edge('Paris' => 'London', @default_attrs);

$g->as_gif("nodes.gif");
$g->as_dot("nodes.dot");